dialog.edit.vue 26 KB

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