processMange_line.vue 27 KB

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