dialog.edit.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831
  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.roleList = [];
  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.roleList = [];
  511. //检查次数
  512. this.formData.count = 1;
  513. //检查内容
  514. this.tableData = null;
  515. break;
  516. }
  517. // this.changeBuildTime();
  518. },
  519. isbuildTaskNow() {
  520. if (
  521. (this.formData.planCreateOrgId == this.orgId &&
  522. this.formData.hasEdit != 1) ||
  523. (this.formData.planOfOrgType != 3 && this.formData.hasEdit != 1) ||
  524. (this.id == null &&
  525. (this.id == null ||
  526. this.id == undefined ||
  527. this.formData.planStatus == 0))
  528. ) {
  529. return false;
  530. } else return true;
  531. },
  532. handleSelectable(row) {
  533. // 在这里根据特定条件判断是否停用多选框行
  534. return this.getshenglianshe(row); // 返回 true 停用,返回 false 不停用
  535. },
  536. // 监听行选中事件,将选中的行数据存入 selectedRows 数组中
  537. handleSelectionChange(selection) {
  538. // console.log(selection, "selection");
  539. this.selectedRows = selection;
  540. },
  541. deleteSelected() {
  542. // 在这里执行批量删除操作,使用 this.selectedRows 数组中的数据
  543. // console.log("删除选中的数据:", this.selectedRows);
  544. // 从数据数组中移除选中的行数据
  545. this.tableData = this.tableData.filter(
  546. (row) => !this.selectedRows.includes(row)
  547. );
  548. // 清空选中的行数据
  549. this.selectedRows = [];
  550. },
  551. //省联社内容不能删除
  552. getshenglianshe(row) {
  553. if (row.ofOrgId == this.orgId) {
  554. return true;
  555. } else return false;
  556. },
  557. //编辑内容判断
  558. isChildren() {
  559. // console.log(this.formData.distributePlanStatus,"distributePlanStatus")
  560. //计划所属机构id等于当前机构id并且不存在已完成或者已逾期或者
  561. //计划所属机构类型不等于行社并且不存在已完成或者已逾期或者
  562. //新增
  563. if (
  564. (this.formData.planCreateOrgId == this.orgId &&
  565. this.formData.hasEdit != 1) ||
  566. (this.formData.planOfOrgType != 3 && this.formData.hasEdit != 1) ||
  567. this.id == null
  568. ) {
  569. return false;
  570. } else return true;
  571. },
  572. NowBuild() {
  573. //如果新增或者是草稿状态的立即生效的编辑
  574. if (
  575. this.formData.planCycle != 6 &&
  576. (this.id == null ||
  577. this.id == undefined ||
  578. (this.defbuildTaskNow && this.formData.planStatus == 0))
  579. )
  580. return true;
  581. else return false;
  582. },
  583. getLabel(options, value) {
  584. return getLabel(options, value);
  585. },
  586. cleanExecOrgList() {
  587. this.execOrgIds = null;
  588. this.formData.execOrgList = [];
  589. this.formData.roleIds = [];
  590. this.formData.execOrgIds = [];
  591. this.getRolesByOrg();
  592. },
  593. cleanCheckOrgList() {
  594. this.checkOrgIds = null;
  595. this.formData.checkOrgList = [];
  596. this.formData.checkOrgIds = [];
  597. this.tableData=[];
  598. },
  599. tenantIdnormalizer(node, instanceId) {
  600. if (node.children && !node.children.length) {
  601. delete node.children;
  602. }
  603. return {
  604. id: node.id,
  605. label: node.name,
  606. children: node.children,
  607. };
  608. },
  609. handleCheckboxChange() {},
  610. reset() {
  611. return {
  612. planName: null,
  613. planType: null,
  614. planCycle: null,
  615. planStatus: null,
  616. execOrgType: null,
  617. roleNames: null,
  618. count: null,
  619. description: null,
  620. tableData: null,
  621. itemList: null,
  622. planExec: null,
  623. count: 0,
  624. note: null,
  625. planCreateOrgId: null,
  626. planCreateOrgName: null,
  627. roleList: null,
  628. roleIds: null,
  629. execOrg: null,
  630. checkOrg: null,
  631. buildTaskNow: false,
  632. checkOrgList: [],
  633. execOrgList: [],
  634. rulePointList: null,
  635. checkOrgIds: null,
  636. execOrgIds: null,
  637. rulePointIds: null,
  638. checkOrgTypes: [],
  639. checkType: null,
  640. startDate: null,
  641. endDate: null,
  642. };
  643. },
  644. getRolesByOrg() {
  645. // let params = {
  646. // orgType: null,
  647. // };
  648. findRoleByType(this.formData.execOrgType).then((res) => {
  649. console.log(res, "res");
  650. this.planRoles = res;
  651. });
  652. },
  653. handleChange(value) {
  654. this.count = value;
  655. },
  656. async refresh(id, other) {
  657. if (id != null && id != undefined) {
  658. await api.get(id).then((res) => {
  659. this.defbuildTaskNow = res.data.buildTaskNow;
  660. this.parentCount = res.data.parentCount;
  661. this.formData = res.data;
  662. this.formData.buildTaskNow;
  663. this.tableData = res.data.rulePointList;
  664. if (this.formData.execOrgType) {
  665. this.formData.roleIds = this.formData.roleList.map(
  666. (role) => role.id
  667. );
  668. this.formData.checkOrgTypes = this.formData.checkOrgTypeList.map(
  669. (type) => type.typeId.toString()
  670. );
  671. this.formData.execOrgIds = this.formData.execOrgList.map(
  672. (org) => org.id
  673. );
  674. this.formData.checkOrgIds = this.formData.checkOrgList.map(
  675. (org) => org.id
  676. );
  677. this.getRolesByOrg();
  678. }
  679. });
  680. } else {
  681. this.formData.id = null;
  682. this.formData.planName = null;
  683. this.formData.planType = null;
  684. this.formData.planCycle = null;
  685. this.formData.planStatus = null;
  686. this.formData.execOrgType = null;
  687. this.formData.checkOrgTypes = [];
  688. this.formData.checkType = null;
  689. this.formData.roleNames = null;
  690. this.formData.count = null;
  691. this.formData.description = null;
  692. this.formData.tableData = null;
  693. this.formData.itemList = null;
  694. this.formData.planExec = null;
  695. this.formData.count = 0;
  696. this.formData.note = null;
  697. this.formData.planCreateOrgId = null;
  698. this.formData.planCreateOrgName = null;
  699. this.formData.roleList = null;
  700. this.formData.roleIds = null;
  701. this.formData.execOrg = null;
  702. this.formData.checkOrg = null;
  703. this.formData.buildTaskNow = false;
  704. this.formData.checkOrgList = [];
  705. this.formData.execOrgList = [];
  706. this.formData.rulePointList = null;
  707. this.formData.checkOrgIds = null;
  708. this.formData.execOrgIds = null;
  709. this.formData.rulePointIds = null;
  710. this.formData.distributePlanStatus = null;
  711. }
  712. },
  713. onSelect(selectList) {
  714. console.log(selectList, "selectList");
  715. for (let i = 0; i < selectList.length; i++) {
  716. let tem = {
  717. ofOrgId: this.orgId,
  718. pointScan: selectList[i].pointScan,
  719. required: !selectList[i].required,
  720. ruleName: selectList[i].ruleName,
  721. itemName: selectList[i].itemName,
  722. pointName: selectList[i].pointName,
  723. areaName: selectList[i].areaName,
  724. itemId: selectList[i].itemId,
  725. id: selectList[i].id,
  726. businessType: selectList[i].businessType,
  727. };
  728. if (this.tableData == null) {
  729. this.tableData = [];
  730. }
  731. if (tem.itemName != null && tem.itemName != undefined) {
  732. this.tableData.push(tem);
  733. }
  734. }
  735. },
  736. async show(id, other = {}) {
  737. this.id = id;
  738. this.tableData = null;
  739. this.formData.execOrgIds = [];
  740. this.formData.checkOrgIds = [];
  741. this.formData.itemList = {};
  742. await this.refresh(id, other);
  743. this.getRolesByOrg();
  744. this.isShow = true;
  745. },
  746. removeRow(row) {
  747. this.$modal
  748. .confirm("是否确认删除?")
  749. .then(function () {})
  750. .then(() => {
  751. this.tableData = this.tableData.filter((item) => item !== row);
  752. this.$modal.msgSuccess("删除成功");
  753. });
  754. // this.tableData = this.tableData.filter((item) => item !== row);
  755. },
  756. // 事件
  757. onHide() {
  758. this.isShow = false;
  759. },
  760. getIteamF() {
  761. // if (this.id == null) {
  762. // this.defaultSelect = [];
  763. // return;
  764. // }else{
  765. // api.getPointIds(this.id).then((res) => {
  766. // this.defaultSelect = res.data;
  767. // });
  768. // }
  769. if (!this.tableData) {
  770. return [];
  771. } else {
  772. return this.tableData.map((d) => d.id);
  773. }
  774. },
  775. openSelect() {
  776. this.$refs.DialogSelect.show(this.getIteamF());
  777. },
  778. onSubmit() {
  779. this.$refs.form.validate(async (isValidate) => {
  780. this.formData.planCreateOrgId = this.orgId;
  781. this.formData.planCreateOrgName = this.orgName;
  782. this.formData.planStatus = 0;
  783. if (!isValidate) return;
  784. this.formData.rulePointList =
  785. this.tableData == null ? [] : this.tableData;
  786. this.formData.roleList = null;
  787. this.formData.roleIds =
  788. this.selectedValues.length == 0 ? null : this.selectedValues;
  789. this.loading = true;
  790. if (this.formData.planCycle == 6) {
  791. this.formData.buildTaskNow = true;
  792. }
  793. await api.add(this.formData).then((data) => {
  794. this.loading = false;
  795. this.$emit("success");
  796. this.onHide();
  797. }).catch((err)=>{
  798. this.loading = false;
  799. // console.log(err,"err")
  800. });
  801. });
  802. },
  803. handleRolesChange(val) {
  804. this.selectedValues = val.toString().split(",");
  805. },
  806. // 事件
  807. //apimark//
  808. },
  809. mounted() {},
  810. components: { DialogSelect, orgDropDown, OrgTree, korgTree, OrgTreeSelect },
  811. };
  812. </script>
  813. <style lang="scss" scoped>
  814. .brand_info {
  815. .el-form {
  816. width: 600px;
  817. padding-top: 40px;
  818. }
  819. }
  820. .checkbox-wrapper .el-checkbox {
  821. display: flex;
  822. align-items: center;
  823. }
  824. </style>