processMange.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837
  1. <template>
  2. <div class="process-mange-wrap">
  3. <!-- <el-card shadow="always" :body-style="{ padding: '20px' }"> -->
  4. <el-row>
  5. <el-col :xs="24" :md="8" :xl="8" class="col">
  6. <div class="statistic-wrap">
  7. <div class="discription">
  8. <span class="title">已完成</span>
  9. <span class="sub-title">已经完成的生产任务数</span>
  10. </div>
  11. <span class="data">{{ doneNum }}</span>
  12. </div>
  13. </el-col>
  14. <el-col :xs="24" :md="8" :xl="8" class="col">
  15. <div class="statistic-wrap">
  16. <div class="discription">
  17. <span class="title">进行中</span>
  18. <span class="sub-title">正在进行的生产任务数</span>
  19. </div>
  20. <span class="data">{{ doingNum }}</span>
  21. </div>
  22. </el-col>
  23. <!-- <el-col :xs="24" :md="8" :xl="8" class="col">
  24. <div class="statistic-wrap">
  25. <div class="discription">
  26. <span class="title">完成</span>
  27. <span class="sub-title">已经完成的管道</span>
  28. </div>
  29. <span class="data">0</span>
  30. </div>
  31. </el-col> -->
  32. </el-row>
  33. <!-- </el-card> -->
  34. <div class="main-area">
  35. <div class="show-header">
  36. <h3 class="header">流程列表</h3>
  37. <div class="search-list">
  38. <div class="search-tab">
  39. <el-radio-group v-model="taskType" v-show="false">
  40. <el-radio-button :label="1">我的处理</el-radio-button>
  41. <el-radio-button :label="2">其他处理</el-radio-button>
  42. </el-radio-group>
  43. <el-radio-group
  44. class="btn-list-two"
  45. v-model="queryParams.taskProcessState"
  46. @change="getList"
  47. >
  48. <el-radio-button label="3">已完成</el-radio-button>
  49. <el-radio-button label="0">进行中</el-radio-button>
  50. <!-- <el-radio-button label="">所有</el-radio-button> -->
  51. </el-radio-group>
  52. </div>
  53. <div class="search-input">
  54. <el-input
  55. placeholder="请输入..."
  56. v-model="queryString"
  57. @keyup.enter.native="getList"
  58. >
  59. <el-button
  60. slot="append"
  61. icon="el-icon-search"
  62. @click="getList"
  63. ></el-button>
  64. </el-input>
  65. </div>
  66. </div>
  67. </div>
  68. <div class="show-body">
  69. <!-- 流程任务列表 -->
  70. <el-table :data="tableData" v-loading="loading" border stripe>
  71. <el-table-column type="selection" width="55" align="center" />
  72. <el-table-column type="index" width="50" align="center" />
  73. <el-table-column
  74. v-for="col in newColumn"
  75. :prop="col.prop"
  76. :key="col.prop"
  77. :label="col.label"
  78. align="center"
  79. >
  80. <template slot-scope="scope">
  81. <span v-if="col.prop == 'benCreateTime'">{{
  82. scope.row.benCreateTime.replace("T", " ")
  83. }}</span>
  84. <span v-else-if="col.prop == 'bepTaskProcessType'">{{
  85. getDictLabel(scope.row.bepTaskProcessType, dict.type.bpm_type)
  86. }}</span>
  87. <span v-else-if="col.prop == 'benTaskNodeState'">{{
  88. scope.row.benTaskNodeState == "0" ? "未执行" : "已执行"
  89. }}</span>
  90. <span v-else-if="col.prop == 'bepTaskProcessState'">{{
  91. getDictLabel(
  92. scope.row.bepTaskProcessState,
  93. dict.type.task_process_state
  94. )
  95. }}</span>
  96. <span v-else>{{ scope.row[col.prop] }}</span>
  97. </template>
  98. </el-table-column>
  99. <el-table-column label="操作" align="center">
  100. <template slot-scope="scope">
  101. <div class="excute-wrap">
  102. <el-button
  103. type="warning"
  104. plain
  105. size="small"
  106. class="mr10 mb5"
  107. v-show="scope.row.bepTaskProcessState == '0'"
  108. @click="opneExecuteNode(scope.row)"
  109. >
  110. 运行
  111. </el-button>
  112. <el-dropdown>
  113. <el-button type="warning" plain size="small">
  114. 处理<i class="el-icon-arrow-down el-icon--right"></i>
  115. </el-button>
  116. <el-dropdown-menu
  117. v-if="
  118. scope.row.exceptionScriptList &&
  119. scope.row.exceptionScriptList.length
  120. "
  121. slot="dropdown"
  122. >
  123. <!-- <el-dropdown-item>
  124. <el-button
  125. size="mini"
  126. type="text"
  127. icon="el-icon-edit"
  128. @click="excuteHandler(scope.row)"
  129. v-hasPermi="['system:user:edit']"
  130. >处理
  131. </el-button>
  132. </el-dropdown-item> -->
  133. <el-dropdown-item>
  134. <el-dropdown size="mini">
  135. <el-button
  136. size="mini"
  137. type="text"
  138. icon="el-icon-d-arrow-right"
  139. >触发异常
  140. </el-button>
  141. <el-dropdown-menu slot="dropdown">
  142. <el-dropdown-item
  143. v-for="item in scope.row.exceptionScriptList"
  144. :key="item.id"
  145. >
  146. <el-button
  147. @click="exceptionTrigger(scope.row, item)"
  148. size="mini"
  149. type="text"
  150. >{{ item.scriptName }}
  151. </el-button>
  152. </el-dropdown-item>
  153. </el-dropdown-menu>
  154. </el-dropdown>
  155. </el-dropdown-item>
  156. </el-dropdown-menu>
  157. </el-dropdown>
  158. </div>
  159. </template>
  160. </el-table-column>
  161. </el-table>
  162. <!-- 分页 -->
  163. <pagination
  164. v-show="total > 0"
  165. :total="total"
  166. :page.sync="queryParams.pageNum"
  167. :limit.sync="queryParams.pageSize"
  168. @pagination="getList"
  169. />
  170. </div>
  171. <div class="show-window">
  172. <!-- 运行节点弹窗 -->
  173. <el-dialog :title="nodeTitle" :visible.sync="open">
  174. <!-- <el-form label-width="100px" :model="commonData">
  175. <h1>这里会引入当前节点需要处理的表单</h1>
  176. </el-form> -->
  177. <!-- <k-form-build
  178. v-if="formType == 'dragForm'"
  179. class="formBuild"
  180. ref="addFromRef"
  181. :dynamicData="dynamicData"
  182. :defaultValue="defaultValue"
  183. :value="jsonData"
  184. /> -->
  185. <component
  186. :is="myForm"
  187. :formData="formData"
  188. :row="row"
  189. ref="myFormRef"
  190. v-if="myForm"
  191. ></component>
  192. <!-- <Sorting ref="myFormRef" :formData="formData" :row="row"></Sorting> -->
  193. <!-- <PhysicalInspection
  194. :formData="formData"
  195. :row="row"
  196. ></PhysicalInspection> -->
  197. <span slot="footer" class="dialog-footer">
  198. <el-button @click="closeExecuteNode">取消</el-button>
  199. <el-button type="primary" @click="executeNode">确认运行</el-button>
  200. </span>
  201. </el-dialog>
  202. </div>
  203. </div>
  204. </div>
  205. </template>
  206. <script>
  207. import {
  208. processList,
  209. runProcessNodeExecution,
  210. getProcessNodeFormTemplate,
  211. getProcessNodeFormInfoData,
  212. } from "@/api/bpmprocess/run/executeProcess";
  213. import { triggerExceptionNode } from "@/api/bpmprocess/process";
  214. import getNodeSequence from "@/utils/bpmn/getNodeSequence";
  215. import GY02 from "./dialogCompments/GongYi/GY02.vue";
  216. import ZL01 from "./dialogCompments/ZhiLiang/ZL1.vue";
  217. import { getForm } from "@/api/dragform/form";
  218. import DialogTemplate from "@/views/dialogTemplate/components/index.vue";
  219. // 弹窗表单组件
  220. import GY01 from "./dialogCompments/GongYi/GY01.vue";
  221. import GY03 from "./dialogCompments/GongYi/GY03.vue";
  222. import CG1 from "./dialogCompments/test-component/CaiGou/CG1.vue";
  223. import CG02 from "./dialogCompments/test-component/CaiGou/CG02.vue";
  224. import KC01 from "./dialogCompments/test-component/KuCun/KC1.vue";
  225. import KC02 from "./dialogCompments/test-component/KuCun/KC02.vue";
  226. import GY06 from "./dialogCompments/GongYi/GY06.vue";
  227. import KB01 from "./dialogCompments/KongBai/KB01.vue"; //空白提示组件
  228. import SC01 from "./dialogCompments/ShengChan/SC01.vue";
  229. import Loading from "./dialogCompments/Edu/Loading.vue";
  230. import Processing from "./dialogCompments/Edu/Processing.vue";
  231. import Assemble from "./dialogCompments/Edu/Assemble.vue";
  232. import Detection from "./dialogCompments/Edu/Detection.vue";
  233. import WareHousing from "./dialogCompments/Edu/WareHousing.vue";
  234. //Mec组件
  235. import AssignEmployees from "./dialogCompments/Mec/AssignEmployees.vue";
  236. import Notes from "./dialogCompments/Mec/Notes.vue";
  237. import Print from "./dialogCompments/Mec/Print.vue";
  238. import NodeShow from "./dialogCompments/Mec/NodeShow.vue";
  239. import RecordQuality from "./dialogCompments/Mec/RecordQuality.vue";
  240. import ProductionProcesses from "./dialogCompments/Mec/ProductionProcesses.vue";
  241. import PersonalDistribution from "./dialogCompments/Mec/PersonalDistribution.vue";
  242. import RecordSplitData from "./dialogCompments/Mec/RecordSplitData.vue";
  243. import EditFinishTime from "./dialogCompments/Mec/EditFinishTime.vue";
  244. import EditQualityCard from "./dialogCompments/Mec/EditQualityCard.vue";
  245. import FinishTask from "./dialogCompments/Mec/FinishTask.vue";
  246. import QualityControlCardSubCardProcessing from "./dialogCompments/Mec/QualityControlCardSubCardProcessing.vue";
  247. import ScrapDisposition from "./dialogCompments/Mec/ScrapDisposition.vue";
  248. import QRCode from "./dialogCompments/Mec/QRCode.vue";
  249. import Inspect from "./dialogCompments/GongYi/Inspect.vue";
  250. // 物理指标
  251. import PhysicalInspection from "./dialogCompments/GongYi/PhysicalInspection.vue";
  252. // 外观指标
  253. import AppearanceInspection from "./dialogCompments/GongYi/AppearanceInspection.vue";
  254. //
  255. import Sorting from "./dialogCompments/GongYi/Sorting.vue";
  256. import UpSilk from "./dialogCompments/GongYi/UpSilk.vue";
  257. export default {
  258. name: "processMange",
  259. props: [],
  260. components: {
  261. GY01,
  262. DialogTemplate,
  263. CG1,
  264. CG02,
  265. KC01,
  266. GY06,
  267. GY03,
  268. KC02,
  269. GY02,
  270. KB01,
  271. SC01,
  272. ZL01,
  273. NodeShow,
  274. AssignEmployees,
  275. Notes,
  276. Print,
  277. RecordQuality,
  278. ProductionProcesses,
  279. PersonalDistribution,
  280. RecordSplitData,
  281. EditFinishTime,
  282. EditQualityCard,
  283. FinishTask,
  284. QualityControlCardSubCardProcessing,
  285. ScrapDisposition,
  286. QRCode,
  287. Inspect,
  288. Loading,
  289. Processing,
  290. Assemble,
  291. Detection,
  292. WareHousing,
  293. PhysicalInspection,
  294. AppearanceInspection,
  295. Sorting, //分拣
  296. UpSilk, //上丝
  297. },
  298. dicts: ["bpm_type", "task_process_state"],
  299. data() {
  300. return {
  301. doneNum: 0, //已完成数
  302. doingNum: 0, //进行中数
  303. row: {}, //当前操作行数据
  304. myForm: "", //自定义表单组件名
  305. // 节点弹窗title
  306. nodeTitle: "节点弹窗",
  307. open: false,
  308. // 节点弹窗对应的formData
  309. commonData: {},
  310. taskType: 1,
  311. queryString: "",
  312. taskStatus: "",
  313. tableData: [], //表格数据
  314. // 查询参数
  315. queryParams: {
  316. pageNum: 1,
  317. pageSize: 10,
  318. taskProcessState: "0",
  319. taskProcessType: 0,
  320. },
  321. total: 0,
  322. columns: [
  323. {
  324. prop: "bepTaskKey",
  325. label: "任务编号",
  326. },
  327. {
  328. prop: "bepTaskName",
  329. label: "任务名称",
  330. },
  331. // {
  332. // prop: "bepTaskProcessType",
  333. // label: "任务流程类型",
  334. // },
  335. {
  336. prop: "bepTaskProcessState",
  337. label: "任务流程状态",
  338. },
  339. {
  340. prop: "benTaskNodeName",
  341. label: "节点名称",
  342. },
  343. {
  344. prop: "benTaskNodeType",
  345. label: "节点类型",
  346. },
  347. {
  348. prop: "benTaskNodeState",
  349. label: "节点状态",
  350. },
  351. {
  352. prop: "benCreateBy",
  353. label: "创建人",
  354. },
  355. {
  356. prop: "benCreateTime",
  357. label: "创建时间",
  358. },
  359. ],
  360. formType: "", //表单类型 dragForm:拖拽表单 composeForm:工艺组合表单 designForm:定制表单
  361. // k-form-build 数据
  362. dynamicData: {},
  363. tableName: "",
  364. defaultValue: {},
  365. jsonData: {},
  366. // 拖拽数据
  367. taskInfo: {},
  368. groupKey: "",
  369. subCount: {},
  370. tableCount: {},
  371. subTableName: "",
  372. // 弹窗表单渲染数据
  373. formData: {},
  374. backExceptionTaskList: ["GY06"], //特殊回退表单组件列表
  375. loading: true,
  376. };
  377. },
  378. computed: {
  379. newColumn() {
  380. if (this.queryParams.taskProcessState == "3") {
  381. return [
  382. {
  383. prop: "bepTaskKey",
  384. label: "任务编号",
  385. },
  386. {
  387. prop: "bepTaskName",
  388. label: "任务名称",
  389. },
  390. // {
  391. // prop: "bepTaskProcessType",
  392. // label: "任务流程类型",
  393. // },
  394. {
  395. prop: "bepTaskProcessState",
  396. label: "任务流程状态",
  397. },
  398. {
  399. prop: "benCreateBy",
  400. label: "创建人",
  401. },
  402. {
  403. prop: "benCreateTime",
  404. label: "创建时间",
  405. },
  406. ];
  407. } else {
  408. return this.columns;
  409. }
  410. },
  411. },
  412. mounted() {
  413. this.getList();
  414. this.getDoneNumber();
  415. this.getDoingNumber();
  416. },
  417. methods: {
  418. // 获取列表数据
  419. getList() {
  420. this.loading = true;
  421. processList({ ...this.queryParams, taskName: this.queryString })
  422. .then((res) => {
  423. if (res.code == 200) {
  424. this.tableData = res.rows.map((item) => item.resultMap);
  425. this.total = res.total;
  426. console.log(this.tableData);
  427. } else {
  428. this.$message.error("网络异常,请稍后再试");
  429. }
  430. this.loading = false;
  431. })
  432. .finally((e) => {
  433. console.log(e);
  434. this.loading = false;
  435. });
  436. },
  437. getDoneNumber() {
  438. let params = {
  439. pageNum: 1,
  440. pageSize: 10,
  441. taskProcessState: "3",
  442. taskProcessType: 0,
  443. };
  444. processList(params)
  445. .then((res) => {
  446. if (res.code == 200) {
  447. this.doneNum = res.total;
  448. } else {
  449. this.$message.error("网络异常,请稍后再试");
  450. }
  451. })
  452. .finally((e) => {
  453. console.log(e);
  454. this.loading = false;
  455. });
  456. },
  457. getDoingNumber() {
  458. let params = {
  459. pageNum: 1,
  460. pageSize: 10,
  461. taskProcessState: "0",
  462. taskProcessType: 0,
  463. };
  464. processList(params)
  465. .then((res) => {
  466. if (res.code == 200) {
  467. this.doingNum = res.total;
  468. } else {
  469. this.$message.error("网络异常,请稍后再试");
  470. }
  471. })
  472. .finally((e) => {
  473. console.log(e);
  474. this.loading = false;
  475. });
  476. },
  477. // 获取表单数据
  478. async getFormData() {
  479. let formData = {};
  480. // switch (this.formType) {
  481. // case "dragForm":
  482. // try {
  483. // formData = await this.$refs.addFromRef.getData();
  484. // } catch (error) {
  485. // console.log(error);
  486. // this.$message.error("表单校验异常,请稍后重试");
  487. // return {};
  488. // }
  489. // break;
  490. // case "designForm":
  491. // let temp = await this.$refs.myFormRef.getFormData();
  492. // if (!temp.flag) {
  493. // this.$message.error(temp.msg);
  494. // return {};
  495. // } else {
  496. // formData = temp.data;
  497. // }
  498. // break;
  499. // default:
  500. // break;
  501. // }
  502. let temp = await this.$refs.myFormRef?.getFormData();
  503. console.log("temp", temp);
  504. if (!temp?.flag) {
  505. if (!temp) {
  506. //没有表单
  507. // formData.flag = true;
  508. } else {
  509. //表单数据不合法
  510. this.$message.error(temp.msg);
  511. return false;
  512. }
  513. } else {
  514. formData = temp.data;
  515. }
  516. return formData;
  517. },
  518. // 重置弹窗数据
  519. resetDialogForm() {
  520. this.formType = ""; //表单类型 dragForm:拖拽表单 composeForm:工艺组合表单 designForm:定制表单
  521. // k-form-build 数据
  522. this.dynamicData = {};
  523. this.defaultValue = {};
  524. this.jsonData = {};
  525. },
  526. // 打开运行节点弹窗
  527. async opneExecuteNode(row) {
  528. this.resetDialogForm();
  529. console.log(row);
  530. this.nodeTitle = row.benTaskNodeName;
  531. // let preFix = row.benTaskNodeName.split("-")[0];
  532. let preFix = row.benTaskNodeFormKey;
  533. let {
  534. benTaskNodeFormKey,
  535. benTaskNodeFormType,
  536. bepTaskPlanKey,
  537. bepTaskKey,
  538. bepTaskNodeKey,
  539. benTaskProcessKey,
  540. benmTaskAutomaticScriptTriggerType,
  541. bepTaskNodeNextKey,
  542. } = row;
  543. // 新的运行逻辑
  544. let payLoad = {
  545. taskNodeKey: bepTaskNodeNextKey,
  546. taskProcessKey: benTaskProcessKey,
  547. taskAutomaticScriptTriggerType: benmTaskAutomaticScriptTriggerType,
  548. taskPlanKey: bepTaskPlanKey,
  549. };
  550. // let formData = await getProcessNodeFormTemplate(payLoad);
  551. // console.log(formData);
  552. // if (benTaskNodeFormKey) {
  553. // if (benTaskNodeFormType == "dragForm") {
  554. // let templateInfo = formData.data[0]?.template;
  555. // //拖拽表单
  556. // this.formType = "dragForm";
  557. // this.jsonData = JSON.parse(templateInfo.dfVueTemplate);
  558. // this.tableName = templateInfo.dfTableName;
  559. // if (Object.keys(JSON.parse(templateInfo.dfFormSql)).length) {
  560. // this.dynamicData = JSON.parse(templateInfo.dfFormSql);
  561. // }
  562. // // await this.getDragFormInfo(benTaskNodeFormKey);
  563. // } else if (benTaskNodeFormType == "composeForm") {
  564. // //工艺组合表单
  565. // this.formType = "composeForm";
  566. // this.groupKey = benTaskNodeFormKey;
  567. // let queryPayload = {
  568. // row,
  569. // groupKey: benTaskNodeFormKey,
  570. // };
  571. // this.$nextTick(() => {
  572. // this.$refs.dialogRef.getLists(queryPayload);
  573. // });
  574. // }
  575. // } else if (preFix) {
  576. // //定制表单
  577. // this.formType = "designForm";
  578. // this.myForm = preFix;
  579. // }
  580. //定制表单
  581. this.formType = "designForm";
  582. this.myForm = preFix;
  583. let res = await getProcessNodeFormInfoData(payLoad);
  584. if (res.code == 200) {
  585. this.formData = res.data;
  586. } else {
  587. this.$message.error("网络异常,请稍后再试");
  588. }
  589. this.row = row; //记录当前行数据
  590. // if (!this.formType) return; //没有表单,直接掉运行逻辑
  591. this.open = true; // 打开弹窗
  592. this.$nextTick(() => {
  593. // this.$refs.myFormRef?.resetForm();
  594. });
  595. // 根据当前节点绑定的表单信息查询对应的表单进行展示
  596. },
  597. // 运行节点按钮 确认运行回调
  598. async executeNode() {
  599. let { benTaskNodeKey, bepTaskProcessXmlContent, implementationName } =
  600. this.row;
  601. let { nodeId, nextNodeId } = this.getNextNodeKey(
  602. benTaskNodeKey,
  603. bepTaskProcessXmlContent
  604. );
  605. // 只有完成状态的可以运行
  606. if (this.formType == "composeForm") {
  607. let res = this.$refs.dialogRef.getComposeFormData();
  608. if (!res.isSuccess) {
  609. this.$message.warning("非完成状态节点不能运行!");
  610. return;
  611. }
  612. }
  613. // return;
  614. let formData = await this.getFormData();
  615. if (!formData) return;
  616. formData.taskPlanKey = this.row.bepTaskPlanKey;
  617. let payLoad = {
  618. taskProcessKey: this.row.bepTaskKey, //当前任务流程编码
  619. taskNodeKey: nodeId, //当前执行节点唯一编码
  620. nextNodeKey: nextNodeId, //下一节点编码
  621. implementationName: this.row.benmTaskAutomaticScriptTriggerType, //当前节点绑定的脚本名
  622. // taskProcessXmlContent: this.row.bepTaskProcessXmlContent, //当前流程xml
  623. tableName: this.tableName,
  624. formDataMapString: JSON.stringify(formData), //自定义表单组件收集的表单数据
  625. taskNodeType: this.backExceptionTaskList.includes(
  626. this.row.benTaskNodeFormKey
  627. )
  628. ? "backExceptionTask"
  629. : this.row.benTaskNodeType,
  630. };
  631. let fileXML = new File(
  632. [this.row.bepTaskProcessXmlContent],
  633. this.row.bepTaskKey + ".bpmn",
  634. {
  635. type: "text/bpmn",
  636. }
  637. );
  638. const subformData = new FormData();
  639. subformData.append("fileXML", fileXML);
  640. for (let key in payLoad) {
  641. subformData.append(key, payLoad[key] == null ? "" : payLoad[key]);
  642. }
  643. runProcessNodeExecution(subformData).then((res) => {
  644. if (res.code == 200) {
  645. this.$message.success("运行成功!");
  646. this.getList();
  647. this.getDoneNumber();
  648. this.getDoingNumber();
  649. this.open = false;
  650. }
  651. });
  652. },
  653. // 获取拖拽表单数据
  654. async getDragFormInfo(fid) {
  655. try {
  656. let res = await getForm(fid);
  657. console.log(res);
  658. if (res.code == 200) {
  659. this.jsonData = JSON.parse(res.data.dfVueTemplate);
  660. this.tableName = res.data.dfTableName;
  661. if (res.data.dfFormSql) {
  662. this.dynamicData = JSON.parse(res.data.dfFormSql);
  663. console.log(this.dynamicData);
  664. }
  665. } else {
  666. console.log(res);
  667. throw new Error(res);
  668. }
  669. } catch (error) {
  670. console.log(error);
  671. this.$message.error("网络异常,请稍后再试");
  672. }
  673. },
  674. // 关闭运行节点弹窗
  675. closeExecuteNode(row) {
  676. this.open = false;
  677. },
  678. // 获取下一个节点的nodekey
  679. getNextNodeKey(nodeKey, xmlStr) {
  680. let xmlObj = this.xmlStr2XmlObj(xmlStr);
  681. let nodeSequence = getNodeSequence(xmlObj);
  682. return nodeSequence.find((item) => item.nodeId == nodeKey) || {};
  683. },
  684. // xml字符串转xml对象
  685. xmlStr2XmlObj(xmlStr) {
  686. var xmlObj = {};
  687. if (document.all) {
  688. var xmlDom = new ActiveXObject("Microsoft.XMLDOM");
  689. xmlDom.loadXML(xmlStr);
  690. xmlObj = xmlDom;
  691. } else {
  692. xmlObj = new DOMParser().parseFromString(xmlStr, "text/xml");
  693. }
  694. return xmlObj;
  695. },
  696. // 触发异常回调
  697. exceptionTrigger(row, scriptData) {
  698. // console.log(taskNodeType);
  699. let _this = this;
  700. this.$modal
  701. .confirm("是否确认触发<" + scriptData.scriptName + ">异常?")
  702. .then(function (val) {
  703. console.log(val);
  704. // 发送触发异常节点的请求
  705. let payLoad = {
  706. taskProcessKey: row.bepTaskKey,
  707. taskNodeKey: row.benTaskNodeKey,
  708. sysBpmNodeScriptVO: scriptData,
  709. taskNodeType: row.benTaskNodeType,
  710. };
  711. // 异常节点抛异常 需要下一个节点key
  712. if (row.benTaskNodeType == "exceptionTask") {
  713. let { nodeId, nextNodeId } = _this.getNextNodeKey(
  714. row.benTaskNodeKey,
  715. row.bepTaskProcessXmlContent
  716. );
  717. payLoad.taskNextNodeKey = nextNodeId;
  718. }
  719. triggerExceptionNode(payLoad).then((res) => {
  720. console.log(res);
  721. if (res.code == 200) {
  722. _this.$message.success("触发成功");
  723. _this.open = false;
  724. _this.getList();
  725. } else {
  726. _this.$message.error("触发失败请稍后再试");
  727. }
  728. });
  729. })
  730. .catch((err) => {
  731. console.log(err);
  732. _this.open = false;
  733. _this.$message.info("取消成功");
  734. });
  735. },
  736. // 获取字典对应label
  737. getDictLabel(value, dictLsit = []) {
  738. return dictLsit.find((item) => {
  739. return item.value == value;
  740. })?.label;
  741. },
  742. },
  743. };
  744. </script>
  745. <style scoped lang="scss">
  746. .process-mange-wrap {
  747. background-color: #f2f3f8;
  748. padding: 20px;
  749. .col {
  750. background-color: #fff;
  751. border-right: 1px solid #ebedf2;
  752. /* margin-right: 3px; */
  753. .statistic-wrap {
  754. /* // height: 70px; */
  755. box-sizing: border-box;
  756. display: flex;
  757. align-items: center;
  758. padding: 10px 17px;
  759. justify-content: space-between;
  760. .discription {
  761. display: flex;
  762. flex-direction: column;
  763. .title {
  764. line-height: 20px;
  765. font-size: 18px;
  766. font-weight: 700;
  767. margin-bottom: 5px;
  768. }
  769. .sub-title {
  770. font-size: 14px;
  771. }
  772. }
  773. .data {
  774. font-size: 20px;
  775. font-weight: 700;
  776. }
  777. }
  778. }
  779. .main-area {
  780. margin-top: 30px;
  781. box-shadow: 0 1px 15px 1px rgb(69 65 78 / 8%);
  782. background-color: #fff;
  783. .show-header {
  784. border-bottom: 1px solid #ebedf2;
  785. display: flex;
  786. align-items: center;
  787. justify-content: space-between;
  788. padding: 0px 20px 0px 20px;
  789. height: 70px;
  790. /* .header {
  791. } */
  792. .search-list {
  793. display: flex;
  794. .search-tab {
  795. margin-right: 20px;
  796. .btn-list-two {
  797. margin-left: 10px;
  798. }
  799. }
  800. }
  801. }
  802. .show-body {
  803. padding: 25px;
  804. }
  805. }
  806. }
  807. </style>