processMange2.vue 25 KB

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