sasp-flow-render 1.1.32-decoupling → 1.1.33

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