processMange - 副本.vue 26 KB

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