dialog.edit.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843
  1. <template>
  2. <div class="rule-type">
  3. <DialogCom
  4. :title="id ? '编辑检查任务' : '新增检查任务'"
  5. :visible.sync="isShow"
  6. width="1500px"
  7. >
  8. <div class="page-body" v-loading="loading">
  9. <el-form
  10. :model="formData"
  11. :rules="formDataRules"
  12. size="small"
  13. ref="form"
  14. label-position="right"
  15. label-width="130px"
  16. label-prefix=":"
  17. >
  18. <el-row>
  19. <el-col :span="6">
  20. <el-form-item prop="planName" label="任务名称:">
  21. <el-input
  22. :disabled="isChildren()"
  23. v-model.trim="formData.planName"
  24. :maxlength="50"
  25. name="planName"
  26. placeholder="请输入"
  27. clearable
  28. />
  29. </el-form-item>
  30. </el-col>
  31. <el-col :span="6">
  32. <el-form-item prop="checkType" label="任务类型:">
  33. <el-select
  34. @change="changeData"
  35. :disabled="isChildren()"
  36. label="任务类型"
  37. v-model="formData.checkType"
  38. placeholder="请选择任务类型"
  39. clearable
  40. >
  41. <el-option
  42. v-for="dict in dict.type.check_type"
  43. :key="dict.value"
  44. :label="dict.label"
  45. :value="dict.value"
  46. >
  47. </el-option>
  48. </el-select>
  49. </el-form-item>
  50. </el-col>
  51. <el-col :span="6">
  52. <el-form-item prop="planCycle" label="任务周期:">
  53. <el-select
  54. :disabled="isChildren()"
  55. prop="planCycle"
  56. label="任务周期"
  57. v-model="formData.planCycle"
  58. placeholder="请选择任务周期"
  59. clearable
  60. >
  61. <el-option
  62. v-for="item in dict.type.check_cycle"
  63. :key="item.value"
  64. :label="item.label"
  65. :value="item.value"
  66. >
  67. </el-option>
  68. </el-select>
  69. </el-form-item>
  70. </el-col>
  71. <el-col :span="6">
  72. <el-form-item
  73. prop="buildTaskNow"
  74. label="立即生效:"
  75. v-if="NowBuild()"
  76. ><div class="checkbox-wrapper">
  77. <el-checkbox
  78. :disabled="isbuildTaskNow()"
  79. v-model="formData.buildTaskNow"
  80. size="medium"
  81. @change="handleCheckboxChange"
  82. >默认从下个周期生成任务,<br />勾选后从当前周期立即生成任务</el-checkbox
  83. >
  84. </div>
  85. </el-form-item>
  86. </el-col>
  87. <el-col :span="6">
  88. <el-form-item
  89. prop="startDate"
  90. label="开始时间:"
  91. v-if="formData.planCycle == 6"
  92. >
  93. <el-date-picker
  94. :disabled="isChildren()"
  95. v-model="formData.startDate"
  96. style="width: 240px"
  97. value-format="yyyy-MM-dd 00:00:00"
  98. placeholder="请选择开始时间"
  99. type="date"
  100. :clearable="false"
  101. ></el-date-picker>
  102. </el-form-item>
  103. </el-col>
  104. <el-col :span="6">
  105. <el-form-item
  106. prop="endDate"
  107. label="结束时间:"
  108. v-if="formData.planCycle == 6"
  109. >
  110. <el-date-picker
  111. :disabled="isChildren()"
  112. v-model="formData.endDate"
  113. style="width: 240px"
  114. value-format="yyyy-MM-dd 23:59:59"
  115. placeholder="请选择结束时间"
  116. type="date"
  117. :clearable="false"
  118. ></el-date-picker>
  119. </el-form-item>
  120. </el-col>
  121. <el-col :span="6">
  122. <el-form-item prop="execOrgType" label="检查主体类型:">
  123. <el-select
  124. :disabled="isChildren()"
  125. @change="cleanExecOrgList"
  126. prop="execOrgType"
  127. label="机构类型"
  128. v-model="formData.execOrgType"
  129. placeholder="请选择机构类型"
  130. clearable
  131. >
  132. <el-option
  133. v-for="item in dict.type.sys_org_type"
  134. :key="item.value"
  135. :label="item.label"
  136. :value="item.value"
  137. >
  138. </el-option>
  139. </el-select>
  140. </el-form-item>
  141. </el-col>
  142. <!-- </el-row> -->
  143. <!-- <el-row> -->
  144. <el-col :span="6">
  145. <el-form-item prop="roleIds" label="检查人员:">
  146. <el-select
  147. :disabled="isChildren()"
  148. label="检查人员"
  149. v-model="formData.roleIds"
  150. placeholder="请选择用户角色"
  151. multiple
  152. filterable
  153. @change="handleRolesChange"
  154. >
  155. <el-option
  156. v-for="item in planRoles"
  157. :key="item.id"
  158. :label="item.roleName"
  159. :value="item.id"
  160. >
  161. </el-option>
  162. </el-select>
  163. </el-form-item>
  164. </el-col>
  165. <el-col :span="6">
  166. <el-form-item prop="checkOrgTypes" label="受检机构类型:">
  167. <el-select
  168. :disabled="isChildren()"
  169. @change="cleanCheckOrgList"
  170. prop="checkOrgTypes"
  171. label="受检机构类型"
  172. v-model="formData.checkOrgTypes"
  173. placeholder="请选择机构类型"
  174. clearable
  175. multiple
  176. >
  177. <el-option
  178. v-for="item in dict.type.sys_org_type"
  179. :key="item.value"
  180. :label="item.label"
  181. :value="item.value"
  182. >
  183. </el-option>
  184. </el-select>
  185. </el-form-item>
  186. </el-col>
  187. <el-col :span="6">
  188. <el-form-item prop="count" label="任务次数:">
  189. <el-input-number
  190. style="margin-left: 10px"
  191. v-model="formData.count"
  192. controls-position="right"
  193. @change="handleChange"
  194. :min="parentCount"
  195. :max="9"
  196. ></el-input-number>
  197. </el-form-item>
  198. </el-col>
  199. </el-row>
  200. <el-row>
  201. <el-col :span="6">
  202. <el-form-item :span="6" prop="execOrgIds" label="检查主体">
  203. <org-tree-select
  204. :disabled="isChildren()"
  205. v-model="formData.execOrgIds"
  206. :queryData="parseInt(formData.execOrgType)"
  207. ref="execorgTreeSelect"
  208. :enabledCheckOrgTypes="parseInt(formData.execOrgType)"
  209. :disable="true"
  210. >
  211. </org-tree-select>
  212. </el-form-item>
  213. </el-col>
  214. <el-col :span="6">
  215. <el-form-item :span="6" prop="checkOrgIds" label="受检机构">
  216. <org-tree-select
  217. :disabled="isChildren()"
  218. v-model="formData.checkOrgIds"
  219. :queryData="parseInt(formData.checkOrgType)"
  220. ref="checkorgTreeSelect"
  221. :enabledCheckOrgTypes="parseInt(formData.checkOrgType)"
  222. :disable="true"
  223. >
  224. </org-tree-select>
  225. </el-form-item>
  226. </el-col>
  227. <!-- <el-col :span="6"> -->
  228. <!-- <el-form-item prop="planStatus" label="计划状态"> -->
  229. <!-- <el-select
  230. label="计划状态"
  231. v-model="formData.planStatus"
  232. placeholder="请选择计划状态"
  233. clearable
  234. >
  235. <el-option
  236. v-for="item in dict.type.check_status"
  237. :key="item.value"
  238. :label="item.label"
  239. :value="item.value"
  240. >
  241. </el-option>
  242. </el-select> -->
  243. <!-- <el-switch
  244. v-model="formData.planStatus"
  245. active-value="1"
  246. inactive-value="2"
  247. ></el-switch> -->
  248. <!-- </el-form-item> -->
  249. <!-- </el-col> -->
  250. </el-row>
  251. <el-form-item :span="6" prop="description" label="备注">
  252. <el-input
  253. :disabled="isChildren()"
  254. v-model="formData.description"
  255. :maxlength="255"
  256. clearable
  257. />
  258. </el-form-item>
  259. </el-form>
  260. <el-button @click="openSelect">选择检查内容</el-button>
  261. <el-button @click="deleteSelected">批量删除</el-button>
  262. <el-table
  263. :data="tableData"
  264. style="width: 100%; margin-top: 15px"
  265. height="400px"
  266. @selection-change="handleSelectionChange"
  267. >
  268. <el-table-column
  269. type="selection"
  270. :selectable="handleSelectable"
  271. ></el-table-column>
  272. <el-table-column label="是否扫描">
  273. <template v-slot="{ row }">
  274. <el-switch
  275. :disabled="!getshenglianshe(row)"
  276. v-model="row.pointScan"
  277. active-text="是"
  278. inactive-text="否"
  279. >
  280. </el-switch>
  281. </template>
  282. </el-table-column>
  283. <el-table-column label="必完成项">
  284. <template v-slot="{ row }">
  285. <el-switch
  286. :disabled="!getshenglianshe(row)"
  287. v-model="row.required"
  288. active-text="是"
  289. inactive-text="否"
  290. >
  291. </el-switch>
  292. </template>
  293. </el-table-column>
  294. <el-table-column
  295. prop="ruleName"
  296. label="检查内容库
  297. "
  298. >
  299. </el-table-column>
  300. <el-table-column prop="itemName" label="检查项"> </el-table-column>
  301. <el-table-column prop="pointName" label="检查内容" width="300px">
  302. <template slot-scope="scope">
  303. <pre>{{ scope.row.pointName }}</pre>
  304. </template>
  305. </el-table-column>
  306. <el-table-column v-if="false" prop="ofOrgId" label="所属机构id">
  307. </el-table-column>
  308. <el-table-column prop="areaName" label="检查区域"> </el-table-column>
  309. <el-table-column prop="businessType" label="数据来源" v-if="false">
  310. <template slot-scope="r">
  311. {{
  312. getLabel(dict.type.point_data_source, `${r.row.businessType}`)
  313. }}
  314. </template>
  315. </el-table-column>
  316. <el-table-column prop="areaName" label="操作">
  317. <template v-slot="{ row }">
  318. <el-button
  319. v-if="getshenglianshe(row)"
  320. type="text"
  321. @click="removeRow(row)"
  322. >删除</el-button
  323. >
  324. </template>
  325. </el-table-column>
  326. </el-table>
  327. </div>
  328. <div slot="footer" class="dialog-footer">
  329. <el-button type="primary" @click="onSubmit">确定</el-button>
  330. <el-button @click="onHide">取消</el-button>
  331. </div>
  332. </DialogCom>
  333. <DialogSelect
  334. ref="DialogSelect"
  335. :defaultSelect="defaultSelect"
  336. :orgType="formData.checkOrgTypes"
  337. @select="onSelect"
  338. ></DialogSelect>
  339. </div>
  340. </template>
  341. <script>
  342. import OrgTreeSelect from "@/components/orgTreeSelect";
  343. import { mapGetters } from "vuex";
  344. import orgDropDown from "@/components/orgTree/orgDropDown.vue";
  345. import OrgTree from "@/components/orgTree";
  346. import korgTree from "@/components/k-orgTree";
  347. import * as api from "@/api/safetycheck/plan";
  348. import { statusOptions } from "@/views/commonOption";
  349. import { findAllRole, findRoleByType } from "@/api/system/role";
  350. import { getLabel } from "@/views/commonOption";
  351. import DialogSelect from "@/views/safetycheck/ruleManager/dialog.select.point.vue";
  352. export default {
  353. dicts: [
  354. "sys_org_type",
  355. "check_type",
  356. "check_cycle",
  357. "check_status",
  358. "point_data_source",
  359. ],
  360. data() {
  361. return {
  362. loading: false,
  363. parentCount: 1,
  364. defaultSelect: [],
  365. selectedValues: [],
  366. planRoles: [],
  367. planName: null,
  368. planType: null,
  369. planCycle: null,
  370. planStatus: null,
  371. execOrgType: null,
  372. roleNames: null,
  373. planExec: null,
  374. defbuildTaskNow: false,
  375. count: 0,
  376. description: null,
  377. selectedRows: [],
  378. propItem: "",
  379. row: "",
  380. tableData: [],
  381. deptOptions: [],
  382. id: null,
  383. isShow: false,
  384. formData: this.reset(),
  385. formDataRules: {
  386. planName: [{ required: true, message: "请输入计划名称" }],
  387. checkType: [{ required: true, message: "请选择检查类型" }],
  388. planCycle: [{ required: true, message: "请选择检查周期" }],
  389. execOrgType: [{ required: true, message: "请选择检查机构类型" }],
  390. roleList: [{ required: true, message: "请选择检查角色" }],
  391. planExec: [{ required: true, message: "请选择计划时间" }],
  392. count: [{ required: true, message: "请选择计划次数" }],
  393. checkOrgTypes: [{ required: true, message: "请选择受检机构类型" }],
  394. roleIds: [{ required: true, message: "请选择检查角色" }],
  395. },
  396. statusOptions: statusOptions,
  397. };
  398. },
  399. props: {
  400. orgTypeOptions: {
  401. type: Array,
  402. },
  403. ruleTypeOptions: {
  404. type: Array,
  405. },
  406. },
  407. watch: {},
  408. computed: {
  409. ...mapGetters(["orgId", "orgName"]),
  410. },
  411. methods: {
  412. //选择计划类型修改联动框
  413. changeData() {
  414. //判断计划类型
  415. switch (this.formData.checkType) {
  416. //如果是 【定期检查】全省农信系统安全检查
  417. case "1":
  418. //周期
  419. this.formData.planCycle = "5";
  420. //机构类型
  421. this.formData.execOrgType = "1";
  422. this.getRolesByOrg();
  423. //角色
  424. this.formData.roleIds = ["116"];
  425. this.selectedValues = ["116"];
  426. //检查次数
  427. this.formData.count = 1;
  428. //检查内容
  429. this.tableData = null;
  430. break;
  431. //如果是 【定期检查】办事处辖区安全检查
  432. case "2":
  433. //周期
  434. this.formData.planCycle = "5";
  435. //机构类型
  436. this.formData.execOrgType = "2";
  437. this.getRolesByOrg();
  438. //角色
  439. this.formData.roleIds = ["118"];
  440. this.selectedValues = ["118"];
  441. //检查次数
  442. this.formData.count = 2;
  443. //检查内容
  444. this.tableData = null;
  445. break;
  446. //如果是 【定期检查】营业网点安全保卫检查
  447. case "3":
  448. //周期
  449. this.formData.planCycle = "2";
  450. //机构类型
  451. this.formData.execOrgType = "4";
  452. this.getRolesByOrg();
  453. //角色
  454. this.formData.roleIds = ["121"];
  455. this.selectedValues = ["121"];
  456. this.formData.checkOrgTypes = ["4"];
  457. //检查次数
  458. this.formData.count = 3;
  459. //检查内容
  460. this.tableData = null;
  461. break;
  462. //如果是 【定期检查】行社全面安全检查
  463. case "4":
  464. //周期
  465. this.formData.planCycle = "5";
  466. //机构类型
  467. this.formData.execOrgType = "3";
  468. this.getRolesByOrg();
  469. //角色
  470. this.formData.roleIds = ["120"];
  471. this.selectedValues = ["120"];
  472. //检查次数
  473. this.formData.count = 2;
  474. //检查内容
  475. this.tableData = null;
  476. break;
  477. //如果是 【不定期检查】阶段性检查
  478. case "5":
  479. //周期
  480. this.formData.planCycle = "6";
  481. //机构类型
  482. this.formData.execOrgType = null;
  483. //角色
  484. this.formData.roleIds = [];
  485. //检查次数
  486. this.formData.count = 1;
  487. //检查内容
  488. this.tableData = null;
  489. break;
  490. //如果是 【不定期检查】专项检查
  491. case "6":
  492. //周期
  493. this.formData.planCycle = "6";
  494. //机构类型
  495. this.formData.execOrgType = null;
  496. //角色
  497. this.formData.roleIds = [];
  498. //检查次数
  499. this.formData.count = 1;
  500. //检查内容
  501. this.tableData = null;
  502. break;
  503. //如果是 其他
  504. case "7":
  505. //周期
  506. this.formData.planCycle = null;
  507. //机构类型
  508. this.formData.execOrgType = null;
  509. //角色
  510. this.formData.roleIds = [];
  511. //检查次数
  512. this.formData.count = 1;
  513. this.formData.checkOrgTypes = [];
  514. //检查内容
  515. this.tableData = null;
  516. break;
  517. }
  518. // this.changeBuildTime();
  519. },
  520. isbuildTaskNow() {
  521. if (
  522. (this.formData.planCreateOrgId == this.orgId &&
  523. this.formData.hasEdit != 1) ||
  524. (this.formData.planOfOrgType != 3 && this.formData.hasEdit != 1) ||
  525. (this.id == null &&
  526. (this.id == null ||
  527. this.id == undefined ||
  528. this.formData.planStatus == 0))
  529. ) {
  530. return false;
  531. } else return true;
  532. },
  533. handleSelectable(row) {
  534. // 在这里根据特定条件判断是否停用多选框行
  535. return this.getshenglianshe(row); // 返回 true 停用,返回 false 不停用
  536. },
  537. // 监听行选中事件,将选中的行数据存入 selectedRows 数组中
  538. handleSelectionChange(selection) {
  539. // console.log(selection, "selection");
  540. this.selectedRows = selection;
  541. },
  542. deleteSelected() {
  543. // 在这里执行批量删除操作,使用 this.selectedRows 数组中的数据
  544. // console.log("删除选中的数据:", this.selectedRows);
  545. // 从数据数组中移除选中的行数据
  546. this.tableData = this.tableData.filter(
  547. (row) => !this.selectedRows.includes(row)
  548. );
  549. // 清空选中的行数据
  550. this.selectedRows = [];
  551. },
  552. //省联社内容不能删除
  553. getshenglianshe(row) {
  554. if (row.ofOrgId == this.orgId) {
  555. return true;
  556. } else return false;
  557. },
  558. //编辑内容判断
  559. isChildren() {
  560. // console.log(this.formData.distributePlanStatus,"distributePlanStatus")
  561. //计划所属机构id等于当前机构id并且不存在已完成或者已逾期或者
  562. //计划所属机构类型不等于行社并且不存在已完成或者已逾期或者
  563. //新增
  564. if (
  565. (this.formData.planCreateOrgId == this.orgId &&
  566. this.formData.hasEdit != 1) ||
  567. (this.formData.planOfOrgType != 3 && this.formData.hasEdit != 1) ||
  568. this.id == null
  569. ) {
  570. return false;
  571. } else return true;
  572. },
  573. NowBuild() {
  574. //如果新增或者是草稿状态的立即生效的编辑
  575. if (
  576. this.formData.planCycle != 6 &&
  577. (this.id == null ||
  578. this.id == undefined ||
  579. (this.defbuildTaskNow && this.formData.planStatus == 0))
  580. )
  581. return true;
  582. else return false;
  583. },
  584. getLabel(options, value) {
  585. return getLabel(options, value);
  586. },
  587. cleanExecOrgList() {
  588. this.execOrgIds = null;
  589. this.formData.execOrgList = [];
  590. this.formData.roleIds = [];
  591. this.formData.execOrgIds = [];
  592. this.getRolesByOrg();
  593. },
  594. cleanCheckOrgList() {
  595. this.checkOrgIds = null;
  596. this.formData.checkOrgList = [];
  597. this.formData.checkOrgIds = [];
  598. this.tableData = [];
  599. },
  600. tenantIdnormalizer(node, instanceId) {
  601. if (node.children && !node.children.length) {
  602. delete node.children;
  603. }
  604. return {
  605. id: node.id,
  606. label: node.name,
  607. children: node.children,
  608. };
  609. },
  610. handleCheckboxChange() {},
  611. reset() {
  612. return {
  613. planName: null,
  614. planType: null,
  615. planCycle: null,
  616. planStatus: null,
  617. execOrgType: null,
  618. roleNames: null,
  619. count: null,
  620. description: null,
  621. tableData: null,
  622. itemList: null,
  623. planExec: null,
  624. count: 0,
  625. note: null,
  626. planCreateOrgId: null,
  627. planCreateOrgName: null,
  628. roleList: null,
  629. roleIds: null,
  630. execOrg: null,
  631. checkOrg: null,
  632. buildTaskNow: false,
  633. checkOrgList: [],
  634. execOrgList: [],
  635. rulePointList: null,
  636. checkOrgIds: null,
  637. execOrgIds: null,
  638. rulePointIds: null,
  639. checkOrgTypes: [],
  640. checkType: null,
  641. startDate: null,
  642. endDate: null,
  643. };
  644. },
  645. getRolesByOrg() {
  646. // let params = {
  647. // orgType: null,
  648. // };
  649. findRoleByType(this.formData.execOrgType).then((res) => {
  650. console.log(res, "res");
  651. this.planRoles = res;
  652. });
  653. },
  654. handleChange(value) {
  655. this.count = value;
  656. },
  657. async refresh(id, other) {
  658. if (id != null && id != undefined) {
  659. await api.get(id).then((res) => {
  660. this.defbuildTaskNow = res.data.buildTaskNow;
  661. this.parentCount = res.data.parentCount;
  662. this.formData = res.data;
  663. this.formData.buildTaskNow;
  664. this.tableData = res.data.rulePointList;
  665. if (this.formData.execOrgType) {
  666. this.formData.roleIds = this.formData.roleList.map(
  667. (role) => role.id
  668. );
  669. this.formData.checkOrgTypes = this.formData.checkOrgTypeList.map(
  670. (type) => type.typeId.toString()
  671. );
  672. this.formData.execOrgIds = this.formData.execOrgList.map(
  673. (org) => org.id
  674. );
  675. this.formData.checkOrgIds = this.formData.checkOrgList.map(
  676. (org) => org.id
  677. );
  678. this.getRolesByOrg();
  679. }
  680. });
  681. } else {
  682. this.formData.id = null;
  683. this.formData.planName = null;
  684. this.formData.planType = null;
  685. this.formData.planCycle = null;
  686. this.formData.planStatus = null;
  687. this.formData.execOrgType = null;
  688. this.formData.checkOrgTypes = [];
  689. this.formData.checkType = null;
  690. this.formData.roleNames = null;
  691. this.formData.count = null;
  692. this.formData.description = null;
  693. this.formData.tableData = null;
  694. this.formData.itemList = null;
  695. this.formData.planExec = null;
  696. this.formData.count = 0;
  697. this.formData.note = null;
  698. this.formData.planCreateOrgId = null;
  699. this.formData.planCreateOrgName = null;
  700. this.formData.roleList = null;
  701. this.formData.roleIds = null;
  702. this.formData.execOrg = null;
  703. this.formData.checkOrg = null;
  704. this.formData.buildTaskNow = false;
  705. this.formData.checkOrgList = [];
  706. this.formData.execOrgList = [];
  707. this.formData.rulePointList = null;
  708. this.formData.checkOrgIds = null;
  709. this.formData.execOrgIds = null;
  710. this.formData.rulePointIds = null;
  711. this.formData.distributePlanStatus = null;
  712. }
  713. },
  714. onSelect(selectList) {
  715. console.log(selectList, "selectList");
  716. for (let i = 0; i < selectList.length; i++) {
  717. let tem = {
  718. ofOrgId: this.orgId,
  719. pointScan: selectList[i].pointScan,
  720. required: !selectList[i].required,
  721. ruleName: selectList[i].ruleName,
  722. itemName: selectList[i].itemName,
  723. pointName: selectList[i].pointName,
  724. areaName: selectList[i].areaName,
  725. itemId: selectList[i].itemId,
  726. id: selectList[i].id,
  727. businessType: selectList[i].businessType,
  728. };
  729. if (this.tableData == null) {
  730. this.tableData = [];
  731. }
  732. if (tem.itemName != null && tem.itemName != undefined) {
  733. this.tableData.push(tem);
  734. }
  735. }
  736. },
  737. async show(id, other = {}) {
  738. this.id = id;
  739. this.tableData = null;
  740. this.formData.execOrgIds = [];
  741. this.formData.checkOrgIds = [];
  742. this.formData.itemList = {};
  743. await this.refresh(id, other);
  744. this.getRolesByOrg();
  745. this.isShow = true;
  746. },
  747. removeRow(row) {
  748. this.$modal
  749. .confirm("是否确认删除?")
  750. .then(function () {})
  751. .then(() => {
  752. this.tableData = this.tableData.filter((item) => item !== row);
  753. this.$modal.msgSuccess("删除成功");
  754. });
  755. // this.tableData = this.tableData.filter((item) => item !== row);
  756. },
  757. // 事件
  758. onHide() {
  759. this.isShow = false;
  760. },
  761. getIteamF() {
  762. // if (this.id == null) {
  763. // this.defaultSelect = [];
  764. // return;
  765. // }else{
  766. // api.getPointIds(this.id).then((res) => {
  767. // this.defaultSelect = res.data;
  768. // });
  769. // }
  770. if (!this.tableData) {
  771. return [];
  772. } else {
  773. return this.tableData.map((d) => d.id);
  774. }
  775. },
  776. openSelect() {
  777. if (
  778. this.formData.checkOrgTypes == null ||
  779. this.formData.checkOrgTypes.length === 0
  780. ) {
  781. this.$modal.alert("请先选择受检机构类型");
  782. return;
  783. }
  784. this.$refs.DialogSelect.show(this.getIteamF());
  785. },
  786. onSubmit() {
  787. this.$refs.form.validate(async (isValidate) => {
  788. this.formData.planCreateOrgId = this.orgId;
  789. this.formData.planCreateOrgName = this.orgName;
  790. this.formData.planStatus = 0;
  791. if (!isValidate) return;
  792. this.formData.rulePointList =
  793. this.tableData == null ? [] : this.tableData;
  794. this.formData.roleList = null;
  795. this.formData.roleIds =
  796. this.selectedValues.length == 0 ? null : this.selectedValues;
  797. this.loading = true;
  798. if (this.formData.planCycle == 6) {
  799. this.formData.buildTaskNow = true;
  800. }
  801. await api
  802. .add(this.formData)
  803. .then((data) => {
  804. this.loading = false;
  805. this.$emit("success");
  806. this.onHide();
  807. })
  808. .catch((err) => {
  809. this.loading = false;
  810. // console.log(err,"err")
  811. });
  812. });
  813. },
  814. handleRolesChange(val) {
  815. this.selectedValues = val.toString().split(",");
  816. },
  817. // 事件
  818. //apimark//
  819. },
  820. mounted() {},
  821. components: { DialogSelect, orgDropDown, OrgTree, korgTree, OrgTreeSelect },
  822. };
  823. </script>
  824. <style lang="scss" scoped>
  825. .brand_info {
  826. .el-form {
  827. width: 600px;
  828. padding-top: 40px;
  829. }
  830. }
  831. .checkbox-wrapper .el-checkbox {
  832. display: flex;
  833. align-items: center;
  834. }
  835. </style>