sasp-flow-render 1.1.23 → 1.1.25-decoupling

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2269 @@
1
+ // utils/workflow.js
2
+
3
+ import {AjaxUtil} from "sasp-base";
4
+
5
+ /**
6
+ * 工作流引擎类
7
+ * 支持多步骤、异步操作、自定义弹窗内容、错误处理
8
+ */
9
+ class WorkflowEngine {
10
+ initParams(component,flowAttrs = {}){
11
+ this.$this = component; // required
12
+ if(!this.$this){
13
+ console.error("初始化失败,component不能为空");
14
+ return;
15
+ }
16
+ this.flowId = flowAttrs.flowId; // required
17
+ this.tableviewId = flowAttrs.tableviewId; // 外部调用时初始化必须
18
+ this.formGloabalInfo = (this.$this.formGloabalInfo || {});
19
+ this.flowParams = {};
20
+ this.formComponent = this.formGloabalInfo.formComponent;
21
+ this.dataId = "";
22
+ this.formId = "";
23
+ this.currentInst = {};
24
+ this.installListObj = this.$this.EVENT_PLUGIN['installEventObj']||{}; //已经安装的流程事件
25
+ this.loginUser = this.$this.FLOW_CACHE_GLOBAL.getLoginUser();
26
+ this.skipAutoInit = false;
27
+ if(flowAttrs.skipAutoInit){
28
+ this.skipAutoInit = flowAttrs.skipAutoInit;
29
+ }
30
+ this.formInfo = {
31
+ dataId: this.dataId,
32
+ opt: "view",
33
+ }
34
+ this.$flowDialog = this.$this.$flowDialog;
35
+ this.flowDefine = {};
36
+ this.flowRecordObj = {};
37
+ this.flowChartObj = {};
38
+
39
+ // 初始化插入部分方法
40
+ let methods = flowAttrs["methods"] || {};
41
+ this.initTabNum = methods["initTabNum"];
42
+ this.tabCrudSearch = methods["tabCrudSearch"];
43
+ this.batchTabRemove = methods["batchTabRemove"];
44
+ this.setFlowTabInfo = methods["setFlowTabInfo"];
45
+ this.getFlowBatchDialog = methods["getFlowBatchDialog"];
46
+ this.closeFlowBatchDialog = methods["closeFlowBatchDialog"];
47
+ this.initFormInfo = methods["initFormInfo"];
48
+ this.saveFormInfo = methods["saveFormInfo"];
49
+ this.getFormInfo = methods["getFormInfo"];
50
+ this.flowNextOperation = methods["flowNextOperation"];
51
+ this.forceUpdateComponent = methods["forceUpdateComponent"];
52
+ this.nextStepAfterSave = methods["nextStepAfterSave"];
53
+ this.setParams = methods["setParams"];
54
+
55
+ if(!this.initFormInfo){
56
+ this.initFormInfo = this.$flowDialog.initFormInfo;
57
+ }
58
+
59
+ if(!this.saveFormInfo){
60
+ this.saveFormInfo = this.$flowDialog.saveFormInfo;
61
+ }
62
+
63
+ if(!this.getFormInfo){
64
+ this.getFormInfo = this.$flowDialog.getFormInfo;
65
+ }
66
+
67
+ // 流程的参数
68
+ this.flowInstDataDialog = false;
69
+ this.nextSteptUserDialog = false;
70
+ this.doMainDatasObj = {};
71
+ this.userMap = {};
72
+ this.userArr = [];
73
+ this.tabActive = "draft";
74
+ this.flowDefineByFlowId = {};
75
+ this.startNodeKey = "";
76
+ this.startNodeKeyObj = {};
77
+ this.allNodeInfo = {};
78
+ this.flowNodeIdToInfo = {};
79
+ this.flowNodeNameObj = {};
80
+ this.nodeListButtonObj = {};
81
+ this.listButtonObj = { // 列表按钮
82
+ add: "新增",
83
+ delete: "删除",
84
+ update: "修改",
85
+ view: "查看",
86
+ deal: "处理",
87
+ flowRecord: "流转记录",
88
+ flowChart: "流程图",
89
+ };
90
+ this.diyButtonsObj= {};
91
+ this.optColumnWidth = 336;
92
+ this.nodeFormButtonObj = {};
93
+ this.nodeFormBtnObj = {};
94
+ this.startNodeKeyObjByFlowId = {};
95
+ this.flowVersionNodeObj = {}; //版本号对应的节点对象
96
+ this.flowVersionNodeObjByFlowId = {};
97
+ this.flowEventScriptByFlowId = {};
98
+ this.operateType= {};
99
+
100
+ this.nextNode = {};
101
+ this.description = "";
102
+ this.saveInstId = "";
103
+ this.nowNode = {};
104
+ this.isProceedNext = false;
105
+ this.nextNodeName = "";
106
+ this.choosePosUserIds = "";
107
+ this.choosePosUserIdsObj = {};
108
+ this.chooseNextUserIdObj = {};
109
+ this.chooseNextUserNameObj = {};
110
+ this.chooseNextUserId = "";
111
+ this.chooseNextUserName = "";
112
+ this.nextSteptUserArr = [];
113
+
114
+ this.newEventObj = {};
115
+ this.newScriptObj = {};
116
+ this.scriptObj = {};
117
+ this.resourceTabOpts = ['draft','pending','processed','rescinded','finished','discontinue','flowQuery'];
118
+ //表单按钮
119
+ this.formButtonObj = {
120
+ saveDraft: "存草稿",
121
+ completeSign: "加签",
122
+ turnSign: "转签",
123
+ nextStep: "下一步",
124
+ back: "退回",
125
+ getBack: "取回",
126
+ cancel: "撤销",
127
+ stopped: "中止",
128
+ close: "关闭",
129
+ export: "导出",
130
+ retSpecified: "退回指定节点"
131
+ }
132
+
133
+ this.flowParams = {};
134
+ this.isDisabled = {
135
+ update: true,
136
+ deal: true,
137
+ flowRecord: true,
138
+ flowChart: true,
139
+ view: true,
140
+ saveDraft: true,
141
+ completeSign: true,
142
+ turnSign: true,
143
+ nextStep: true,
144
+ back: true,
145
+ cancel: true,
146
+ stopped: true,
147
+ close: true,
148
+ export: true,
149
+ retSpecified: true,
150
+ getBack: true,
151
+ record: true,
152
+ restore: true,
153
+ };
154
+
155
+ this.formBtnObjDefault = {
156
+ saveDraft: {
157
+ text: "存草稿",
158
+ type: "success",
159
+ icon: "el-icon-check",
160
+ disabled: false,
161
+ show: true,
162
+ method: () => {
163
+ this.saveDraft();
164
+ }
165
+ },
166
+
167
+ nextStep: {
168
+ text: "下一步",
169
+ type: "primary",
170
+ icon: "el-icon-d-arrow-right",
171
+ disabled: false,
172
+ show: true,
173
+ method: () => {
174
+ this.nextStep();
175
+ // this.isDisabled1 = true;
176
+ this.$flowDialog.fillFlowDialogParams({
177
+ isDisabled1: true
178
+ });
179
+ }
180
+ },
181
+
182
+ completeSign: {
183
+ text: "加签",
184
+ type: "primary",
185
+ icon: "saspiconfont pl-icon-jiaqian",
186
+ disabled: false,
187
+ show: false,
188
+ method: () => {
189
+ // this.completeSignDialog = true; // todo加签
190
+ this.$flowDialog.operateDialog('completeSignDialog',true);
191
+ }
192
+ },
193
+
194
+ turnSign: {
195
+ text: "转签",
196
+ type: "primary",
197
+ icon: "saspiconfont pl-icon-zhuanqian-icon",
198
+ disabled: false,
199
+ show: false,
200
+ method: () => {
201
+ // this.turnSignDialog = true; // todo转签
202
+ this.$flowDialog.operateDialog('turnSignDialog',true);
203
+ }
204
+ },
205
+
206
+ back: {
207
+ text: "退回",
208
+ type: "danger",
209
+ icon: "el-icon-d-arrow-left",
210
+ disabled: false,
211
+ show: false,
212
+ method: () => {
213
+ this.backToPrevious(this.currentInst);
214
+ }
215
+ },
216
+
217
+ retSpecified: {
218
+ text: "退回指定节点",
219
+ type: "danger",
220
+ icon: "el-icon-refresh-left",
221
+ disabled: false,
222
+ show: false,
223
+ method: () => {
224
+ this.retSpecified(this.currentInst); //退回指定节点
225
+ }
226
+ },
227
+
228
+ stopped: {
229
+ text: "中止",
230
+ type: "danger",
231
+ icon: "saspiconfont pl-icon-yizhongzhi",
232
+ disabled: false,
233
+ show: false,
234
+ method: () => {
235
+ this.$this.saspFlowAxios.post(this.$this.api.plFlowInst.stopFlow, {
236
+ instId: this.currentInst.flowInstId, type: "0",
237
+ procInstId: this.currentInst.linkProcId,
238
+ taskId: this.currentInst.taskId
239
+ }).then(res => {
240
+ if (res && res.data) {
241
+ if (res.data.operateSuccess) {
242
+ this.$this.$message({type: "success", message: "中止成功!"});
243
+ if (this.getFlowBatchDialog && this.getFlowBatchDialog()) {
244
+ this.batchTabRemove(this.currentInst.dataId);
245
+ } else {
246
+ this.tabCrudSearch && this.tabCrudSearch();
247
+ this.flowInstDataDialog = false;
248
+ this.$flowDialog.operateDialog('flowInstDataDialog',false);
249
+ }
250
+ this.initTabNum && this.initTabNum();
251
+
252
+ let remindParam = {
253
+ instId:this.currentInst.flowInstId,
254
+ flowId:this.flowDefine.id,
255
+ flowName:this.flowDefine.flowName,
256
+ // formId:this.formInfo.formId,
257
+ // listViewId:this.formInfo.listViewId,
258
+ dataId:this.formInfo.dataId,
259
+ instType:"stopped"
260
+ };
261
+ this.$this.saspFlowAxios.post(this.$this.api.plFlowInst.saveRemind,remindParam);
262
+
263
+ //执行事件规则
264
+ let currentNodeObj = this.flowNodeIdToInfo[this.currentInst.currentNode] ||{};
265
+ if(currentNodeObj.openEvent == '1'){
266
+ this.exeNewFlowEvent("suspend",currentNodeObj.nodeLinkId||'');
267
+ }
268
+ } else {
269
+ this.$this.$message({type: "error", message: res.data.operateMessage});
270
+ }
271
+ }
272
+ });
273
+ }
274
+ },
275
+
276
+ cancel: {
277
+ text: "撤销",
278
+ type: "danger",
279
+ icon: "saspiconfont pl-icon-chexiao",
280
+ disabled: false,
281
+ show: false,
282
+ isView: true,
283
+ method: () => {
284
+ this.$this.saspFlowAxios.post(this.$this.api.plFlowInst.revokeFlow, {
285
+ instId: this.currentInst.flowInstId,
286
+ taskId: this.currentInst.taskId
287
+ }).then(res => {
288
+ if (res && res.data) {
289
+ if (res.data.operateSuccess) {
290
+ this.$this.$message({type: "success", message: "撤销成功!"});
291
+ this.tabCrudSearch && this.tabCrudSearch();
292
+ this.flowInstDataDialog = false;
293
+ this.$flowDialog.operateDialog('flowInstDataDialog',false);
294
+ this.initTabNum && this.initTabNum();
295
+
296
+ let remindParam = {
297
+ instId:this.currentInst.flowInstId,
298
+ flowId:this.flowDefine.id,
299
+ flowName:this.flowDefine.flowName,
300
+ // formId:this.formInfo.formId,
301
+ // listViewId:this.formInfo.listViewId,
302
+ dataId:this.formInfo.dataId,
303
+ instType:"cancel"
304
+ };
305
+ this.$this.saspFlowAxios.post(this.$this.api.plFlowInst.saveRemind,remindParam);
306
+
307
+
308
+ } else {
309
+ this.$this.$message({type: "error", message: res.data.operateMessage});
310
+ }
311
+ }
312
+ });
313
+ }
314
+ },
315
+
316
+ getBack: {
317
+ text: "取回",
318
+ type: "danger",
319
+ icon: "el-icon-refresh-left",
320
+ disabled: false,
321
+ show: false,
322
+ isView: true,
323
+ method: () => {
324
+ this.getBackPrevious();
325
+ }
326
+ },
327
+
328
+ restore: {
329
+ text: "恢复",
330
+ type: "success",
331
+ icon: "saspiconfont pl-icon-chexiao",
332
+ disabled: false,
333
+ show: false,
334
+ isView: true,
335
+ method: () => {
336
+ this.restoreFlow();
337
+ }
338
+ },
339
+ record: {
340
+ text: "流转记录",
341
+ type: "warning",
342
+ icon: "saspiconfont pl-icon-liuchengtu",
343
+ disabled: false,
344
+ show: true,
345
+ isView: true,
346
+ method: () => {
347
+ this.openFlowRecord(this.currentInst);
348
+ }
349
+ },
350
+ close: {
351
+ text: "关闭",
352
+ type: "",
353
+ icon: "el-icon-close",
354
+ disabled: false,
355
+ show: true,
356
+ isView: true,
357
+ method: () => {
358
+ this.flowInstDataDialog = false;
359
+ this.$flowDialog.operateDialog('flowInstDataDialog',false);
360
+ this.closeFlowBatchDialog && this.closeFlowBatchDialog();
361
+ }
362
+ },
363
+ }
364
+ this.loadSuccess = false;
365
+ }
366
+
367
+ constructor(component,flowAttrs = {}) {
368
+ // 工作流配置
369
+ this.initParams(component,flowAttrs);
370
+ }
371
+
372
+ init(){
373
+ return new Promise(resolve => {
374
+ if(!this.skipAutoInit && !this.loadSuccess){
375
+ this.$this.saspFlowAxios.all([
376
+ this.initFlowInfo(),
377
+ this.initFlowFormInfo()
378
+ ]).then(this.$this.saspFlowAxios.spread((resFlow, resForm) => {
379
+ this.loadSuccess = true;
380
+ resolve();
381
+ }));
382
+ }else{
383
+ resolve();
384
+ }
385
+ this.initUserData();
386
+ this.initDialogProps();
387
+ })
388
+ }
389
+
390
+ initFlowFormInfo(){
391
+ return new Promise(resolve => {
392
+ if(!this.$this.FORM_GLOBAL){
393
+ this.$this.$message.error("未安装表单组件,请使用自定义表单开发");
394
+ return;
395
+ }
396
+ this.$this.FORM_GLOBAL.getTableViews(this.tableviewId).then(tableviewsData => {
397
+ if(!tableviewsData || !tableviewsData.id){
398
+ this.$message.error("表单资源不存在!");
399
+ return;
400
+ }
401
+ this.formId = tableviewsData.formId;
402
+ this.$flowDialog.fillFlowDialogParams({
403
+ formId: this.formId,
404
+ tableviewId: this.tableviewId,
405
+ dataId: this.dataId
406
+ });
407
+ resolve();
408
+ });
409
+ });
410
+ }
411
+
412
+ initDialogProps() {
413
+ let dialogProps = {
414
+ flowNextOperation: this.flowNextOperation,
415
+ workFlowUtil: this
416
+ }
417
+ this.$flowDialog.initDialogProps(dialogProps);
418
+ }
419
+
420
+ // 初始化流程相关信息
421
+ initFlowInfo() {
422
+ return new Promise(resolve => {
423
+ if (this.flowId.includes(",")) {
424
+ this.getMultiFlowInfo().then(() => {
425
+ resolve();
426
+ })
427
+ } else {
428
+ this.getFlowInfo().then(() => {
429
+ resolve();
430
+ });
431
+ }
432
+ });
433
+ }
434
+
435
+ /**
436
+ * 多流程初始化
437
+ */
438
+ getMultiFlowInfo() {
439
+ return new Promise(resolve => {
440
+ let flowIdArr = this.flowId.split(",").filter(item => item);
441
+ flowIdArr.forEach(flowId => {
442
+ this.$this.FLOW_GLOBAL.getFlowDefineById(flowId).then(flowDefine => {
443
+ this.flowDefineByFlowId[flowId] = flowDefine;
444
+ });
445
+ });
446
+
447
+ const initFlowNodeFunc = flowIdArr.map(flowId => (() => this.$this.FLOW_GLOBAL.getFlowNodesByFlowId(flowId)));
448
+ Promise.all(initFlowNodeFunc.map(func => func())).then(allFlowNodeArr => {
449
+ //工作流节点
450
+ this.startNodeKey = "Activity_draft"; // todo 确定startNodeKey的位置
451
+ for (const allFlowNode of allFlowNodeArr) {
452
+ this.startNodeKeyObj = {};
453
+ this.flowVersionNodeObj = {};
454
+ let flowId = allFlowNode[0].flowId;
455
+ this.flowDefine = this.flowDefineByFlowId[flowId];
456
+ (allFlowNode || []).forEach(item => {
457
+ if (item.nodeLinkId.indexOf("Activity_draft") > -1) {
458
+ this.startNodeKey = item.nodeLinkId;
459
+ this.startNodeKeyObj[item.version] = item.nodeLinkId; //开始节点对应版本号
460
+ }
461
+ if (!this.flowVersionNodeObj[item.version]) {
462
+ this.$this.$set(this.flowVersionNodeObj, item.version, {});
463
+ }
464
+ this.$this.$set(this.flowVersionNodeObj[item.version], item.nodeLinkId, item); //版本节点对象
465
+
466
+ this.allNodeInfo[item.id] = item;
467
+ this.flowNodeIdToInfo[item.id] = item;
468
+ let nodeArr = ['StartEvent', 'ParallelGateway', 'SequenceFlow', 'ExclusiveGateway', 'InclusiveGateway'];
469
+ if (item.nodeType && nodeArr.indexOf(item.nodeType) === -1) {
470
+ if (!this.flowNodeNameObj[item.nodeLinkId]) {
471
+ let nodeName = item.nodeName;
472
+ if (this.flowId.includes(",")) {
473
+ nodeName = this.flowDefine.flowName + "-" + item.nodeName;
474
+ }
475
+ this.$this.$set(this.flowNodeNameObj, item.nodeLinkId, nodeName);
476
+ } else {
477
+ if (this.flowNodeNameObj[item.nodeLinkId] !== item.nodeName) {
478
+ this.flowNodeNameObj[item.nodeLinkId] = this.flowNodeNameObj[item.nodeLinkId] + "," + item.nodeName;
479
+ }
480
+ }
481
+ }
482
+ if (item.nodeType === "UserTask" && (item.nodeLinkId || "").indexOf("Activity_draft") > -1) {
483
+ this.draftNodeId = item.id; // 草稿节点id
484
+ }
485
+ // 行按钮
486
+ let listButton = JSON.parse(item.listButton || "[]") || [];
487
+ listButton.forEach(button => {
488
+ button.showName = button.showName ? button.showName : this.listButtonObj[button.type];
489
+ });
490
+ this.nodeListButtonObj[item.id] = listButton;
491
+
492
+ // 表单按钮
493
+ let formButton = JSON.parse(item.formButton || "[]") || [];
494
+ formButton.forEach(button => {
495
+ button.showName = button.showName ? button.showName : this.formButtonObj[button.type];
496
+ });
497
+
498
+ this.nodeFormButtonObj[item.id] = this.sortButtonArr(formButton);
499
+ this.nodeFormBtnObj[item.id] = this.formatterFormButton(formButton);
500
+ });
501
+ this.$this.$set(this.startNodeKeyObjByFlowId, flowId, this.startNodeKeyObj);
502
+ this.$this.$set(this.flowVersionNodeObjByFlowId, flowId, this.flowVersionNodeObj);
503
+ // this.initFlowScript().then(() => {
504
+ // resolve(true);
505
+ // });
506
+ }
507
+ const initFlowScriptFunc = flowIdArr.map(flowId => () => this.initFlowScript(flowId));
508
+ Promise.all(initFlowScriptFunc.map(func => func())).then(scriptArr => {
509
+ (scriptArr || []).forEach(scriptEventObj => {
510
+ Object.keys(scriptEventObj).forEach(key => {
511
+ if (key) {
512
+ this.flowEventScriptByFlowId[key] = scriptEventObj[key];
513
+ }
514
+ });
515
+ });
516
+ }).catch(reason => {
517
+ console.log('流程脚本加载出错了', reason);
518
+ });
519
+ let result = {
520
+ flowDefineByFlowId : this.flowDefineByFlowId,
521
+ startNodeKeyObj : this.startNodeKeyObj,
522
+ flowDefine : this.flowDefineByFlowId[this.flowId],
523
+ startNodeKey : this.startNodeKey,
524
+ allNodeInfo : this.allNodeInfo,
525
+ flowNodeIdToInfo : this.flowNodeIdToInfo,
526
+ flowNodeNameObj : this.flowNodeNameObj,
527
+ draftNodeId : this.draftNodeId,
528
+ nodeListButtonObj : this.nodeListButtonObj,
529
+ nodeFormButtonObj : this.nodeFormButtonObj,
530
+ nodeFormBtnObj : this.nodeFormBtnObj,
531
+ startNodeKeyObjByFlowId : this.startNodeKeyObjByFlowId,
532
+ flowVersionNodeObjByFlowId : this.flowVersionNodeObjByFlowId,
533
+ flowEventScriptByFlowId : this.flowEventScriptByFlowId
534
+ };
535
+ resolve(result);
536
+ });
537
+ });
538
+ }
539
+
540
+ /**
541
+ * 初始化流程信息
542
+ */
543
+ getFlowInfo(){
544
+ this.flowDefine.id = this.flowId;
545
+ return new Promise(resolve => {
546
+ this.$this.FLOW_GLOBAL.getFlowDefineById(this.flowId).then(flowobj => {
547
+ this.flowDefine = flowobj;
548
+ this.$flowDialog.fillFlowDialogParams({
549
+ flowDefine: this.flowDefine
550
+ });
551
+ let tabSetting = JSON.parse(this.flowDefine.tabSetting,"[]");
552
+ (tabSetting || []).forEach(item => {
553
+ if(item.isUse == '1'){
554
+ this.operateType[item.type] = true;
555
+ }
556
+ })
557
+ let activeArr = [];
558
+ Object.keys(this.operateType).forEach(key => {
559
+ if(this.operateType[key] && this.resourceTabOpts.indexOf(key) > -1){
560
+ activeArr.push(key);
561
+ }
562
+ })
563
+ if(activeArr.length > 0 && activeArr.indexOf("pending") == -1){
564
+ this.tabActive = activeArr[0]; // todo 返回tabActive
565
+ }
566
+ // this.showModel = flowobj.showModel;
567
+ // this.showInfo = flowobj.showInfo;
568
+ // let formType = flowobj.formType;
569
+ //工作流节点
570
+ this.startNodeKey = "Activity_draft";
571
+ this.startNodeKeyObj = {};
572
+ // let flowVersion = this.flowDefine.flowVersion || '1.0';
573
+ this.$this.FLOW_GLOBAL.getFlowNodesByFlowId(this.flowId).then(nodeDatas => {
574
+ if (nodeDatas) {
575
+ nodeDatas.forEach(item => {
576
+ if (item.nodeLinkId.indexOf("Activity_draft") > -1) {
577
+ this.startNodeKey = item.nodeLinkId;
578
+ this.startNodeKeyObj[item.version] = item.nodeLinkId; //开始节点对应版本号
579
+ }
580
+ if(!this.flowVersionNodeObj[item.version]){
581
+ this.$this.$set(this.flowVersionNodeObj,item.version,{});
582
+ }
583
+ this.$this.$set(this.flowVersionNodeObj[item.version],item.nodeLinkId,item); //版本节点对象
584
+ // if(item.version == this.flowDefine.releaseVersion){ //节点信息只取最新版本
585
+ this.flowNodeIdToInfo[item.id] = item;
586
+ if(item.nodeType&&['StartEvent','ParallelGateway','SequenceFlow','ExclusiveGateway','InclusiveGateway'].indexOf(item.nodeType) == -1){
587
+ if(!this.flowNodeNameObj[item.nodeLinkId]){
588
+ this.$this.$set(this.flowNodeNameObj,item.nodeLinkId,item.nodeName);
589
+ }else {
590
+ if(this.flowNodeNameObj[item.nodeLinkId] != item.nodeName){
591
+ this.flowNodeNameObj[item.nodeLinkId] = this.flowNodeNameObj[item.nodeLinkId] + "," + item.nodeName;
592
+ }
593
+ }
594
+ }
595
+ if(item.nodeType == "UserTask" && (item.nodeLinkId || "").indexOf("Activity_draft") > -1){
596
+ this.draftNodeId = item.id; // 草稿节点id
597
+ }
598
+ // }
599
+ this.allNodeInfo[item.id] = item;
600
+ // 行按钮
601
+ let listButton = JSON.parse(item.listButton || "[]") || [];
602
+ listButton = listButton.filter(item => !item.buttonId);
603
+ listButton.forEach(button => {
604
+ button.showName = button.showName ? button.showName : this.listButtonObj[button.type];
605
+ });
606
+ this.nodeListButtonObj[item.id] = listButton;
607
+
608
+ // 表单按钮
609
+ let formButton = JSON.parse(item.formButton || "[]") || [];
610
+ formButton = formButton.filter(item => !item.buttonId);
611
+ formButton.forEach(button => {
612
+ button.showName = button.showName ? button.showName : this.formButtonObj[button.type];
613
+ });
614
+
615
+ this.nodeFormButtonObj[item.id] = this.sortButtonArr(formButton);
616
+ this.nodeFormBtnObj[item.id] = this.formatterFormButton(formButton);
617
+
618
+ // 自定义按钮
619
+ if(item.plFlowButtons) {
620
+ (item.plFlowButtons || []).forEach(button => {
621
+ this.diyButtonsObj[button.id] = button;
622
+ })
623
+ }
624
+
625
+ let width = 0;
626
+ (this.nodeListButtonObj[item.id] || []).forEach(item => {
627
+ let nameLength = item.showName.length;
628
+ if (nameLength > 2) {
629
+ width += 100 + (nameLength - 2) * 12;
630
+ } else {
631
+ width += 100;
632
+ }
633
+ });
634
+ if (this.optColumnWidth < width) {
635
+ this.optColumnWidth = width;
636
+ }
637
+ });
638
+
639
+ // 显示
640
+ // this.isShowAgentSet = true;
641
+ // this.$forceUpdate();
642
+ }
643
+ // 加载工作流脚本与工作流事件规则
644
+ this.initFlowScript().then(() => {
645
+ let result = {
646
+ operateType : this.operateType,
647
+ tabActive : this.tabActive,
648
+ flowDefine : this.flowDefine,
649
+ startNodeKey : this.startNodeKey,
650
+ startNodeKeyObj : this.startNodeKeyObj,
651
+ flowVersionNodeObj : this.flowVersionNodeObj,
652
+ allNodeInfo : this.allNodeInfo,
653
+ flowNodeNameObj : this.flowNodeNameObj,
654
+ flowNodeIdToInfo : this.flowNodeIdToInfo,
655
+ nodeListButtonObj : this.nodeListButtonObj,
656
+ nodeFormButtonObj : this.nodeFormButtonObj,
657
+ nodeFormBtnObj : this.nodeFormBtnObj,
658
+ optColumnWidth : this.optColumnWidth,
659
+ diyButtonsObj : this.diyButtonsObj,
660
+ };
661
+ this.initFlowObj();
662
+ resolve(result);
663
+ })
664
+ });
665
+ });
666
+ });
667
+ }
668
+
669
+ initFlowObj() {//处理流程定义对象
670
+ this.isRefreshGetNextUsers = [];
671
+ let gatewayFields = this.flowDefine.gatewayFields || "";
672
+ this.isRefreshGetNextUsers = gatewayFields.split(",");
673
+ Object.keys(this.allNodeInfo).forEach(key => {
674
+ let obj = this.allNodeInfo[key];
675
+ if (obj.nodeType === "UserTask" && (!obj.nodeLinkId || obj.nodeLinkId.indexOf('Activity_draft') === -1)) {
676
+ if (obj.dealerType === "form" && obj.formField) {
677
+ this.isRefreshGetNextUsers.push(obj.formField);
678
+ }
679
+ if (obj.dealerType === "variable" && obj.variable) {
680
+ this.isRefreshGetNextUsers.push(obj.variable);
681
+ }
682
+ if (obj.dealerType === "interface" && obj.dealerUrlParam) {
683
+ let dealerUrlParam = JSON.parse(obj.dealerUrlParam || "[]");
684
+ dealerUrlParam.forEach(param => {
685
+ if (param.paramType === "variable") {
686
+ this.isRefreshGetNextUsers.push(param.paramVal);
687
+ }
688
+ })
689
+ }
690
+ }
691
+ });
692
+ let tabTypeObj= {};
693
+ if (!this.flowId.includes(",")) {
694
+ let tabSetting = JSON.parse(this.flowDefine.tabSetting);
695
+ tabSetting.forEach(data => {
696
+ this.$this.$set(tabTypeObj, data.type, data);
697
+ });
698
+ Object.keys(tabTypeObj).forEach(key => {
699
+ let objTemp = tabTypeObj[key];
700
+ objTemp.tabName = objTemp["showName"] || objTemp["name"];
701
+ });
702
+ let tabTitleType = this.flowDefine.tabTitleType;
703
+ if (tabTitleType === "1") {
704
+ tabTypeObj["showtTabText"] = true;
705
+ tabTypeObj["showTabIcon"] = true;
706
+ } else if (tabTitleType === "2") {
707
+ tabTypeObj["showtTabText"] = true;
708
+ } else if (tabTitleType === "3") {
709
+ tabTypeObj["showTabIcon"] = true;
710
+ }
711
+ }
712
+
713
+ let result = {
714
+ isRefreshGetNextUsers : this.isRefreshGetNextUsers,
715
+ tabTypeObj: tabTypeObj
716
+ }
717
+ this.setFlowTabInfo && this.setFlowTabInfo(result);
718
+ }
719
+
720
+ // 初始化流程信息end
721
+
722
+ /**
723
+ * 下一步,保存数据以及获取处理人
724
+ */
725
+ nextStep() {
726
+ let afterClickResult;
727
+ let result;
728
+ let currentNodeObj = this.flowNodeIdToInfo[this.currentInst.currentNode || this.draftNodeId] ||{};
729
+ afterClickResult=this.exeFlowEvent("nextStep","afterClick", this.currentInst.currentNode || this.draftNodeId);
730
+
731
+ if(typeof afterClickResult == "boolean" && afterClickResult === false){
732
+ return;
733
+ }
734
+
735
+ if(currentNodeObj.openEvent === '1'){
736
+ afterClickResult = this.exeNewFlowEvent("nextClick",currentNodeObj.nodeLinkId);
737
+ }
738
+
739
+ if(typeof afterClickResult == "boolean" && afterClickResult === false){
740
+ return;
741
+ }
742
+
743
+ // let afterValidateResult;
744
+ // let currentNodeObj = this.flowNodeIdToInfo[this.currentInst.currentNode || this.draftNodeId] ||{};
745
+ result = this.exeFlowEvent("nextStep","afterValidate", this.currentInst.currentNode || this.draftNodeId);
746
+ if(typeof result == "boolean" && result === false){
747
+ return;
748
+ }
749
+ if(currentNodeObj.openEvent === '1'){
750
+ result = this.exeNewFlowEvent("nextCheck",currentNodeObj.nodeLinkId);
751
+ if(typeof result == "boolean" && result === false){
752
+ return;
753
+ }
754
+ }
755
+
756
+ this.isDisabled['nextStep'] = false;
757
+ this.$flowDialog.fillFlowDialogParams({
758
+ flowParams: this.flowParams,
759
+ isDisabled: this.isDisabled
760
+ });
761
+ this.saveDataFunc('nextStep').then(flowParams => {
762
+ this.flowParams = JSON.parse(JSON.stringify(flowParams));
763
+ this.setParams && this.setParams({
764
+ flowParams:this.flowParams
765
+ });
766
+ let instId = flowParams.flowInstId;
767
+ this.$this.$set(this.formInfo,"opt","update");
768
+ this.currentInst.id = instId;
769
+ this.description = "";
770
+ this.saveInstId = instId;
771
+ this.nowNode = this.allNodeInfo[currentNodeObj.id] || {};
772
+ this.nextStepAfterSaveFunc().then(resultEvt => {
773
+ if(!resultEvt){
774
+ this.isDisabled['nextStep'] = true;
775
+ this.$flowDialog.fillFlowDialogParams({
776
+ isDisabled: this.isDisabled
777
+ });
778
+ return;
779
+ }
780
+ this.isProceedNext = true;
781
+ //获取处理人
782
+ let obj = {instId: instId, taskId: this.currentInst.taskId,};
783
+ if(this.nowNode && this.nowNode.dealType && this.nowNode.dealType == 'multi'){
784
+ this.$this.$set(obj,'passCondition',this.nowNode.passCondition)
785
+ }
786
+ let params = {"SASP_FLOW_USE_VARIABLES":"yes"};
787
+ // Object.assign(params,flowParams || {},obj);
788
+ Object.assign(params,obj);
789
+ let allParamKeys = Object.keys(flowParams || {});
790
+ allParamKeys.forEach(templateKey => {
791
+ if(this.isRefreshGetNextUsers.indexOf(templateKey) > -1){
792
+ params[templateKey] = flowParams[templateKey];
793
+ if(allParamKeys.indexOf(templateKey + "_SASP_SYS_DATA") > -1){
794
+ params[templateKey + "_SASP_SYS_DATA"] = flowParams[templateKey + "_SASP_SYS_DATA"];
795
+ }
796
+ if(allParamKeys.indexOf(templateKey + "_SASP_SYS_DATA_ID") > -1){
797
+ params[templateKey + "_SASP_SYS_DATA_ID"] = flowParams[templateKey + "_SASP_SYS_DATA_ID"];
798
+ }
799
+ }
800
+ });
801
+ this.$flowDialog.fillFlowDialogParams({
802
+ flowParams: this.flowParams,
803
+ formInfo: this.formInfo,
804
+ currentInst: this.currentInst,
805
+ description: this.description,
806
+ saveInstId: this.saveInstId,
807
+ nowNode: this.nowNode,
808
+ isProceedNext: this.isProceedNext,
809
+ });
810
+ this.$this.saspFlowAxios.post(this.$this.api.plFlowInst.getNextUsers, params).then(res => {
811
+ if(!res.data.operateSuccess){
812
+ this.isDisabled['nextStep'] = true;
813
+ if(res.data.resultObject === 'requestException'){
814
+ this.$this.$message.error(res.data.errorInfo);
815
+ }else{
816
+ this.$this.$message.error("未获取到处理人");
817
+ }
818
+ return;
819
+ }
820
+ let obj = {};
821
+ if (res && res.data) {
822
+ obj = res.data.operateObj || {};
823
+ if(res.data.operateMap && res.data.operateMap.isPassCondition == 0){
824
+ this.isProceedNext = false;
825
+ this.$flowDialog.fillFlowDialogParams({
826
+ isProceedNext: this.isProceedNext,
827
+ });
828
+ }
829
+ }
830
+ this.nextNodeName = "";
831
+ this.choosePosUserIds = "";
832
+ this.choosePosUserIdsObj = {};
833
+ this.nextNode = obj;
834
+ this.chooseNextUserIdObj = {};
835
+ this.chooseNextUserNameObj = {};
836
+ this.chooseNextUserId = "";
837
+ this.chooseNextUserName = "";
838
+ let paramKeyArr = ["nextNodeName","choosePosUserIds","choosePosUserIdsObj","nextNode",
839
+ "chooseNextUserIdObj","chooseNextUserNameObj","chooseNextUserId","chooseNextUserName",
840
+ "nextSteptUserArr","nextSteptUserType"];
841
+ let params = {};
842
+ paramKeyArr.forEach(key => {
843
+ params[key] = this[key];
844
+ })
845
+ this.$flowDialog.fillFlowDialogParams(params);
846
+ if (obj.nextType == "inclusiveGateway") {
847
+ let autoChooseUser = false;
848
+ (obj.result || []).forEach(item => {
849
+ //获取下一个节点信息
850
+ let nextNodeTmp = this.flowNodeIdToInfo[item.nextNodeId] || {};
851
+ if (nextNodeTmp.nodeType == "UserTask") {
852
+ item.mulitiChooseUser = nextNodeTmp.dealType != "single";
853
+ autoChooseUser = nextNodeTmp.autoChooseUser == "1";
854
+ if (item.mulitiChooseUser) {
855
+ this.$this.$set(this.chooseNextUserIdObj, item.nodeKey, []);
856
+ } else {
857
+ this.$this.$set(this.chooseNextUserIdObj, item.nodeKey, "");
858
+ }
859
+ } else if (this.nextNode.nodeType == "EndEvent") {
860
+ return;
861
+ }
862
+ let userArr = item.userArr || [];
863
+ //自动执行时的自动执行人
864
+ if (autoChooseUser) {
865
+ if (item.type == "user" && userArr.length == 0) {
866
+ // this.$this.$message({type:"error",message:"没有处理人!"});
867
+ return;
868
+ } else {
869
+ let userIds = "";
870
+ let userNames = "";
871
+ userArr.forEach(userInfo => {
872
+ userIds += "," + userInfo.id;
873
+ userNames += "," + userInfo.userName;
874
+ });
875
+ this.chooseNextUserIdObj[item.nodeKey] = userIds.substring(1);
876
+ this.chooseNextUserId = userIds.substring(1);
877
+ this.chooseNextUserName = userNames.substring(1);
878
+ this.$flowDialog.fillFlowDialogParams({
879
+ chooseNextUserId: this.chooseNextUserId,
880
+ chooseNextUserName: this.chooseNextUserName,
881
+ chooseNextUserIdObj: this.chooseNextUserIdObj
882
+ });
883
+ this.$flowDialog.saveNextStept();
884
+ }
885
+ }
886
+ item.nextSteptUserType = obj.type;
887
+ if (item.type == "user" || item.type== 'all') {
888
+ item.nextSteptUserArr = userArr;
889
+ }
890
+ });
891
+ if(!autoChooseUser){
892
+ this.nextSteptUserDialog = true;
893
+ this.$flowDialog.operateDialog('nextSteptUserDialog',true);
894
+ }
895
+ } else {
896
+ //获取下一个节点信息
897
+ this.nextNode = this.allNodeInfo[obj.nextNodeId] || {};
898
+ this.nextNodeName = obj.nextNodeName || "";
899
+ let autoChooseUser = false;
900
+ this.$flowDialog.fillFlowDialogParams({
901
+ nextNode: this.nextNode,
902
+ nextNodeName: this.nextNodeName
903
+ });
904
+ if (this.nextNode.nodeType == "UserTask") {
905
+ this.mulitiChooseUser = this.nextNode.dealType != "single";
906
+ autoChooseUser = this.nextNode.autoChooseUser == "1";
907
+ this.chooseNextUserId = "";
908
+ this.chooseNextUserName = "";
909
+ this.$flowDialog.fillFlowDialogParams({
910
+ chooseNextUserId: this.chooseNextUserId,
911
+ chooseNextUserName: this.chooseNextUserName
912
+ });
913
+ } else if (this.nextNode.nodeType == "EndEvent") {
914
+ this.nextSteptUserDialog = true;
915
+ this.$flowDialog.operateDialog('nextSteptUserDialog',true);
916
+ return;
917
+ }
918
+ let userArr = obj.userArr || [];
919
+ //自动执行时的自动执行人
920
+ if (autoChooseUser) {
921
+ if (obj.type == "user" && userArr.length == 0) {
922
+ this.$this.$message({type: "error", message: "没有处理人!"});
923
+ return;
924
+ } else {
925
+ let userIds = "";
926
+ let userNames = "";
927
+ userArr.forEach(userInfo => {
928
+ userIds += "," + userInfo.id;
929
+ userNames += "," + userInfo.userName;
930
+ });
931
+ if (userIds) {
932
+ this.chooseNextUserId = userIds.substring(1);
933
+ this.chooseNextUserName = userNames.substring(1);
934
+ }
935
+ this.$flowDialog.fillFlowDialogParams({
936
+ chooseNextUserId: this.chooseNextUserId,
937
+ chooseNextUserName: this.chooseNextUserName
938
+ });
939
+ this.$flowDialog.saveNextStept();
940
+ }
941
+ }
942
+ this.nextSteptUserType = obj.type;
943
+ if (obj.type == "user" || obj.type == 'all') {
944
+ this.nextSteptUserArr = userArr;
945
+ }
946
+ this.$flowDialog.fillFlowDialogParams({
947
+ nextSteptUserType: this.nextSteptUserType,
948
+ nextSteptUserArr: this.nextSteptUserArr
949
+ });
950
+ if(!autoChooseUser){
951
+ this.nextSteptUserDialog = true;
952
+ this.$flowDialog.operateDialog('nextSteptUserDialog',true);
953
+ }
954
+ }
955
+ if(this.nextNode.nextType == 'inclusiveGateway'){
956
+ (this.nextNode.result || []).forEach(item => {
957
+ this.chooseNextUserIdObj[item.nodeKey] = (item.userArr || {}).id;
958
+ });
959
+ this.$flowDialog.fillFlowDialogParams({
960
+ chooseNextUserIdObj: this.chooseNextUserIdObj,
961
+ });
962
+ }else{
963
+ let userInfo = this.nextSteptUserArr[0] || {};
964
+ if(this.nextNode.dealType=="single"){
965
+ this.chooseNextUserId = userInfo.id;
966
+ this.chooseNextUserName = userInfo.userName;
967
+ this.$flowDialog.fillFlowDialogParams({
968
+ chooseNextUserId: this.chooseNextUserId,
969
+ chooseNextUserName: this.chooseNextUserName
970
+ });
971
+ }
972
+ if(this.nextNode.dealType === "multi" && this.nextSteptUserArr.length === 1){
973
+ this.chooseNextUserId = [userInfo.id];
974
+ this.$flowDialog.fillFlowDialogParams({
975
+ chooseNextUserId: this.chooseNextUserId
976
+ });
977
+ }
978
+ }
979
+ });
980
+ })
981
+ });
982
+ }
983
+
984
+ nextStepAfterSaveFunc(){
985
+ return new Promise(resolve => {
986
+ if(this.nextStepAfterSave){
987
+ let result = this.nextStepAfterSave(this.$this,this);
988
+ if(result && result.then){
989
+ result.then(res => {
990
+ resolve(res);
991
+ })
992
+ }else{
993
+ resolve(result);
994
+ }
995
+ }else{
996
+ resolve(true);
997
+ }
998
+ })
999
+ }
1000
+
1001
+ saveDataFunc(type){ // 保存完成后返回流程的相关变量,通过变量传递到后台驱动流程运转
1002
+ // 保存草稿、下一步保存
1003
+ return new Promise(resolve => {
1004
+ if(this.saveFormInfo){
1005
+ let result = this.saveFormInfo(type);
1006
+ if(result && result.then){
1007
+ result.then(res => {
1008
+ if(!res){
1009
+ this.isDisabled['nextStep'] = true;
1010
+ return;
1011
+ }
1012
+ if(typeof res !== 'object'){
1013
+ res = {};
1014
+ }
1015
+ this.saveFlowData(res).then(flowInstData => {
1016
+ res['flowInstId'] = flowInstData.id;
1017
+ resolve(res);
1018
+ })
1019
+ })
1020
+ }else{
1021
+ if(!result){
1022
+ return;
1023
+ }
1024
+ if(typeof result !== 'object'){
1025
+ result = {};
1026
+ }
1027
+ this.saveFlowData(result).then(flowInstData => {
1028
+ result['flowInstId'] = flowInstData.id;
1029
+ resolve(result);
1030
+ })
1031
+ }
1032
+ }else{
1033
+ this.saveFlowData().then(flowInstData => {
1034
+ let obj = {};
1035
+ obj['flowInstId'] = flowInstData.id;
1036
+ resolve(obj);
1037
+ })
1038
+ }
1039
+ })
1040
+ }
1041
+
1042
+ saveFlowData(flowParams){
1043
+ return new Promise(resolve => {
1044
+ flowParams = flowParams || {};
1045
+ let flowSummary = this.getFlowSummary(flowParams);
1046
+ let flowInst = {};
1047
+ let dataId = (flowParams || {}).flowDataId || "";
1048
+ this.dataId = dataId;
1049
+ if(this.currentInst && this.currentInst.id){
1050
+ this.$this.$set(this.formInfo,"opt","update");
1051
+ flowInst = {
1052
+ "id": this.currentInst.id,
1053
+ "flowSummary": flowSummary,
1054
+ "updated": this.loginUser.id,
1055
+ };
1056
+ if(this.formInfo.opt == 'add' || !this.currentInst.linkProcId){ //版本号也要随之更新
1057
+ flowInst = Object.assign(flowInst,{"version":this.flowDefine.releaseVersion,"isRelease":this.flowDefine.isRelease})
1058
+ }
1059
+ this.$this.saspFlowAxios.post(this.$this.api.plFlowInst.url + "/" + this.formInfo.opt, flowInst).then(instRes => {
1060
+ this.runFlowEvt();
1061
+ resolve(instRes.data.operateObj);
1062
+ });
1063
+ }else{
1064
+ let startNodeKey = this.startNodeKeyObj[this.flowDefine.releaseVersion];
1065
+ if (this.formInfo.opt == "add") {
1066
+ flowInst = {
1067
+ flowId: this.flowDefine.id,
1068
+ flowSummary: flowSummary,
1069
+ dataId: dataId,
1070
+ version:this.flowDefine.releaseVersion, //版本号
1071
+ startTime: this.$this.DATE_UTIL.getCurrentDateTime(), flowStatus: "0",
1072
+ created: this.loginUser.id,
1073
+ currentNode: this.flowVersionNodeObj[this.flowDefine.releaseVersion][startNodeKey].id,
1074
+ isRelease:this.flowDefine.isRelease
1075
+ };
1076
+ } else {
1077
+ flowInst = {
1078
+ id: this.currentInst.id,
1079
+ flowSummary: flowSummary,
1080
+ version:this.flowDefine.releaseVersion, //版本号也要随之更新
1081
+ updated: this.loginUser.id,
1082
+ };
1083
+ }
1084
+ this.$this.saspFlowAxios.post(this.$this.api.plFlowInst.url + "/" + this.formInfo.opt, flowInst).then(instRes => {
1085
+ this.runFlowEvt();
1086
+ resolve(instRes.data.operateObj);
1087
+ this.currentInst=instRes.data.operateObj;
1088
+ });
1089
+ }
1090
+ })
1091
+ }
1092
+
1093
+ /**
1094
+ * 获取流程概要
1095
+ */
1096
+ getFlowSummary(dataObj, summaryTemplate) {
1097
+ let flowSummary = "";
1098
+ let summarySet = summaryTemplate || this.flowDefine.flowSummary;
1099
+ if (!this.currentInst.linkProcId) { // 草稿数据
1100
+ flowSummary = this.$this.platStringUtil.replaceAll(summarySet, "${startUserName*}", this.loginUser.userName);
1101
+ flowSummary = this.$this.platStringUtil.replaceAll(flowSummary, "${createTime*}", this.$this.DATE_UTIL.getCurrentDateTime());
1102
+ } else {
1103
+ flowSummary = this.$this.platStringUtil.replaceAll(summarySet, "${startUserName*}", this.currentStartUser);
1104
+ flowSummary = this.$this.platStringUtil.replaceAll(flowSummary, "${createTime*}", this.currentStartTime);
1105
+ }
1106
+ flowSummary = this.$this.platStringUtil.replaceAll(flowSummary, "${flowName*}", this.flowDefine.flowName);
1107
+ if (this.flowDefine.summaryNameId) {
1108
+ // flowSummary = flowSummary.toUpperCase();
1109
+ let summaryNameId = JSON.parse(this.flowDefine.summaryNameId);
1110
+ Object.keys(summaryNameId).forEach(fieldName => {
1111
+ let fieldId = summaryNameId[fieldName];
1112
+ if (fieldName && dataObj.hasOwnProperty(fieldId)) {
1113
+ let replaceVal = dataObj[fieldId];
1114
+ if(dataObj[fieldId + "_SASP_SYS_DATA"]){
1115
+ replaceVal = dataObj[fieldId+ "_SASP_SYS_DATA"];
1116
+ }
1117
+ if(dataObj[fieldId + "_sequence"]){ // 自增序列
1118
+ replaceVal = dataObj[fieldId + "_sequence"];
1119
+ }
1120
+ flowSummary = this.$this.platStringUtil.replaceAll(flowSummary, "${" + fieldName + "}", replaceVal);
1121
+ }else if(fieldName && dataObj.hasOwnProperty(fieldName)){
1122
+ let replaceVal = dataObj[fieldName];
1123
+ if(dataObj[fieldName + "_SASP_SYS_DATA"]){
1124
+ replaceVal = dataObj[fieldName+ "_SASP_SYS_DATA"];
1125
+ }
1126
+ if(dataObj[fieldName + "_sequence"]){ // 自增序列
1127
+ replaceVal = dataObj[fieldName + "_sequence"];
1128
+ }
1129
+ flowSummary = this.$this.platStringUtil.replaceAll(flowSummary, "${" + fieldName + "}", replaceVal);
1130
+ }else{
1131
+ flowSummary = this.$this.platStringUtil.replaceAll(flowSummary, "${" + fieldName + "}", "");
1132
+ }
1133
+ });
1134
+ }
1135
+ return flowSummary;
1136
+ }
1137
+
1138
+
1139
+ /**
1140
+ * 加载工作流脚本与工作流事件规则
1141
+ */
1142
+ initFlowScript(flowId){
1143
+ if (flowId) {
1144
+ this.flowDefine = this.flowDefineByFlowId[flowId] || {};
1145
+ }
1146
+ return new Promise(resolve => {
1147
+ this.$this.saspFlowAxios.all([
1148
+ this.$this.saspFlowAxios.post(this.$this.api.plFlowScript.find,{"flowId": this.flowDefine.id}),
1149
+ this.$this.saspFlowAxios.post(this.$this.api.plFlowEventDetail.findByFlowAndLeadFunc,{"flowId": this.flowDefine.id,"version":this.flowDefine.flowVersion || "1.0"})
1150
+ ]).then(this.$this.saspFlowAxios.spread((resScript, resEvent) => {
1151
+ // 流程脚本
1152
+ if(resScript){
1153
+ let scriptDatas = resScript.data || [];
1154
+ // 脚本order排序
1155
+ scriptDatas = scriptDatas.sort(sortScript);
1156
+ function sortScript(a,b){
1157
+ return Number(a.scriptOrder) - Number(b.scriptOrder);
1158
+ }
1159
+ // 根据节点区分
1160
+ let scriptObj = {};
1161
+ let arr = ['vm','axios','CTX','formData','LOGINUSER','Ajax','nextNode','resolve'];
1162
+ scriptDatas.forEach(item => {
1163
+ // 添加修改是单独区分开,没有节点概念
1164
+ if(item.executePosition == "add" || item.executePosition == "update"){
1165
+ if(!scriptObj[item.executePosition]){
1166
+ scriptObj[item.executePosition] = {};
1167
+ }
1168
+ if(!scriptObj[item.executePosition][item.executeTime]){
1169
+ scriptObj[item.executePosition][item.executeTime] = [];
1170
+ }
1171
+ try{
1172
+ if(item.content){
1173
+ let value = item.content;
1174
+ value = this.replaceUrl(value);
1175
+ item.content = value;
1176
+ }
1177
+ scriptObj[item.executePosition][item.executeTime].push(new Function(...arr,item.content));
1178
+ }catch (e) {
1179
+ console.log(item.content);
1180
+ console.log("脚本编译失败!");
1181
+ }
1182
+ }else{
1183
+ if(!scriptObj[item.nodeId]){
1184
+ scriptObj[item.nodeId] = {};
1185
+ }
1186
+ let nodeObj = scriptObj[item.nodeId]; // 节点的所有内容
1187
+ if(!nodeObj[item.executePosition]){
1188
+ nodeObj[item.executePosition] = {};
1189
+ }
1190
+ let positionObj = nodeObj[item.executePosition]; // 脚本的执行位置,add,update,deal,等
1191
+ if(!positionObj[item.executeTime]){
1192
+ positionObj[item.executeTime] = [];
1193
+ }
1194
+ let executeTimeArr = positionObj[item.executeTime]; // 在该时间对应的脚本内容数组
1195
+ try{
1196
+ if(item.content){
1197
+ let value = item.content;
1198
+ value = this.replaceUrl(value);
1199
+ item.content = value;
1200
+ }
1201
+ executeTimeArr.push(new Function(...arr,item.content));
1202
+ }catch (e) {
1203
+ console.log(item.content);
1204
+ console.log("脚本编译失败!");
1205
+ }
1206
+ }
1207
+ })
1208
+ this.scriptObj = scriptObj;
1209
+ }
1210
+ // 流程事件规则
1211
+ if(resEvent){
1212
+ let eventDataArr = resEvent.data || [];
1213
+ let scriptObj = {};
1214
+ let eventObj = {};
1215
+ let arr = ['vm','axios','CTX','formData','LOGINUSER','Ajax','nextNode','resolve'];
1216
+ eventDataArr.forEach(item =>{
1217
+ let executeTypeArr = (item.executeType || '').split(",");
1218
+ executeTypeArr.forEach(executeType =>{
1219
+ if (item.source == 'diy'){
1220
+ //自定义
1221
+ // 添加是单独区分开,没有节点概念
1222
+ if(executeType == "addAfter"){
1223
+ if(!scriptObj[executeType]){
1224
+ scriptObj[executeType] = [];
1225
+ }
1226
+ try{
1227
+ if(item.funcBody){ //方法体
1228
+ let value = item.funcBody;
1229
+ value = this.replaceUrl(value);
1230
+ item.funcBody = value;
1231
+ }
1232
+ scriptObj[executeType].push(new Function(...arr,item.funcBody));
1233
+ }catch (e) {
1234
+ console.log(item.funcBody);
1235
+ console.log("脚本编译失败!");
1236
+ }
1237
+ }else{
1238
+ if(!scriptObj[item.nodeKey]){
1239
+ scriptObj[item.nodeKey] = {};
1240
+ }
1241
+ let nodeObj = scriptObj[item.nodeKey]; // 节点的所有内容
1242
+ if(!nodeObj[executeType]){
1243
+ nodeObj[executeType] = [];
1244
+ }
1245
+ let positionArr = nodeObj[executeType]; // 脚本的执行位置,add,update,deal,等
1246
+ try{
1247
+ if(item.funcBody){
1248
+ let value = item.funcBody;
1249
+ value = this.replaceUrl(value);
1250
+ item.funcBody = value;
1251
+ }
1252
+ positionArr.push(new Function(...arr,item.funcBody));
1253
+ }catch (e) {
1254
+ console.log(item.funcBody);
1255
+ console.log("脚本编译失败!");
1256
+ }
1257
+ }
1258
+ this.newScriptObj = scriptObj;
1259
+ }else if(item.source == 'event'){ //事件规则
1260
+ //获取响应配置
1261
+ // 添加单独区分开,没有节点概念
1262
+ if(executeType == "addAfter"){
1263
+ if(!eventObj[executeType]){
1264
+ eventObj[executeType] = {};
1265
+ }
1266
+ try{
1267
+ if(item.resConfigurateion){ //响应配置
1268
+ let resConfigurateionObj = JSON.parse(item.resConfigurateion || "{}");
1269
+ let eventKey = resConfigurateionObj.eventKey;
1270
+ if(!eventObj[executeType][eventKey]){
1271
+ eventObj[executeType][eventKey] = [];
1272
+ }
1273
+ eventObj[executeType][eventKey].push(resConfigurateionObj); //复制响应配置
1274
+ }
1275
+ }catch (e) {
1276
+ console.log(item.funcBody);
1277
+ console.log("脚本编译失败!");
1278
+ }
1279
+ }else{
1280
+ if(!eventObj[item.nodeKey]){
1281
+ eventObj[item.nodeKey] = {};
1282
+ }
1283
+ let nodeObj = eventObj[item.nodeKey]; // 节点的所有内容
1284
+ if(!nodeObj[executeType]){
1285
+ nodeObj[executeType] = {};
1286
+ }
1287
+ let positionObj = nodeObj[executeType]; // 脚本的执行位置,add,update,deal,等
1288
+ try{
1289
+ if(item.resConfigurateion){//响应配置
1290
+ let resConfigurateionObj = JSON.parse(item.resConfigurateion || "{}");
1291
+ let eventKey = resConfigurateionObj.eventKey;
1292
+ if(!positionObj[eventKey]){
1293
+ positionObj[eventKey] = [];
1294
+ }
1295
+ positionObj[eventKey].push(resConfigurateionObj); //复制响应配\
1296
+ }
1297
+ }catch (e) {
1298
+ console.log(item.funcBody);
1299
+ console.log("脚本编译失败!");
1300
+ }
1301
+ }
1302
+ this.newEventObj = eventObj;
1303
+ }
1304
+ });
1305
+ });
1306
+ }
1307
+ // 结束
1308
+ let obj = {"scriptObj": this.scriptObj, "newScriptObj": this.newScriptObj, "newEventObj": this.newEventObj};
1309
+ resolve({[flowId]: obj});
1310
+ }));
1311
+ })
1312
+ }
1313
+
1314
+ /**
1315
+ * 执行下一步
1316
+ * @returns {Promise<boolean>} 是否继续流程
1317
+ */
1318
+ async executeNextStep() {
1319
+
1320
+ }
1321
+
1322
+ /**
1323
+ * 取消当前流程
1324
+ */
1325
+ cancel() {
1326
+
1327
+ }
1328
+
1329
+ // 脚本执行区
1330
+
1331
+ setFlowScript(flowId) {
1332
+ if (flowId) {
1333
+ let scriptObj = this.flowEventScriptByFlowId[flowId] || {};
1334
+ this.scriptObj = scriptObj.scriptObj || {};
1335
+ this.newScriptObj = scriptObj.newScriptObj || {};
1336
+ this.newEventObj = scriptObj.newEventObj || {};
1337
+ }
1338
+ }
1339
+
1340
+ runFlowEvt(){
1341
+ // let afterClickResult;
1342
+ let currentNodeObj = this.flowNodeIdToInfo[this.currentInst.currentNode || this.draftNodeId] ||{};
1343
+ if(currentNodeObj.openEvent == '1'){
1344
+ this.exeNewFlowEvent("saveAfter", currentNodeObj.nodeLinkId);
1345
+ }
1346
+ }
1347
+
1348
+ /**
1349
+ * 执行工作流脚本,为兼容1.0版本定制
1350
+ */
1351
+ exeFlowEvent(executePosition,executeTime,nodeId){
1352
+ // executePosition(为方便1.0转换,与1.0保持相同):add/update/handle/nextStep/view/columnFormatter
1353
+ // executePosition:add:['afterClick'],update:['afterClick'],handle:['afterClick'],
1354
+ // nextStep:['afterClick','afterValidate','submitSuccess'],view:['afterClick'],
1355
+ // (columnFormatter:['finished','end']?暂时不用)
1356
+ let formData = {};
1357
+ if(this.getFormInfo){
1358
+ formData = this.getFormInfo();
1359
+ }
1360
+ let CTX = "";
1361
+ let paramValues = [this.$this,this.$this.saspFlowAxios,CTX,formData,this.loginUser,AjaxUtil,this.nextNode,null]; // 入参
1362
+ if(executePosition == "add" || executePosition == "update"){
1363
+ ((this.scriptObj[executePosition] || {})[executeTime] || []).forEach(event => {
1364
+ event && event(...paramValues); // 执行事件
1365
+ });
1366
+ return;
1367
+ }
1368
+ let eventArr = ((this.scriptObj[nodeId] || {})[executePosition] || {})[executeTime] || [];
1369
+ let result=true;
1370
+ try{
1371
+ eventArr.forEach(event => {
1372
+ let eventResult=event && event(...paramValues); // 执行事件
1373
+ if(eventResult ==false){
1374
+ throw new Error("ending");//报错,就跳出循环
1375
+ }
1376
+ })
1377
+ }catch (e) {
1378
+ console.log(e);
1379
+ result=false;
1380
+ }
1381
+ return result;
1382
+ }
1383
+
1384
+ /**
1385
+ * 执行工作流新版本事件规则
1386
+ */
1387
+ exeNewFlowEvent(executeType,nodeKey){
1388
+ let formData = {};
1389
+ if(this.getFormInfo){
1390
+ formData = this.getFormInfo();
1391
+ }
1392
+ //执行自定义脚本
1393
+ // let CTX = window.JAVA_URL;
1394
+ let CTX = "";
1395
+ let paramValues = [this.$this,this.$this.saspFlowAxios,CTX,formData,this.loginUser,AjaxUtil,this.nextNode]; // 入参
1396
+ if(executeType == "addAfter"){ //新增或后
1397
+ (this.newScriptObj[executeType] || []).forEach(event => {
1398
+ event && event(...paramValues); // 执行事件
1399
+ });
1400
+
1401
+ //执行事件规则脚本
1402
+ Object.keys(this.newEventObj[executeType] || {}).forEach(eventKey =>{
1403
+ if(this.installListObj[eventKey]
1404
+ && this.installListObj[eventKey]["config"]
1405
+ && this.installListObj[eventKey]["config"].methods.renderFlowConfig){
1406
+ let affectContentArr = this.newEventObj[executeType][eventKey] || [];
1407
+ affectContentArr.forEach(affectContent =>{
1408
+ this.installListObj[eventKey]["config"].methods.renderFlowConfig(this.$this,this.$this.CTX,this.$this.saspFlowAxios,this.nextNode,formData,affectContent);
1409
+ });
1410
+ }
1411
+ });
1412
+ return;
1413
+ }
1414
+ let eventArr = (this.newScriptObj[nodeKey] || {})[executeType] || [];
1415
+ let result=true;
1416
+ try{
1417
+ eventArr.forEach(event => {
1418
+ let eventResult=event && event(...paramValues); // 执行事件
1419
+ if(eventResult ==false){
1420
+ throw new Error("ending");//报错,就跳出循环
1421
+ }
1422
+ });
1423
+
1424
+ let eventObj = (this.newEventObj[nodeKey] || {})[executeType] || {};
1425
+ Object.keys(eventObj).forEach(eventKey =>{
1426
+ if(this.installListObj[eventKey]
1427
+ && this.installListObj[eventKey]["config"]
1428
+ && this.installListObj[eventKey]["config"].methods.renderFlowConfig){
1429
+ let affectContentArr = eventObj[eventKey] || [];
1430
+ affectContentArr.forEach(affectContent =>{
1431
+ this.installListObj[eventKey]["config"].methods.renderFlowConfig(this.$this,this.$this.CTX,this.$this.saspFlowAxios,this.nextNode,formData,affectContent,executeType);
1432
+ });
1433
+ }
1434
+ });
1435
+ }catch (e) {
1436
+ console.log(e);
1437
+ result=false;
1438
+ }
1439
+
1440
+ return result;
1441
+
1442
+ }
1443
+ // end脚本执行结束
1444
+
1445
+
1446
+ // buttonMethod,按钮方法
1447
+
1448
+ // 打开前方法
1449
+ /**
1450
+ * 打开[添加]窗口
1451
+ */
1452
+ openAddFlowForm() {
1453
+ return new Promise(resolve => {
1454
+ this.init().then(() => {
1455
+ let nowVersion = this.flowDefine.releaseVersion; //只要已发布最小版本为1.0
1456
+ this.currentRowData = {};
1457
+ this.initFieldStatus(this.startNodeKeyObj[nowVersion],nowVersion).then(()=>{
1458
+ this.flowInstDataDialog = true;
1459
+ this.$flowDialog.operateDialog('flowInstDataDialog',true);
1460
+ this.$this.$nextTick(() => {
1461
+ this.initFormInfoFunc('add').then(() => {
1462
+ this.formBtnArr = this.getAddAndUpdateFormBtn({});
1463
+ Object.assign(this.formInfo, {
1464
+ dataId: "",
1465
+ opt: "add"
1466
+ });
1467
+ this.currentInst = {};
1468
+ this.$this.$nextTick(() => {
1469
+ this.exeFlowEvent("add","afterClick");
1470
+ let startNodeKey = this.startNodeKeyObj[nowVersion];
1471
+ let startNodeObj = this.flowVersionNodeObj[nowVersion][startNodeKey] || {};
1472
+ if(startNodeObj.openEvent == '1'){
1473
+ this.exeNewFlowEvent("addAfter");//新事件规则
1474
+ }
1475
+ })
1476
+ let result = {
1477
+ currentRowData: this.currentRowData,
1478
+ formBtnArr: this.formBtnArr,
1479
+ currentInst: this.currentInst,
1480
+ formInfo: this.formInfo
1481
+ };
1482
+ this.$flowDialog.fillFlowDialogParams(result);
1483
+ resolve(result);
1484
+ })
1485
+ });
1486
+ });
1487
+ })
1488
+ });
1489
+ }
1490
+
1491
+ initFormInfoFunc(type,rowData){
1492
+ if(!rowData){
1493
+ rowData = {};
1494
+ }
1495
+ let dataId = rowData.dataId || "";
1496
+ let nodeObjs = this.flowVersionNodeObj[this.flowDefine.releaseVersion];
1497
+ let startNodeKey = this.startNodeKeyObj[rowData.version];
1498
+ let nodeKey = rowData.nodeKey;
1499
+ let currentNode = nodeObjs[nodeKey || startNodeKey];
1500
+ if(type === 'add'){
1501
+ let version = this.flowDefine.releaseVersion;
1502
+ currentNode = this.flowVersionNodeObj[version][this.startNodeKeyObj[version]];
1503
+ }
1504
+ return new Promise(resolve => {
1505
+ if(this.initFormInfo){
1506
+ let promise = this.initFormInfo(type,dataId,JSON.parse(currentNode.fieldOperate || "{}"),rowData);
1507
+ this.forceUpdateComponent && this.forceUpdateComponent();
1508
+ if(promise.then){
1509
+ promise.then(() => {
1510
+ resolve();
1511
+ })
1512
+ }else{
1513
+ resolve();
1514
+ }
1515
+ } else{
1516
+ resolve();
1517
+ }
1518
+ })
1519
+ }
1520
+ /**
1521
+ * 打开[修改和处理]窗口
1522
+ */
1523
+ initUpdateFlowForm(row, type) {
1524
+ this.currentRowData = row;
1525
+ this.currNodeName = 'noEnd';
1526
+ if (this.flowId.includes(',')) {
1527
+ this.flowDefine = this.flowDefineByFlowId[row.flowId];
1528
+ this.startNodeKeyObj = this.startNodeKeyObjByFlowId[row.flowId];
1529
+ this.flowVersionNodeObj = this.flowVersionNodeObjByFlowId[row.flowId];
1530
+ this.initFlowObj();
1531
+ // 加载工作流脚本与工作流事件规则
1532
+ // this.initFlowScript();
1533
+ // Object.assign(this.formInfo, this.formInfoByFlowId[row.flowId]);
1534
+ }
1535
+
1536
+ return new Promise(resolve => {
1537
+ let startNodeKey = this.startNodeKeyObj[row.version];
1538
+ this.initFieldStatus(row.nodeKey || startNodeKey,row.version).then(()=>{
1539
+ this.initFormInfoFunc(type,row).then(() => {
1540
+ this.currentStartUser = this.userMap[row.startUserId] || "";
1541
+ this.currentStartTime = row.startTime;
1542
+ this.currentInst = row;
1543
+
1544
+ Object.assign(this.formInfo, {
1545
+ dataId: row.dataId,
1546
+ opt: "update"
1547
+ });
1548
+ this.formBtnArr = this.getAddAndUpdateFormBtn(row);
1549
+ let result = {
1550
+ currentRowData: this.currentRowData,
1551
+ currNodeName : this.currNodeName,
1552
+ flowDefine: this.flowDefine,
1553
+ startNodeKeyObj: this.startNodeKeyObj,
1554
+ flowVersionNodeObj: this.flowVersionNodeObj,
1555
+ currentStartUser : this.currentStartUser,
1556
+ currentStartTime : this.currentStartTime,
1557
+ currentInst : this.currentInst,
1558
+ formInfo : this.formInfo,
1559
+ formBtnArr : this.formBtnArr,
1560
+ dataId : row.dataId
1561
+ }
1562
+ resolve(result);
1563
+ });
1564
+ })
1565
+ })
1566
+ }
1567
+
1568
+ /**
1569
+ * 打开[修改和处理]窗口
1570
+ */
1571
+ openUpdateFlowForm(row,executePosition) {
1572
+ return new Promise(resolve => {
1573
+ this.init().then(() => {
1574
+ if (this.flowId.includes(",")) {
1575
+ this.setFlowScript(row.flowId);
1576
+ }
1577
+ this.currentRowData = row;
1578
+ this.currNodeName = 'noEnd';
1579
+ let currentNodeObj1 = this.flowNodeIdToInfo[row.currentNode] ||{};
1580
+ let result = this.exeNewFlowEvent("editBefore",currentNodeObj1.nodeLinkId ||'');//新事件规则
1581
+ if(result === false && typeof result == "boolean"){
1582
+ return;
1583
+ }
1584
+ this.flowInstDataDialog = true;
1585
+ this.$flowDialog.fillFlowDialogParams({
1586
+ flowDefine: this.flowDefine,
1587
+ formInfo: this.formInfo
1588
+ });
1589
+ this.$flowDialog.operateDialog('flowInstDataDialog',true);
1590
+ this.initUpdateFlowForm(row, 'update').then(() =>{
1591
+ this.$this.$nextTick(() => {
1592
+ this.exeFlowEvent(executePosition,"afterClick",row.currentNode);
1593
+ let currentNodeObj = this.flowNodeIdToInfo[row.currentNode] ||{};
1594
+ if(currentNodeObj.openEvent === '1'){ //开启事件
1595
+ this.exeNewFlowEvent("editAfter",currentNodeObj.nodeLinkId ||'');//新事件规则
1596
+ }
1597
+ let result = {
1598
+ currentRowData: this.currentRowData,
1599
+ currNodeName : this.currNodeName,
1600
+ flowDefine: this.flowDefine,
1601
+ startNodeKeyObj: this.startNodeKeyObj,
1602
+ flowVersionNodeObj: this.flowVersionNodeObj,
1603
+ currentStartUser : this.currentStartUser,
1604
+ currentStartTime : this.currentStartTime,
1605
+ currentInst : this.currentInst,
1606
+ formInfo : this.formInfo,
1607
+ formBtnArr : this.formBtnArr
1608
+ }
1609
+ this.$flowDialog.fillFlowDialogParams(result);
1610
+ resolve(result);
1611
+ })
1612
+ });
1613
+ });
1614
+ });
1615
+ }
1616
+
1617
+ /**
1618
+ * 打开[查看]窗口
1619
+ */
1620
+ openViewFlowForm(row) {
1621
+ return new Promise(resolve => {
1622
+ this.init().then(() => {
1623
+ this.currentRowData = row;
1624
+ let startNodeKey = this.startNodeKeyObj[row.version];
1625
+ if (row.currentNodeName === "结束"){
1626
+ this.currNodeName = "end";
1627
+ }
1628
+ this.initFieldStatus(row.nodeKey || startNodeKey,row.version,row.flowStatus).then(() =>{
1629
+ this.$flowDialog.fillFlowDialogParams({
1630
+ flowDefine: this.flowDefine,
1631
+ formInfo: this.formInfo
1632
+ });
1633
+ this.flowInstDataDialog = true;
1634
+ this.$flowDialog.operateDialog('flowInstDataDialog',true);
1635
+ this.$this.$nextTick(() => {
1636
+ this.initFormInfoFunc('view',row).then(() => {
1637
+ this.currentStartUser = this.userMap[row.startUserId] || "";
1638
+ this.currentStartTime = row.startTime;
1639
+ this.currentInst = row;
1640
+
1641
+ Object.assign(this.formInfo, {
1642
+ dataId: row.dataId,
1643
+ opt: "view",
1644
+ });
1645
+ this.formBtnArr = this.getViewFormBtn(row);
1646
+ let result = {
1647
+ currentRowData: this.currentRowData,
1648
+ currNodeName : this.currNodeName,
1649
+ currentStartUser : this.currentStartUser,
1650
+ currentStartTime : this.currentStartTime,
1651
+ currentInst : this.currentInst,
1652
+ formInfo : this.formInfo,
1653
+ formBtnArr : this.formBtnArr,
1654
+ }
1655
+ this.$flowDialog.fillFlowDialogParams(result);
1656
+ resolve(result);
1657
+ });
1658
+ });
1659
+ });
1660
+ });
1661
+ })
1662
+ }
1663
+
1664
+ // 打开前方法end
1665
+
1666
+
1667
+
1668
+ /**
1669
+ * 存草稿
1670
+ */
1671
+ saveDraft() {
1672
+ // let loading = this.$this.$loading({
1673
+ // lock: true,
1674
+ // spinner: 'el-icon-loading',
1675
+ // background: 'rgba(0, 0, 0, 0.7)'
1676
+ // })
1677
+
1678
+ this.saveDataFunc('draft').then(resData => {
1679
+ this.tabCrudSearch && this.tabCrudSearch(); // todo 回调刷新方法,初始化置入即可
1680
+
1681
+ this.flowInstDataDialog = false;
1682
+ this.$flowDialog.operateDialog('flowInstDataDialog',false);
1683
+ if (resData.flowInstId) {
1684
+ this.$this.$message({type: "success", message: "保存成功!"});
1685
+ if (this.getFlowBatchDialog && this.getFlowBatchDialog()) {//批量处理 需处理tab页
1686
+ this.batchSaveDraft();
1687
+ }
1688
+ } else {
1689
+ this.$this.$message({type: "error", message: "保存失败!"});
1690
+ }
1691
+ // loading && loading.close();
1692
+ this.currentInst={};
1693
+ });
1694
+ }
1695
+
1696
+ /**
1697
+ * 批量处理存草稿
1698
+ */
1699
+ batchSaveDraft() {
1700
+ this.batchTabRemove(this.currentInst.dataId);
1701
+ }
1702
+
1703
+ /**
1704
+ * 回退到上一步
1705
+ */
1706
+ backToPrevious() {
1707
+ let loading = this.$this.$loading({
1708
+ lock: true,
1709
+ text: '正在退回,请稍后....',
1710
+ spinner: 'el-icon-loading',
1711
+ background: 'rgba(0, 0, 0, 0.7)'
1712
+ })
1713
+ let currentInst = this.currentInst;
1714
+ this.$this.$prompt('退回备注', '确定要退回至上一个节点吗?', {
1715
+ confirmButtonText: '确定',
1716
+ cancelButtonText: '取消',
1717
+ inputType: 'textarea',
1718
+ }).then(({ value }) => {
1719
+ this.$this.saspFlowAxios.post(this.$this.api.plFlowInst.backRewrite,
1720
+ {
1721
+ taskId:currentInst.taskId,
1722
+ remarks: value
1723
+ }).then(res => {
1724
+ if (res && res.data && res.data.operateSuccess) {
1725
+ this.$this.$message({type: "success", message: "退回成功!"});
1726
+ this.initTabNum && this.initTabNum();
1727
+ if (this.getFlowBatchDialog && this.getFlowBatchDialog()) {
1728
+ this.batchTabRemove(this.currentInst.dataId);
1729
+ } else {
1730
+ this.tabCrudSearch && this.tabCrudSearch();
1731
+ }
1732
+ } else {
1733
+ this.$this.$message({type: "error", message: res.data.operateMessage});
1734
+ }
1735
+ loading && loading.close();
1736
+ this.flowInstDataDialog = false;
1737
+ this.$flowDialog.operateDialog('flowInstDataDialog',false);
1738
+ })
1739
+ }).catch(() => {
1740
+ loading && loading.close();
1741
+ });
1742
+ }
1743
+
1744
+
1745
+ /**
1746
+ * 取回
1747
+ */
1748
+ getBackPrevious() {
1749
+ let loading = this.$this.$loading({
1750
+ lock: true,
1751
+ text: '正在取回,请稍后....',
1752
+ spinner: 'el-icon-loading',
1753
+ background: 'rgba(0, 0, 0, 0.7)'
1754
+ })
1755
+ let currentInst = this.currentInst;
1756
+ this.$this.$confirm('确定要取回吗?', '警告', {
1757
+ confirmButtonText: '确定',
1758
+ cancelButtonText: '取消',
1759
+ }).then(() => {
1760
+ this.$this.saspFlowAxios.post(this.$this.api.plFlowInst.getBackRewrite,
1761
+ {
1762
+ flowInstId: currentInst.flowInstId,
1763
+ }).then(res => {
1764
+ if (res && res.data && res.data.operateSuccess) {
1765
+ this.$this.$message({type: "success", message: "取回成功!"});
1766
+ this.initTabNum && this.initTabNum();
1767
+ if (this.getFlowBatchDialog && this.getFlowBatchDialog()) {
1768
+ this.batchTabRemove(this.currentInst.dataId);
1769
+ } else {
1770
+ this.tabCrudSearch && this.tabCrudSearch();
1771
+ }
1772
+ } else {
1773
+ this.$this.$message({type: "error", message: res.data.operateMessage});
1774
+ }
1775
+ loading && loading.close();
1776
+ this.flowInstDataDialog = false;
1777
+ this.$flowDialog.operateDialog('flowInstDataDialog',false);
1778
+ })
1779
+ }).catch(() => {
1780
+ loading && loading.close();
1781
+ });
1782
+ }
1783
+
1784
+ /**
1785
+ * 打开退回节点窗口
1786
+ */
1787
+ retSpecified(currentInst){
1788
+ let flowInstId = currentInst.flowInstId;
1789
+ this.$this.saspFlowAxios.post(this.$this.api.plFlowInst.getBackData,{"flowInstId":flowInstId}).then(res => {
1790
+ this.backNodeArr = [];
1791
+ if(res.data.operateSuccess){
1792
+ let result = res.data.resultObject || [];
1793
+ if(result.length == 0){
1794
+ this.$this.$message.warning("没有可以退回的节点!");
1795
+ return;
1796
+ }
1797
+ let arr = [];
1798
+ result.forEach((item,index) =>{
1799
+ // if(index != res.data.resultObject.length -1){
1800
+ // this.backNodeArr.push(item);
1801
+ // }
1802
+ if(item["endTimeNull"]){
1803
+ arr.push(item);
1804
+ }else{
1805
+ this.backNodeArr.push(item);
1806
+ }
1807
+ });
1808
+ this.backNodeArr = this.backNodeArr.concat(arr);
1809
+ this.backNodeArr.splice(this.backNodeArr.length - 1,1);
1810
+ this.isDisabled2 = true;
1811
+ this.backMsg = "";
1812
+ this.backNodeId = "";
1813
+ this.backDialogVisible = true;
1814
+ this.$flowDialog.operateDialog('backDialogVisible',true);
1815
+ }
1816
+ })
1817
+ }
1818
+
1819
+ /**
1820
+ * 恢复方法
1821
+ */
1822
+ restoreFlow() {
1823
+ this.$this.saspFlowAxios.post(this.$this.api.plFlowInst.stopFlow, {
1824
+ instId: this.currentInst.flowInstId, type: "1",
1825
+ procInstId: this.currentInst.linkProcId,
1826
+ taskId: this.currentInst.taskId
1827
+ }).then(res => {
1828
+ if (res && res.data) {
1829
+ if (res.data.operateSuccess) {
1830
+ this.$this.$message({type: "success", message: "恢复成功!"});
1831
+ this.flowInstDataDialog = false;
1832
+ this.$flowDialog.operateDialog('flowInstDataDialog',false);
1833
+ if (this.getFlowBatchDialog && this.getFlowBatchDialog()) {
1834
+ this.batchTabRemove(this.currentInst.dataId);
1835
+ } else {
1836
+ this.tabCrudSearch && this.tabCrudSearch();
1837
+ }
1838
+ this.initTabNum && this.initTabNum();
1839
+ } else {
1840
+ this.$this.$message({type: "error", message: res.data.operateMessage});
1841
+ }
1842
+ }
1843
+ })
1844
+ }
1845
+
1846
+ /**
1847
+ * 打开流转记录窗口
1848
+ * @param row 流程行数据
1849
+ */
1850
+ openFlowRecord(row) {
1851
+ let arr = ["2", "3", "4"]; // 旧版本的已办结已撤销以及已中止数据通过旧版接口查询流转记录
1852
+ if (arr.indexOf(row.flowStatus) > -1 && row.isOldData === "1") {
1853
+ this.flowRecordObj = {instId: row.flowInstId || "", oldDialogVisible: true};
1854
+ } else {
1855
+ this.flowRecordObj = {instId: row.flowInstId || "", dialogVisible: true};
1856
+ }
1857
+ this.$flowDialog.fillFlowDialogParams({
1858
+ flowRecordObj: this.flowRecordObj
1859
+ });
1860
+ }
1861
+
1862
+ openFlowChart(row) {
1863
+ let flowId = "";
1864
+ let instId = "";
1865
+ let linkProcId = "";
1866
+ let isRelease = "";
1867
+ if (row) {
1868
+ flowId = row.flowId;
1869
+ instId = row.flowInstId;
1870
+ linkProcId = row.linkProcId;
1871
+ isRelease = row.isRelease;
1872
+ }
1873
+ this.flowChartObj = {flowId: flowId,instId: instId,linkProcId:linkProcId,isRelease:isRelease, dialogVisible: true};
1874
+ this.$flowDialog.fillFlowDialogParams({
1875
+ flowChartObj: this.flowChartObj,
1876
+ })
1877
+ }
1878
+
1879
+ // end of button methods 按钮方法结束
1880
+
1881
+ // 功能区域,用于作为一些方法处理数据
1882
+
1883
+ // 自定义按钮窗口回调函数
1884
+ openDiyButtonEvent(type,row, button) {
1885
+ let formData = {};
1886
+ if(this.getFormInfo){
1887
+ formData = this.getFormInfo();
1888
+ }
1889
+ if(type === 'list') {
1890
+ this.execDiyBtnScripts(type,row,button.funcBody);
1891
+ }else {
1892
+ this.execDiyBtnScripts(type,formData,button.funcBody);
1893
+ }
1894
+ }
1895
+
1896
+ judeDiyButton(tabActive,button) {
1897
+ if(tabActive === 'pending') {
1898
+ return button.position === 'table' && button.nodeId === this.currentInst.currentNode;
1899
+ }
1900
+ return button.position === 'table' && button.buttonSign.indexOf(tabActive) > -1;
1901
+ }
1902
+
1903
+ execDiyBtnScripts(type,data,fnBody) {
1904
+ try {
1905
+ fnBody = this.replaceUrl(fnBody);
1906
+ fnBody = fnBody.replace(/\\'/g, "'").replace(/&quot;/g, "\"");
1907
+ if(type === 'list') {
1908
+ new Function('vm,rowData,Ajax', fnBody)(this.$this,data,AjaxUtil);
1909
+ }else {
1910
+ new Function('vm,formData,Ajax', fnBody)(this.$this,data,AjaxUtil);
1911
+ }
1912
+ } catch (e) {
1913
+ console.log("自定义按钮事件执行错误!", e);
1914
+ }
1915
+ }
1916
+
1917
+ /**
1918
+ * 获取[添加、修改和处理]的操作按钮
1919
+ */
1920
+ getAddAndUpdateFormBtn(row) {
1921
+ //走版本
1922
+ let arrNodeFormBtns = [];
1923
+ if(row.version){
1924
+ arrNodeFormBtns = this.nodeFormBtnObj[(this.flowVersionNodeObj[row.version][row.nodeKey || this.startNodeKeyObj[row.version]] || {}).id];
1925
+ }else {
1926
+ arrNodeFormBtns = this.nodeFormBtnObj[this.flowVersionNodeObj[this.flowDefine.releaseVersion][this.startNodeKeyObj[this.flowDefine.releaseVersion]].id];
1927
+ }
1928
+ let hideBtnTypes = new Set(["getBack","stopped"]);
1929
+ if (this.tabActive == "draft") {
1930
+ hideBtnTypes.add("flowRecord");
1931
+ hideBtnTypes.add("record");
1932
+ }else if(this.tabActive == "pending"){//待处理
1933
+ hideBtnTypes.add("cancel");
1934
+ if(row.operateStatus=='1'||row.operateStatus=='3'){//如果是加签转签 不需要部分按钮
1935
+ hideBtnTypes.add("retSpecified");
1936
+ hideBtnTypes.add("back");
1937
+ hideBtnTypes.add("completeSign");
1938
+ hideBtnTypes.add("turnSign");
1939
+ }
1940
+ }
1941
+
1942
+ return this.formatterFormBtnByHideBtnTypes(arrNodeFormBtns, hideBtnTypes);
1943
+ }
1944
+
1945
+ /**
1946
+ * 根据隐藏按钮类型格式化按钮信息
1947
+ */
1948
+ formatterFormBtnByHideBtnTypes(arrFormBtns, hideBtnTypes) {
1949
+ let arrResults = [];
1950
+ arrFormBtns.forEach(data => {
1951
+ let objTmp = Object.assign({}, data);
1952
+ hideBtnTypes.has(data.btnType) && (objTmp.show = false);
1953
+ if(this.tabActive == "discontinue" && data.btnType == "restore" && !hideBtnTypes.has(data.btnType)){
1954
+ objTmp.show = true;
1955
+ }
1956
+ if(this.tabActive == "processed" && data.btnType == "getBack" && !hideBtnTypes.has(data.btnType)){
1957
+ objTmp.show = true;
1958
+ }
1959
+ if(this.tabActive == "processed" && data.btnType == "cancel" && !hideBtnTypes.has(data.btnType)){
1960
+ objTmp.show = true;
1961
+ }
1962
+ arrResults.push(objTmp);
1963
+ });
1964
+ return arrResults;
1965
+ }
1966
+
1967
+ /**
1968
+ * 获取[查看]的操作按钮
1969
+ */
1970
+ getViewFormBtn(row) {
1971
+ //走版本
1972
+ let arrNodeFormBtns = [];
1973
+ if(row.version){
1974
+ arrNodeFormBtns = this.nodeFormBtnObj[(this.flowVersionNodeObj[row.version][row.nodeKey || this.startNodeKeyObj[row.version]] || {}).id];
1975
+ }else {
1976
+ arrNodeFormBtns = this.nodeFormBtnObj[this.flowVersionNodeObj[this.flowDefine.releaseVersion][this.startNodeKeyObj[this.flowDefine.releaseVersion]].id];
1977
+ }
1978
+ let hideBtnTypes = new Set(["getBack", "cancel", "restore"]);
1979
+ if (this.tabActive == "processed") { // 已处理
1980
+
1981
+ // 上个节点的处理可以取回(已开启按钮的情况下)
1982
+ if ((row.beforeDealer || "").split(",").indexOf(this.loginUser.id) > -1) {
1983
+ hideBtnTypes.delete("getBack");
1984
+ }
1985
+
1986
+ // 流程的发起人可以撤销(已开启按钮的情况下)
1987
+ if (row.startUserId == this.loginUser.id) {
1988
+ // hideBtnTypes.delete("cancel");
1989
+ }
1990
+ //被挂起数据只有查看按钮
1991
+ if(row.hangUp == '1'){
1992
+ hideBtnTypes.add("getBack");
1993
+ hideBtnTypes.add("cancel");
1994
+ hideBtnTypes.add("restore");
1995
+ }
1996
+ } else if (this.tabActive == "discontinue" && row.discontinueUserId == this.loginUser.id) { // 已中止
1997
+ // 当前登陆用户是中止人才显示恢复按钮(已开启按钮的情况下)
1998
+ hideBtnTypes.delete("restore");
1999
+ }
2000
+
2001
+ return this.formatterFormBtnByHideBtnTypes(arrNodeFormBtns, hideBtnTypes);
2002
+ }
2003
+
2004
+ initFieldStatus(nodeKey,version,flowStatus) {
2005
+ return new Promise(resolve => {
2006
+ resolve();
2007
+ });
2008
+ }
2009
+
2010
+ replaceUrl(value){
2011
+ if(window.ADMIN_URL && (value.indexOf("/admin/") > -1 || value.indexOf("/oaadmin/") > -1)){
2012
+ if(value.indexOf("/admin/") > -1){
2013
+ value = this.$this.platStringUtil.replaceAll(value,"/admin/", window.ADMIN_URL + "/");
2014
+ }else{
2015
+ value = this.$this.platStringUtil.replaceAll(value,"/oaadmin/",window.ADMIN_URL + "/");
2016
+ }
2017
+ }
2018
+ if(window.FLOW_URL && (value.indexOf("/flow/") > -1 || value.indexOf("/oaflow/") > -1)){
2019
+ if(value.indexOf("/flow/") > -1){
2020
+ value = this.$this.platStringUtil.replaceAll(value,"/flow/", window.FLOW_URL + "/");
2021
+ }else{
2022
+ value = this.$this.platStringUtil.replaceAll(value,"/oaflow/",window.FLOW_URL + "/");
2023
+ }
2024
+ }
2025
+ if(window.FORM_RENDER_URL && (value.indexOf("/form/") > -1|| value.indexOf("/oaform/") > -1)){
2026
+ if(value.indexOf("/form/") > -1){
2027
+ value = this.$this.platStringUtil.replaceAll(value,"/form/", window.FORM_RENDER_URL + "/");
2028
+ }else{
2029
+ value = this.$this.platStringUtil.replaceAll(value,"/oaform/",window.FORM_RENDER_URL + "/");
2030
+ }
2031
+ }
2032
+ if(window.OA_URL && (value.indexOf("/project/") > -1 || value.indexOf("/oaproject/") > -1)){
2033
+ if(value.indexOf("/project/") > -1){
2034
+ value = this.$this.platStringUtil.replaceAll(value,"/project/", window.OA_URL + "/");
2035
+ }else{
2036
+ value = this.$this.platStringUtil.replaceAll(value,"/oaproject/",window.OA_URL + "/");
2037
+ }
2038
+ }
2039
+ value = this.$this.platStringUtil.replaceAll(value,"window.JAVA_URL","''");
2040
+ value = this.$this.platStringUtil.replaceAll(value,"JAVA_URL","''");
2041
+ value = this.$this.platStringUtil.replaceAll(value,"window.baseUrl","''");
2042
+ value = this.$this.platStringUtil.replaceAll(value,"baseUrl","''");
2043
+ return value;
2044
+ }
2045
+
2046
+ /**
2047
+ * 格式化表单操作按钮
2048
+ */
2049
+ formatterFormButton(formButton) {
2050
+
2051
+ let formBtnObj = {};
2052
+ let formBtnArr = [];
2053
+
2054
+ for (let [key, data] of Object.entries(this.formBtnObjDefault)) {
2055
+ formBtnObj[key] = Object.assign({btnType: key}, data);
2056
+ }
2057
+
2058
+ let objTmp;
2059
+ (formButton || []).forEach(data => {
2060
+ if (formBtnObj[data.type]) {
2061
+ objTmp = formBtnObj[data.type];
2062
+ objTmp.show = (data.isUse != '0');
2063
+ objTmp.text = data.showName || objTmp.text;
2064
+ }
2065
+ });
2066
+
2067
+ for (let [key, data] of Object.entries(formBtnObj)) {
2068
+ formBtnArr.push(data);
2069
+ }
2070
+ return formBtnArr;
2071
+ }
2072
+
2073
+ sortButtonArr(formButton) {
2074
+ let objBtnOrder = {
2075
+ "saveDraft": 1,
2076
+ "nextStep": 2,
2077
+ "completeSign": 3,
2078
+ "turnSign": 4,
2079
+ "retSpecified": 5,
2080
+ "back": 6,
2081
+ "stopped": 7,
2082
+ "close": 8
2083
+ };
2084
+ (formButton || []).forEach(data => {
2085
+ data.order = objBtnOrder[data.type] || data.order;
2086
+ });
2087
+ return formButton;
2088
+ }
2089
+
2090
+ // 获取流程用户数据
2091
+ initUserData(){
2092
+ // 先载入系统接口数据
2093
+ let userArr = this.$this.INTER_CACHE.getUserArr();
2094
+ if(userArr && userArr.length > 0){
2095
+ this.userMap = this.$this.INTER_CACHE.getUserMap();
2096
+ this.userArr = userArr;
2097
+ }else{
2098
+ this.$this.saspFlowAxios.post(this.$this.api.plFlowInterface.find,{sysInterName:'userData',interType:'sys',interStatus:'1'}).then(res => {
2099
+ if((res.data || []).length === 0){
2100
+ return;
2101
+ }
2102
+ let dataInter = res.data[0];
2103
+ this.loadUserData(dataInter);
2104
+ })
2105
+ }
2106
+ }
2107
+ loadUserData(dataInter){
2108
+ this.$this.saspFlowAxios.post(this.$this.api.plFlowDomain.findRealUrl,{status:'1'}).then(res => {
2109
+ (res.data || []).forEach(item => {
2110
+ this.doMainDatasObj[item.id] = item.domainUrl;
2111
+ })
2112
+ // 解析用户数据
2113
+ this.analyseRequest(dataInter).then(data => {
2114
+ let arr = [];
2115
+ let userIdArr = [];
2116
+ data.forEach(item => {
2117
+ item.dataUserId = item[dataInter["idCode"] || "userId"];
2118
+ item.dataKey = item.dataUserId;
2119
+ item.flowDataType = "user";
2120
+ item.dataLabel = item[dataInter["showCode"] || "userName"];
2121
+ item.dataOrgId = item[dataInter["orgCode"] || "orgId"];
2122
+ item.dataPosId = item[dataInter["posCode"] || "posId"];
2123
+ if(item.dataOrgId){
2124
+ item.dataParentId = item.orgId;
2125
+ }
2126
+ if(item.dataPosId){
2127
+ item.dataParentId = item.posId;
2128
+ }
2129
+ if(userIdArr.indexOf(item.dataKey) === -1){
2130
+ arr.push({
2131
+ id:item.dataKey,
2132
+ userName:item.dataLabel
2133
+ })
2134
+ userIdArr.push(item.dataKey);
2135
+ }
2136
+ })
2137
+ this.userArr = arr;
2138
+ this.$this.INTER_CACHE.setUserArr(arr);
2139
+ this.$this.userMap = this.$this.INTER_CACHE.getUserMap();
2140
+ })
2141
+ })
2142
+ }
2143
+ analyseRequest(dataInter){
2144
+ return new Promise(resolve => {
2145
+ let domainUrl = this.doMainDatasObj[dataInter.domainId] || "";
2146
+ let url = domainUrl + dataInter.requestUrl;
2147
+ let requestParam = JSON.parse(dataInter.requestParam || "[]");
2148
+ let obj = {};
2149
+ requestParam.forEach(item => {
2150
+ if(!item.key){
2151
+ return;
2152
+ }
2153
+ obj[item.key] = item.value || ""; // 注意这里要replace ${userCode}
2154
+ })
2155
+ if(dataInter.requestType === 'post'){
2156
+ this.$this.saspFlowAxios.post(url,obj).then(res => {
2157
+ this.$this.INTER_CACHE.setCacheInfo(dataInter.sysInterName,res.data);
2158
+ resolve(res.data || []);
2159
+ })
2160
+ }else{
2161
+ let params = "";
2162
+ let arr = []
2163
+ Object.keys(obj).forEach(key => {
2164
+ arr.push(key + "=" + obj[key]);
2165
+ })
2166
+ params = arr.join("&");
2167
+ if(params){
2168
+ if(url.indexOf("?") > -1){
2169
+ url += "&" + params;
2170
+ }else{
2171
+ url += "?" + params;
2172
+ }
2173
+ }
2174
+ this.$this.saspFlowAxios(url).then(res => {
2175
+ this.$this.INTER_CACHE.setCacheInfo(dataInter.sysInterName,res.data);
2176
+ resolve(res.data || []);
2177
+ })
2178
+ }
2179
+ })
2180
+ }
2181
+
2182
+ open(dataId,type,callback){
2183
+ if(!this.tableviewId){
2184
+ this.$this.$message.error("请先设置tableviewId");
2185
+ return;
2186
+ }
2187
+ this.init().then(() => {
2188
+ this.formInfo["dataId"] = dataId;
2189
+ this.$flowDialog.fillFlowDialogParams({
2190
+ formId: this.formId,
2191
+ tableviewId: this.tableviewId,
2192
+ dataId: dataId || "",
2193
+ formInfo: this.formInfo
2194
+ });
2195
+ if(dataId){
2196
+ this.$this.saspFlowAxios.post(this.$this.api.plFlowInst.getFlowInstByFlowDataId,{flowId:this.flowId,dataId:dataId}).then(res => {
2197
+ if(!res.data){
2198
+ this.$this.$message.error("未获取到此流程数据!");
2199
+ return;
2200
+ }
2201
+ let rowData = res.data || {};
2202
+ if(type !== "view" && rowData.operateAuth === "0"){
2203
+ console.log("当前登录用户无此流程数据操作权限,已自动切换为查看!");
2204
+ type = "view";
2205
+ }
2206
+ if(rowData.linkProcId){
2207
+ this.tabActive = "pending";
2208
+ }else{
2209
+ this.tabActive = "draft";
2210
+ }
2211
+ this.currentInst = rowData;
2212
+ if(type === "view"){
2213
+ this.openViewFlowForm(rowData).then(() => {
2214
+ callback && callback(this,this.$this);
2215
+ })
2216
+ }else{
2217
+ let executePosition = "update";
2218
+ if(rowData.linkProcId){
2219
+ executePosition = "handle";
2220
+ }
2221
+ this.openUpdateFlowForm(rowData,executePosition).then(() => {
2222
+ callback && callback(this,this.$this);
2223
+ })
2224
+ }
2225
+ });
2226
+ }else{
2227
+ this.currentInst = {};
2228
+ this.tabActive = "draft";
2229
+ this.openAddFlowForm().then(() => {
2230
+ callback && callback(this,this.$this);
2231
+ })
2232
+ }
2233
+ })
2234
+ }
2235
+
2236
+ openFlowDialog(args){
2237
+ this.$flowDialog.openFlowDialog(args);
2238
+ }
2239
+
2240
+ openRecord(flowId,dataId){
2241
+ this.$this.saspFlowAxios.post(this.$this.api.plFlowInst.getFlowInstByFlowDataId,{flowId:(flowId || this.flowId),dataId:dataId}).then(res => {
2242
+ if (!res.data) {
2243
+ this.$this.$message.error("未获取到此流程数据!");
2244
+ return;
2245
+ }
2246
+ let currentInst = res.data || {};
2247
+ this.openFlowRecord(currentInst);
2248
+ });
2249
+ }
2250
+
2251
+ openChart(flowId,dataId){
2252
+ if(dataId){
2253
+ this.$this.saspFlowAxios.post(this.$this.api.plFlowInst.getFlowInstByFlowDataId,{flowId:flowId || this.flowId,dataId:dataId}).then(res => {
2254
+ if (!res.data) {
2255
+ this.$this.$message.error("未获取到此流程数据");
2256
+ return;
2257
+ }
2258
+ let currentInst = res.data || {};
2259
+ this.openFlowChart(currentInst);
2260
+ });
2261
+ }else{
2262
+ this.openFlowChart({flowId:(flowId || this.flowId)});
2263
+ }
2264
+ }
2265
+ }
2266
+
2267
+ export default {
2268
+ workflow: WorkflowEngine
2269
+ }