processSubmitDialog.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840
  1. <template>
  2. <ele-modal
  3. custom-class="ele-dialog-form long-dialog-form"
  4. :centered="true"
  5. :visible="processSubmitDialogFlag"
  6. :title="title"
  7. append-to-body
  8. :close-on-click-modal="false"
  9. :width="modelWidth"
  10. :before-close="cancel"
  11. :maxable="true"
  12. :resizable="true"
  13. >
  14. <div style="display: flex; height: 100%; justify-content: space-between">
  15. <div class="form-box">
  16. <!-- <div style="text-align: center; padding: 5px">-->
  17. <!-- {{ form.name }}-->
  18. <!-- </div>-->
  19. <fm-generate-form
  20. :preview="true"
  21. class="el-form-box"
  22. v-if="Object.keys(form?.formJson || {}).length !== 0"
  23. :data="jsonData"
  24. :value="form.valueJson"
  25. ref="generateForm"
  26. >
  27. <template v-slot:blank_adopzrdd="scope">
  28. <el-button
  29. type="primary"
  30. size="small"
  31. @click="addNewRow('blank_adopzrdd')"
  32. style="margin-bottom: 10px"
  33. >添加报销事项</el-button
  34. >
  35. <div
  36. v-for="(item, index) in scope.model.blank_adopzrdd"
  37. :key="index"
  38. >
  39. <div class="blank_adopzrdd">
  40. <span>{{ index + 1 }}报销事项:</span>
  41. <el-input
  42. v-model="scope.model.blank_adopzrdd[index].remark"
  43. type="textarea"
  44. style="width: calc(100% - 80px)"
  45. ></el-input>
  46. </div>
  47. <div class="blank_adopzrdd">
  48. <span @click="delNewRow('blank_adopzrdd', index)"
  49. ><i
  50. class="el-icon-delete"
  51. style="color: #f56c6c; cursor: pointer"
  52. ></i
  53. >金额:</span
  54. >
  55. <el-input
  56. v-model="scope.model.blank_adopzrdd[index].price"
  57. type="number"
  58. style="width: calc(100% - 80px)"
  59. @change="changePrice(scope.model.blank_adopzrdd)"
  60. ></el-input>
  61. </div>
  62. </div>
  63. </template>
  64. <!-- 客户名称 -->
  65. <template v-slot:eom_contact="scope">
  66. <div class="eom_contact">
  67. <el-input
  68. v-model="scope.model.eom_contact.name"
  69. style="width: 100%"
  70. @click.native="addContact('eom_contact')"
  71. ></el-input>
  72. </div>
  73. </template>
  74. <template v-slot:blank_business_component="scope">
  75. <businessComponent ref="businessComponentRef" :info="scope.model"></businessComponent>
  76. </template>
  77. </fm-generate-form>
  78. </div>
  79. <div
  80. style="
  81. align-self: center;
  82. display: flex;
  83. color: #1890ff;
  84. cursor: pointer;
  85. width: 15px;
  86. "
  87. @click="() => (isRight = !isRight)"
  88. >
  89. <span
  90. style="
  91. align-self: center;
  92. transform: scale(1.5);
  93. "
  94. :class="isRight ? 'el-icon-caret-left' : 'el-icon-caret-right'"
  95. >
  96. </span>
  97. <span style="writing-mode: vertical-rl">选择流程</span>
  98. </div>
  99. <div style="flex: 1" v-if="isRight">
  100. <el-form
  101. ref="form"
  102. :rules="rules"
  103. class="el-form-box"
  104. :model="form"
  105. label-width="80px"
  106. >
  107. <el-row>
  108. <el-col :span="12">
  109. <el-form-item label="流程分类">
  110. <ele-tree-select
  111. @change="changeLCFL"
  112. clearable
  113. ref="processTypeRef"
  114. filterable
  115. :data="LCFLList"
  116. v-model="form.LCFL"
  117. childrenKey="children"
  118. valueKey="id"
  119. labelKey="name"
  120. placeholder="请选择"
  121. default-expand-all
  122. />
  123. </el-form-item>
  124. </el-col>
  125. <el-col :span="12">
  126. <el-form-item label="发起流程">
  127. <el-select
  128. filterable
  129. v-model="form.FQLC"
  130. @change="changeFQLC"
  131. style="width: 100%"
  132. >
  133. <el-option
  134. v-for="item in processList"
  135. :key="item.id"
  136. :value="item.id"
  137. :label="item.name"
  138. ></el-option>
  139. </el-select>
  140. </el-form-item>
  141. </el-col>
  142. </el-row>
  143. <el-row>
  144. <el-col :span="12">
  145. <el-form-item label="流程名称">
  146. <el-input v-model="form.name" clearable></el-input>
  147. </el-form-item>
  148. </el-col>
  149. <el-col :span="12">
  150. <el-form-item label="流程标识">
  151. <el-input v-model="form.key" disabled></el-input>
  152. </el-form-item>
  153. </el-col>
  154. </el-row>
  155. <headerTitle
  156. title="流程执行人/流程图"
  157. style="margin-top: 30px"
  158. ></headerTitle>
  159. <el-table
  160. :data="datasource"
  161. height="150px"
  162. border
  163. style="margin-bottom: 10px"
  164. >
  165. <el-table-column
  166. label="任务节点"
  167. align="center"
  168. prop="taskDefinitionName"
  169. width="140"
  170. fixed
  171. />
  172. <el-table-column
  173. label="执行人"
  174. align="center"
  175. prop="options"
  176. min-width="140px"
  177. >
  178. <template v-slot="scope">
  179. <div
  180. v-if="
  181. scope.row.type !== 60 &&
  182. scope.row.type !== 70 &&
  183. scope.row.options.length > 0
  184. "
  185. >
  186. <el-tag
  187. size="medium"
  188. :key="option"
  189. v-for="option in scope.row.options"
  190. >
  191. {{ getAssignRuleOptionName(scope.row, option) }}
  192. </el-tag>
  193. </div>
  194. <el-tag
  195. size="medium"
  196. v-if="scope.row.type === 60 || scope.row.type === 70|| scope.row.type === 80"
  197. >
  198. {{ getAssignRuleOptionName(scope.row) }}
  199. </el-tag>
  200. </template>
  201. </el-table-column>
  202. </el-table>
  203. <my-process-viewer
  204. style="min-width: 100%; height: 200px"
  205. key="designer"
  206. v-model="bpmnXML"
  207. />
  208. </el-form>
  209. </div>
  210. </div>
  211. <div slot="footer">
  212. <el-form :model="form">
  213. <el-form-item label="通知人:">
  214. <el-button
  215. style="float: left; margin-top: 5px"
  216. icon="el-icon-circle-plus-outline"
  217. round
  218. @click="handleEditDataScope"
  219. ></el-button>
  220. <div style="display: flex; flex-direction: row; flex-wrap: wrap">
  221. <el-tag
  222. style="float: left; margin: 5px 5px 0 5px"
  223. v-for="(item, index) in form.noticeScope"
  224. :key="item.name"
  225. effect="plain"
  226. closable
  227. :title="item.name"
  228. @close="handleCloseTag(index)"
  229. >
  230. {{
  231. item.name.length > 3
  232. ? item.name[0] + item.name[1] + item.name[2] + '...'
  233. : item.name
  234. }}
  235. </el-tag>
  236. </div>
  237. <!-- <ele-tree-select-->
  238. <!-- @change="handleTreeChange"-->
  239. <!-- filterable-->
  240. <!-- style="width: 100%"-->
  241. <!-- ref="treeSelect"-->
  242. <!-- multiple-->
  243. <!-- clearable-->
  244. <!-- :data="treeData"-->
  245. <!-- v-model="treeList"-->
  246. <!-- placeholder="请选择"-->
  247. <!-- valueKey="id"-->
  248. <!-- labelKey="name"-->
  249. <!-- :checkStrictly="true"-->
  250. <!-- />-->
  251. </el-form-item>
  252. </el-form>
  253. <!-- <el-button-->
  254. <!-- type="primary"-->
  255. <!-- size="small"-->
  256. <!-- v-if="active == 0"-->
  257. <!-- @click="() => ((active = 1), (isRight = true))"-->
  258. <!-- >下一步-->
  259. <!-- </el-button>-->
  260. <!-- <el-button-->
  261. <!-- type="primary"-->
  262. <!-- size="small"-->
  263. <!-- v-if="active == 1"-->
  264. <!-- @click="() => (active = 0)"-->
  265. <!-- >上一步-->
  266. <!-- </el-button>-->
  267. <el-button type="primary" size="small" @click="submit">提交</el-button>
  268. <el-button size="small" @click="cancel">关闭</el-button>
  269. <!-- <visibility-range-dialog-->
  270. <!-- :visibilityRangeDialogFlag.sync="visibilityRangeDialogFlag"-->
  271. <!-- v-if="visibilityRangeDialogFlag"-->
  272. <!-- @getTreeList="getTreeList"-->
  273. <!-- ref="visibilityRangeDialogRef"-->
  274. <!-- ></visibility-range-dialog>-->
  275. <staffSelection
  276. ref="staffSelection"
  277. @confirm="getTreeList"
  278. ></staffSelection>
  279. </div>
  280. <parentList
  281. ref="parentRef"
  282. @changeParent="handleConcatConfirm"
  283. ></parentList>
  284. </ele-modal>
  285. </template>
  286. <script>
  287. import {
  288. getModelPage,
  289. getProcessDefinitionBpmnXML,
  290. getProcessDefinitionInfo,
  291. getTaskAssignRuleList,
  292. listAllUserBind,
  293. listSimpleUserGroups,
  294. processInstanceCreateAPI
  295. } from './api';
  296. import { treeClassifyCodeEnum } from '@/enum/dict';
  297. import { listRoles } from '@/api/system/role';
  298. import { listOrganizations } from '@/api/system/organization';
  299. import dictMixins from '@/mixins/dictMixins';
  300. import { getByCode } from '@/api/system/dictionary-data';
  301. import { getGroupUserTree, getProduceTreeByCode } from '@/api/main';
  302. import visibilityRangeDialog from './visibilityRangeDialog.vue';
  303. import { getModel } from '@/api/bpm/model';
  304. import { getProcessDefinitionList } from '@/api/bpm/definition';
  305. import { getToken } from '@/utils/token-util';
  306. import { mapGetters } from 'vuex';
  307. import staffSelection from '@/components/staffSelection/staffSelection.vue';
  308. import { topLevel1, topLevel2, topLevel3 } from '@/enum/dict';
  309. import dayjs from 'dayjs';
  310. import parentList from './components/parentList.vue';
  311. import { number } from 'echarts';
  312. import { del } from 'vue';
  313. import businessComponent from './components/businessComponent.vue';
  314. export default {
  315. name: 'processSubmitDialog',
  316. components: { visibilityRangeDialog, staffSelection, parentList, businessComponent },
  317. mixins: [dictMixins],
  318. props: {
  319. processSubmitDialogFlag: {
  320. type: Boolean,
  321. default: false
  322. }
  323. },
  324. watch: {
  325. filterText(val) {
  326. this.$refs.tree.filter(val);
  327. }
  328. },
  329. data() {
  330. return {
  331. visibilityRangeDialogFlag: false,
  332. isRight: false,
  333. jsonData: {},
  334. form: {
  335. LCFL: '',
  336. FQLC: '',
  337. processDefinitionId: '',
  338. name: '',
  339. businessId: '',
  340. noticeScope: [],
  341. formJson: {},
  342. valueJson: {},
  343. businessKey: ''
  344. },
  345. title: '',
  346. active: 0,
  347. bpmnXML: null,
  348. filterText: null,
  349. treeList: [],
  350. treeData: [],
  351. defaultProps: {
  352. children: 'children',
  353. label: 'name'
  354. },
  355. LCFLList: [],
  356. processList: [],
  357. datasource: [],
  358. roleOptions: [],
  359. deptOptions: [],
  360. deptTreeOptions: [],
  361. postOptions: [],
  362. userOptions: [],
  363. userGroupOptions: [],
  364. dictList: {},
  365. rules: {},
  366. editForm: {
  367. start: '',
  368. end: '',
  369. days: ''
  370. }
  371. };
  372. },
  373. computed: {
  374. ...mapGetters(['user']),
  375. modelWidth() {
  376. let width = this.jsonData.config?.platform && this.jsonData.config.platform === 'pc' ? 1100 : 450;
  377. if(this.isRight) {
  378. return width + 350 + 'px'
  379. } else {
  380. return width + 'px'
  381. }
  382. }
  383. },
  384. async created() {
  385. let typeObj = await getProduceTreeByCode(
  386. treeClassifyCodeEnum['PROCESSTYPE']
  387. );
  388. // await this.getTreeData();
  389. this.LCFLList = typeObj[0].children;
  390. // 获得角色列表
  391. this.roleOptions = [];
  392. listRoles({
  393. current: 1,
  394. size: 9999
  395. }).then((data) => {
  396. this.roleOptions.push(...data.list);
  397. });
  398. // 获得部门列表
  399. this.deptOptions = [];
  400. this.deptTreeOptions = [];
  401. listOrganizations().then((data) => {
  402. this.deptOptions.push(...data);
  403. this.deptTreeOptions.push(...this.handleTree(data, 'id'));
  404. });
  405. // 获得岗位列表 暂无岗位概念
  406. this.postOptions = [];
  407. /*listSimplePosts().then(response => {
  408. this.postOptions.push(...response.data);
  409. });*/
  410. // 获得用户列表
  411. this.userOptions = [];
  412. listAllUserBind().then((data) => {
  413. this.userOptions.push(...data);
  414. });
  415. // 获得用户组列表
  416. this.userGroupOptions = [];
  417. listSimpleUserGroups().then((response) => {
  418. this.userGroupOptions.push(...response);
  419. });
  420. //this.dictEnum['工作流任务分配自定义脚本']
  421. await this.getDictList(this.dictEnum['工作流任务分配自定义脚本']);
  422. await this.getDictList(this.dictEnum['工种类型']);
  423. },
  424. mounted() {
  425. //this.isRight = false
  426. },
  427. methods: {
  428. async addNewRow(key) {
  429. console.log(key);
  430. let data = await this.$refs.generateForm.getData(false);
  431. data[key].push({
  432. price: '',
  433. remark: ''
  434. });
  435. this.$refs.generateForm.setData({
  436. key: data[key]
  437. });
  438. },
  439. async delNewRow(key, index) {
  440. let data = await this.$refs.generateForm.getData(false);
  441. data[key] = data[key].filter((item, index1) => index1 != index);
  442. this.$refs.generateForm.setData({
  443. [key]: data[key]
  444. });
  445. this.changePrice(data[key]);
  446. },
  447. changePrice(data) {
  448. let num = 0;
  449. data.forEach((item) => {
  450. num += Number(item.price);
  451. });
  452. this.$refs.generateForm.setData({
  453. input_jd9ouzyh: num
  454. });
  455. },
  456. async addContact(type) {
  457. console.log(type);
  458. let data = await this.$refs.generateForm.getData(false);
  459. console.log('data', data);
  460. data[type] = {
  461. id: '',
  462. name: ''
  463. };
  464. this.$refs.generateForm.setData({
  465. type: data[type]
  466. });
  467. let item = {
  468. id: data[type].id
  469. };
  470. this.$refs.parentRef.open(item);
  471. },
  472. async handleConcatConfirm(item) {
  473. console.log('选择的客户', item);
  474. let data = await this.$refs.generateForm.getData(false);
  475. data['eom_contact'] = {
  476. id: item.id,
  477. name: item.name
  478. }
  479. this.$refs.generateForm.setData({
  480. 'eom_contact': data['eom_contact']
  481. });
  482. console.log('data~~~~', data);
  483. },
  484. async init(row = {}) {
  485. this.title = row.name; //'新建' + row.name + '单';
  486. this.form = _.cloneDeep(row);
  487. this.form.formId = row.id;
  488. this.$set(this.form, 'noticeScope', []);
  489. this.$set(this.form, 'LCFL', '');
  490. this.$set(this.form, 'FQLC', '');
  491. this.$set(this.form, 'name', '');
  492. this.$set(this.form, 'key', '');
  493. this.$set(this.form, 'valueJson', {});
  494. this.jsonData = JSON.parse(this.form.formJson.makingJson);
  495. console.log('jsonData', this.jsonData);
  496. this.jsonData.config.dataSource &&
  497. this.jsonData.config.dataSource.forEach((item) => {
  498. item.headers = {
  499. Authorization: getToken()
  500. };
  501. // item.url = item.url && item.url.replace('/api', this.APIUrl);
  502. });
  503. this.jsonData.list.forEach((item) => {
  504. if (item.type == 'deptAndUserCascader') {
  505. }
  506. if (item.type == 'deptCascader') {
  507. if (item.options.isDefaultLoginUser) {
  508. this.form.valueJson[item.model] = this.user.info.groupIdList;
  509. }
  510. }
  511. if (item.type == 'userSelect') {
  512. if (item.options.isDefaultLoginUser) {
  513. this.form.valueJson[item.model] = this.user.info.userId;
  514. }
  515. }
  516. if (item.type == 'imgupload') {
  517. // this.form.valueJson[item.model].length &&
  518. // this.form.valueJson[item.model].forEach((item) => {
  519. // //item.objectUrl = this.APIUrl +'/kd-aiot' + item.storePath
  520. // // item.objectUrl = item.url;
  521. // // console.log(item);
  522. // });
  523. }
  524. });
  525. await this.getProcessDefinitionBpmnXMLInfo(this.form.processModelId);
  526. await this.getTaskAssignRuleListInfo({
  527. modelId: this.form.processModelId,
  528. processDefinitionId: this.form.processDefinitionId
  529. });
  530. await this.getDefaultInfo(row.processModelId);
  531. },
  532. async getDefaultInfo(businessKey) {
  533. let info = await getModel(businessKey);
  534. //let info = await getProcessDefinitionInfo({ id: businessKey });
  535. this.form.LCFL = info?.category;
  536. this.form.FQLC = info?.id;
  537. this.form.name = this.title;
  538. this.form.key = info?.key;
  539. if (this.form.LCFL) await this.getProcessList(this.form.LCFL);
  540. },
  541. async getProcessList(val) {
  542. let params = {
  543. pageNo: 1,
  544. pageSize: 999,
  545. processTypeId: val
  546. };
  547. const { list } = await getModelPage(params);
  548. this.processList = list.filter((item) => item.processDefinition);
  549. },
  550. async getProcessDefinitionBpmnXML(val) {
  551. this.bpmnXML = await getProcessDefinitionBpmnXML(val);
  552. },
  553. async getProcessDefinitionBpmnXMLInfo(val) {
  554. // 加载流程图
  555. let res = await getModel(val);
  556. this.bpmnXML = res.bpmnXml;
  557. },
  558. async getTaskAssignRuleListInfo(find) {
  559. this.datasource = await getTaskAssignRuleList({
  560. modelId: find.modelId,
  561. processDefinitionId: find.processDefinitionId
  562. });
  563. },
  564. handleEditDataScope() {
  565. this.$refs.staffSelection.open(this.form.noticeScope);
  566. // this.visibilityRangeDialogFlag = true;
  567. // this.$nextTick(() => {
  568. // this.$refs.visibilityRangeDialogRef.init(this.form);
  569. // });
  570. },
  571. getTreeList(list) {
  572. list.forEach((item) => {
  573. item.type = 1;
  574. });
  575. this.form.noticeScope = list;
  576. },
  577. handleCloseTag(index) {
  578. this.form.noticeScope.splice(index, 1);
  579. },
  580. getAssignRuleOptionName(row, option) {
  581. if (row.type == 10) {
  582. for (const roleOption of this.roleOptions) {
  583. if (roleOption.id === option) {
  584. return roleOption.name;
  585. }
  586. }
  587. } else if (row.type === 20 || row.type === 21) {
  588. for (const deptOption of this.deptOptions) {
  589. if (deptOption.id === option) {
  590. return deptOption.name;
  591. }
  592. }
  593. } else if (row.type === 22) {
  594. option = option + ''; // 转换成 string
  595. return this.getDictV(this.dictEnum['工种类型'], option);
  596. } else if (row.type === 30 || row.type === 31 || row.type === 32) {
  597. for (const userOption of this.userOptions) {
  598. if (userOption.id === option) {
  599. return userOption.nickname || userOption.name;
  600. }
  601. }
  602. } else if (row.type === 40) {
  603. for (const userGroupOption of this.userGroupOptions) {
  604. if (userGroupOption.id === option) {
  605. return userGroupOption.name;
  606. }
  607. }
  608. } else if (row.type === 50) {
  609. option = option + ''; // 转换成 string
  610. return this.getDictV(
  611. this.dictEnum['工作流任务分配自定义脚本'],
  612. option
  613. );
  614. } else if (row.type === 60) {
  615. return row.variableName;
  616. } else if (row.type === 70) {
  617. let data = JSON.parse(row.variableName);
  618. if (data.direction == 1) {
  619. return topLevel2.find((item) => item.value == data.topLevel)?.label;
  620. } else {
  621. return topLevel1.find((item) => item.value == data.topLevel)?.label;
  622. }
  623. } else if (row.type === 80) {
  624. let data = JSON.parse(row.variableName);
  625. return topLevel3.find((item) => item.value == data.topLevel)?.label;
  626. }
  627. return '未知(' + option + ')';
  628. },
  629. async getTreeData() {
  630. this.treeData = await getGroupUserTree();
  631. },
  632. filterNode(value, data) {
  633. if (!value) return true;
  634. return data.name.indexOf(value) !== -1;
  635. },
  636. /**
  637. * 构造树型结构数据
  638. * @param {*} data 数据源
  639. * @param {*} id id字段 默认 'id'
  640. * @param {*} parentId 父节点字段 默认 'parentId'
  641. * @param {*} children 孩子节点字段 默认 'children'
  642. * @param {*} rootId 根Id 默认 0
  643. */
  644. handleTree(data, id, parentId, children, rootId) {
  645. id = id || 'id';
  646. parentId = parentId || 'parentId';
  647. children = children || 'children';
  648. rootId =
  649. rootId ||
  650. Math.min.apply(
  651. Math,
  652. data.map((item) => {
  653. return item[parentId];
  654. })
  655. ) ||
  656. 0;
  657. //对源数据深度克隆
  658. const cloneData = JSON.parse(JSON.stringify(data));
  659. //循环所有项
  660. const treeData = cloneData.filter((father) => {
  661. let branchArr = cloneData.filter((child) => {
  662. //返回每一项的子级数组
  663. return father[id] == child[parentId];
  664. });
  665. branchArr.length > 0 ? (father.children = branchArr) : '';
  666. //返回第一层
  667. return father[parentId] == rootId;
  668. });
  669. return treeData !== '' ? treeData : data;
  670. },
  671. getDictV(code, val) {
  672. if (!this.dictList[code]) return '';
  673. return this.dictList[code].find((item) => item.value == val)?.label;
  674. },
  675. async getDictList(code) {
  676. let { data: res } = await getByCode(code);
  677. this.dictList[code] = res.map((item) => {
  678. let values = Object.keys(item);
  679. return {
  680. value: values[0],
  681. label: item[values[0]]
  682. };
  683. });
  684. },
  685. generateFormValid(validate = true) {
  686. return this.$refs.generateForm.getData(validate).then((data) => {
  687. return data;
  688. });
  689. },
  690. handleTreeChange() {
  691. this.$nextTick(() => {
  692. this.form.noticeScope =
  693. this.$refs.treeSelect.$refs.tree.getCheckedNodes();
  694. console.log(this.form.noticeScope);
  695. });
  696. },
  697. async changeLCFL(val) {
  698. this.bpmnXML = null;
  699. this.form.processDefinitionId = null;
  700. this.form.FQLC = null;
  701. await this.getProcessList(val);
  702. },
  703. async changeFQLC(val) {
  704. if (!val) return;
  705. let find = this.processList.find((item) => item.id === val) || {};
  706. this.form.name = find.name;
  707. this.form.key = find.key;
  708. this.form.processDefinitionId = find.processDefinition.id;
  709. this.form.processModelId = val;
  710. await this.getProcessDefinitionBpmnXML(find.processDefinition.id);
  711. await this.getTaskAssignRuleListInfo({
  712. modelId: find.id,
  713. processDefinitionId: find.processDefinition.id
  714. });
  715. },
  716. async submit() {
  717. console.log('this.form~~~', this.$refs.businessComponentRef.form);
  718. const businessComponentForm = this.$refs.businessComponentRef.form;
  719. let data = await this.$refs.generateForm.getData(false);
  720. data['blank_business_component'] = businessComponentForm.blank_business_component;
  721. this.$refs.generateForm.setData({
  722. 'blank_business_component': data['blank_business_component']
  723. });
  724. console.log('data~~~~', data);
  725. this.form.valueJson = {...await this.generateFormValid(), blank_business_component: businessComponentForm.blank_business_component};
  726. this.form.processType = '1';
  727. console.log('formformformform', this.form);
  728. // return false
  729. await processInstanceCreateAPI({
  730. ...this.form,
  731. variables: { ...this.form.valueJson }
  732. });
  733. this.$message('提交审核成功');
  734. this.$emit('reload');
  735. this.cancel();
  736. },
  737. cancel() {
  738. this.$emit('update:processSubmitDialogFlag', false);
  739. },
  740. getDays(start, end) {
  741. const startDay = dayjs(start);
  742. const endDay = dayjs(end);
  743. const diffInMilliseconds = endDay.diff(startDay);
  744. // 计算天数
  745. const days = Math.floor(diffInMilliseconds / (1000 * 60 * 60 * 24));
  746. // 计算剩余小时数
  747. const hours = Math.floor(
  748. (diffInMilliseconds % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)
  749. );
  750. // 计算剩余分钟数
  751. const minutes = Math.floor(
  752. (diffInMilliseconds % (1000 * 60 * 60)) / (1000 * 60)
  753. );
  754. // 计算剩余秒数
  755. const seconds = Math.floor((diffInMilliseconds % (1000 * 60)) / 1000);
  756. let result = '';
  757. if (days > 0) result += `${days} 天 `;
  758. if (hours > 0) result += `${hours} 小时 `;
  759. if (minutes > 0) result += `${minutes} 分钟 `;
  760. if (seconds > 0) result += `${seconds} 秒`;
  761. return result.trim();
  762. }
  763. }
  764. };
  765. </script>
  766. <style scoped lang="scss">
  767. .box {
  768. display: flex;
  769. height: 450px;
  770. .left-box {
  771. width: 55%;
  772. border-right: 1px solid #e2e4e7;
  773. padding-right: 15px;
  774. height: 100%;
  775. .el-tree {
  776. height: 85%;
  777. overflow-y: auto;
  778. }
  779. }
  780. .right-box {
  781. flex: 1;
  782. padding-left: 20px;
  783. height: 100%;
  784. .right-box-item {
  785. margin-top: 5px;
  786. display: flex;
  787. justify-content: space-between;
  788. align-items: center;
  789. }
  790. }
  791. }
  792. .form-box {
  793. // max-height: 500px;
  794. min-width: 400px;
  795. overflow: auto;
  796. background: #4298fd0d;
  797. }
  798. ::v-deep .el-dialog {
  799. min-width: 400px;
  800. .el-dialog__header {
  801. background: #1890ffd6;
  802. }
  803. .el-dialog__title,
  804. .el-dialog__close {
  805. color: #ffffff;
  806. }
  807. }
  808. .blank_adopzrdd {
  809. display: flex;
  810. align-items: center;
  811. > span {
  812. display: inline-block;
  813. width: 80px;
  814. }
  815. margin-bottom: 10px;
  816. }
  817. </style>