dialog.edit.vue 28 KB

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