sasp-flow-render 1.1.33 → 1.1.36-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.
@@ -36,7 +36,7 @@
36
36
  </div>
37
37
  <div style="height: 100%" v-else>
38
38
  <el-tabs v-model="tabActive" v-if="initSuccess" type="border-card" @tab-click="tabClick"
39
- style="width: 100%;height: 100%;">
39
+ style="width: 100%;height: 100%;box-sizing: border-box">
40
40
  <el-tab-pane name="draft" v-if="tabShow('draft')" style="height: 100%;" :lazy="true">
41
41
  <span slot="label">
42
42
  <i v-if="tabTypeObj['showTabIcon']" :class="tabTypeObj['draft'].iconShow"></i>
@@ -240,57 +240,42 @@
240
240
  </div>
241
241
 
242
242
  <!--处理、修改、查看流程信息弹窗-->
243
- <el-dialog :close-on-click-modal=false top="5vh" width="90%" height="90%" :visible.sync="flowInstDataDialog" append-to-body
244
- custom-class="flowInstTabDialog">
245
- <span slot="title" class="dialog-title">
246
- <span>{{flowFormTitle}}</span>
247
- </span>
248
- <template v-if="flowInstDataDialog">
249
- <slot name="formInfo"></slot>
250
- </template>
251
- <!-- <table-form-render ref="flowInstDataInfo"-->
252
- <!-- :tableview-id="formInfo.tableViewId"-->
253
- <!-- :data-id="formInfo.dataId"-->
254
- <!-- :form-id="formInfo.formId"-->
255
- <!-- :list-view-id="formInfo.listViewId"-->
256
- <!-- :flow-field-status="formInfo.fieldStatus"-->
257
- <!-- :form-operate="formInfo.opt"-->
258
- <!-- :is-flow=true-->
259
- <!-- :use-load-self=true-->
260
- <!-- :flow-field-default="formInfo.fieldDefaultVal"-->
261
- <!-- :flow-field-default-change-num="formInfo.fieldDefaultValChangeNum"-->
262
- <!-- :flow-field-default-from-form="formInfo.flowFieldDefaultFromForm"-->
263
- <!-- :form-field-obj="formFieldObj"-->
264
- <!-- :formPrintVisble="currNodeName">-->
265
- <!-- </table-form-render>-->
266
-
267
- <div slot="footer" style="height:31px;" class="dialog-footer">
268
- <div v-if="!formSearchObj.isNewSelectBatchDeal">
269
- <el-button
270
- v-for="button in Object.values(diyButtonsObj)"
271
- :key="button.id" size="small" :type="button.buttonColor" :icon="button.buttonIcon"
272
- v-if="judeDiyButton(tabActive,button)"
273
- @click="openDiyButtonEvent('table','', button)">{{button.showButtonName}}
274
- </el-button>
275
- <el-button v-for="btn in formBtnArr" @click="btn.method" :disabled="isDisabled[btn.btnType]?false:true"
276
- v-show="btn.show && ((formInfo.opt != 'view') || (formInfo.opt=='view' && btn.isView))"
277
- :key="btn.btnType"
278
- :type="btn.type"
279
- :icon="btn.icon"
280
- size="small">
281
- {{btn.text}}
282
- </el-button>
283
- </div>
284
- <div v-else>
285
- <el-button v-for="btn in formNewBtnArr" @click="btn.method"
286
- :key="btn.btnType"
287
- :type="btn.type"
288
- :icon="btn.icon"
289
- size="small">{{btn.text}}
290
- </el-button>
291
- </div>
292
- </div>
293
- </el-dialog>
243
+ <!-- <el-dialog :close-on-click-modal=false top="5vh" width="90%" height="90%" :visible.sync="flowInstDataDialog" append-to-body-->
244
+ <!-- custom-class="flowInstTabDialog">-->
245
+ <!-- <span slot="title" class="dialog-title">-->
246
+ <!-- <span>{{flowFormTitle}}</span>-->
247
+ <!-- </span>-->
248
+ <!-- <template v-if="flowInstDataDialog">-->
249
+ <!-- <slot name="formInfo"></slot>-->
250
+ <!-- </template>-->
251
+
252
+ <!-- <div slot="footer" style="height:31px;" class="dialog-footer">-->
253
+ <!-- <div v-if="!formSearchObj.isNewSelectBatchDeal">-->
254
+ <!-- <el-button-->
255
+ <!-- v-for="button in Object.values(diyButtonsObj)"-->
256
+ <!-- :key="button.id" size="small" :type="button.buttonColor" :icon="button.buttonIcon"-->
257
+ <!-- v-if="judeDiyButton(tabActive,button)"-->
258
+ <!-- @click="openDiyButtonEvent('table','', button)">{{button.showButtonName}}-->
259
+ <!-- </el-button>-->
260
+ <!-- <el-button v-for="btn in formBtnArr" @click="btn.method" :disabled="isDisabled[btn.btnType]?false:true"-->
261
+ <!-- v-show="btn.show && ((formInfo.opt != 'view') || (formInfo.opt=='view' && btn.isView))"-->
262
+ <!-- :key="btn.btnType"-->
263
+ <!-- :type="btn.type"-->
264
+ <!-- :icon="btn.icon"-->
265
+ <!-- size="small">-->
266
+ <!-- {{btn.text}}-->
267
+ <!-- </el-button>-->
268
+ <!-- </div>-->
269
+ <!-- <div v-else>-->
270
+ <!-- <el-button v-for="btn in formNewBtnArr" @click="btn.method"-->
271
+ <!-- :key="btn.btnType"-->
272
+ <!-- :type="btn.type"-->
273
+ <!-- :icon="btn.icon"-->
274
+ <!-- size="small">{{btn.text}}-->
275
+ <!-- </el-button>-->
276
+ <!-- </div>-->
277
+ <!-- </div>-->
278
+ <!-- </el-dialog>-->
294
279
 
295
280
  <!--批量处理信息弹窗-->
296
281
  <el-dialog :close-on-click-modal=false top="5vh" width="90%" height="90%" :visible.sync="flowBatchPendingDialog"
@@ -344,177 +329,6 @@
344
329
  <el-button size="small" @click="flowBatchSelectPendingDialog = false">关 闭</el-button>
345
330
  </div>
346
331
  </el-dialog>
347
-
348
- <!--流程下一步处理人选择弹窗-->
349
- <el-dialog :close-on-click-modal=false style="font-family: '微软雅黑'" :title="'下一步' + (nextNodeName ? (isProceedNext?' -> ' + nextNodeName:'->等待他人处理') : '')"
350
- :top="nextNode.nextType != 'inclusiveGateway' ? '20vh': '10vh'" append-to-body
351
- width="500px" :visible.sync="nextSteptUserDialog" @closed="closeNextSteptUserDialog">
352
- <el-form label-width="100px" size="small" v-if="nextNode.nodeType != 'EndEvent'">
353
- <fieldset v-if="nextNode.nextType == 'inclusiveGateway'"
354
- v-for="(itemAll,index) in (nextNode.result || [])" :key="index">
355
- <legend>
356
- {{itemAll.nodeName}}
357
- </legend>
358
- <el-form-item label="" label-width="0">
359
- <el-select v-model="chooseNextUserIdObj[itemAll.nodeKey]" v-if="itemAll.type != 'all'"
360
- :multiple="itemAll.mulitiChooseUser" style="width:100%">
361
- <el-option v-for="item in itemAll.userArr" :key="item.id" :value="item.id"
362
- :label="item.userName"></el-option>
363
- </el-select>
364
- <div @click="chooseUser(itemAll.nodeKey)">
365
- <el-input v-model="chooseNextUserNameObj[itemAll.nodeKey]" v-if="itemAll.type == 'all'"
366
- readonly>
367
- <el-button slot="append" icon="el-icon-search"></el-button>
368
- </el-input>
369
- </div>
370
- </el-form-item>
371
- </fieldset>
372
- <el-form-item label="下一步执行人" v-if="nextNode.nextType != 'inclusiveGateway' && isProceedNext">
373
- <el-select v-model="chooseNextUserId" v-if="nextSteptUserType != 'all' && nextSteptUserDialog"
374
- :multiple="mulitiChooseUser" filterable style="width:100%">
375
- <el-option v-for="item in nextSteptUserArr" :key="item.id" :value="item.id"
376
- :label="item.userName"></el-option>
377
- </el-select>
378
- <div @click="chooseUser()">
379
- <el-input v-model="chooseNextUserName" v-if="nextSteptUserType == 'all'" readonly>
380
- <el-button slot="append" icon="el-icon-search"></el-button>
381
- </el-input>
382
- </div>
383
- </el-form-item>
384
- <fieldset v-if="nextNode.nextType == 'inclusiveGateway'">
385
- <legend>
386
- {{'附加说明'}}
387
- </legend>
388
- <el-form-item label="" label-width="0">
389
- <el-input type="textarea" :rows="5" v-model="description"></el-input>
390
- </el-form-item>
391
- </fieldset>
392
- <el-form-item label="附加说明" v-if="nextNode.nextType != 'inclusiveGateway' && isProceedNext">
393
- <el-input type="textarea" :rows="5" v-model="description"></el-input>
394
- </el-form-item>
395
- <el-form-item v-if="nextNode.nextType != 'inclusiveGateway' && !isProceedNext" label-width="0">
396
- <div>请等待其他人员处理完成。</div>
397
- </el-form-item>
398
- </el-form>
399
- <div v-if="nextNode.nodeType == 'EndEvent'">流程即将结束,是否继续?</div>
400
- <div slot="footer" class="dialog-footer">
401
- <el-button type="primary" size="small" @click="saveNextStept()" :disabled="isDisabled1?false:true">确定
402
- </el-button>
403
- <el-button size="small" @click="closeNextSteptUserDialog">取消</el-button>
404
- </div>
405
- </el-dialog>
406
-
407
- <el-dialog :close-on-click-modal=false title="组织岗位用户" top="5vh" width="80%" height="80%"
408
- :visible.sync="sysOrgPosUserDialog" append-to-body>
409
- <!-- <sys-org-pos-user-select ref="orgPosUserRef" v-if="sysOrgPosUserDialog"-->
410
- <!-- :filterUserParam="{'commonUserType':'common' }" :ognEnable="false"-->
411
- <!-- :default-user-ids="inclusiveChooseKey ? choosePosUserIdsObj[inclusiveChooseKey]:choosePosUserIds"-->
412
- <!-- defaultChooseIds="$"-->
413
- <!-- :posEnable="false" :checkbox="mulitiChooseUser">-->
414
- <!-- </sys-org-pos-user-select>-->
415
- <user-select ref="orgPosUserRef"
416
- :choose-user-ids="inclusiveChooseKey ? choosePosUserIdsObj[inclusiveChooseKey]:choosePosUserIds"
417
- :checkbox="mulitiChooseUser" v-if="sysOrgPosUserDialog">
418
- </user-select>
419
- <div slot="footer" class="dialog-footer">
420
- <el-button type="primary" size="small" @click="sureNextUser()">确定</el-button>
421
- <el-button size="small" @click="sysOrgPosUserDialog = false">取消</el-button>
422
- </div>
423
- </el-dialog>
424
-
425
- <el-dialog :close-on-click-modal=false title="选择加签人" top="5vh" width="80%" height="80%"
426
- :visible.sync="completeSignDialog" append-to-body @closed="disableSign = false">
427
- <!-- <sys-org-pos-user-select ref="completeSignRef"-->
428
- <!-- :filterUserParam="{'commonUserType':'common','filterLoginUser':'Y'}"-->
429
- <!-- :ognEnable="false"-->
430
- <!-- :posEnable="false"-->
431
- <!-- :checkbox="true"-->
432
- <!-- v-if="completeSignDialog"-->
433
- <!-- >-->
434
- <!-- </sys-org-pos-user-select>-->
435
- <user-select ref="completeSignRef"
436
- v-if="completeSignDialog">
437
- </user-select>
438
- <div slot="footer" class="dialog-footer">
439
- <el-button type="primary" size="small" @click="sureCompleteSign()" :disabled="disableSign">确定</el-button>
440
- <el-button size="small" @click="completeSignDialog = false">取消</el-button>
441
- </div>
442
- </el-dialog>
443
-
444
- <el-dialog :close-on-click-modal=false title="选择转签人" top="5vh" width="80%" height="80%"
445
- :visible.sync="turnSignDialog" append-to-body @closed="disableSign = false">
446
- <!-- <sys-org-pos-user-select ref="turnSignRef"-->
447
- <!-- :filterUserParam="{'commonUserType':'common' }"-->
448
- <!-- :ognEnable="false"-->
449
- <!-- :posEnable="false"-->
450
- <!-- :checkbox="false"-->
451
- <!-- v-if="turnSignDialog"-->
452
- <!-- >-->
453
- <!-- </sys-org-pos-user-select>-->
454
- <user-select ref="turnSignRef"
455
- :checkbox="false"
456
- v-if="turnSignDialog">
457
- </user-select>
458
- <div slot="footer" class="dialog-footer">
459
- <el-button type="primary" size="small" @click="sureTurnSign()" :disabled="disableSign">确定</el-button>
460
- <el-button size="small" @click="turnSignDialog = false">取消</el-button>
461
- </div>
462
- </el-dialog>
463
-
464
-
465
- <el-dialog :close-on-click-modal="false" append-to-body title="查看流程图"
466
- :visible.sync="flowChartObj.dialogVisible"
467
- width="90%" height="90%"
468
- top="5vh">
469
- <flow-chart :flow-id="(flowChartObj.flowId || flowId) + ''" :inst-id="flowChartObj.instId + ''"
470
- :link-proc-id="flowChartObj.linkProcId + ''"
471
- :is-release="flowChartObj.isRelease"
472
- v-if="flowChartObj.dialogVisible"></flow-chart>
473
- <div slot="footer" class="dialog-footer">
474
- <el-button @click="flowChartObj.dialogVisible = false" size="small" icon="el-icon-error">关闭</el-button>
475
- </div>
476
- </el-dialog>
477
-
478
- <el-dialog :close-on-click-modal="false" append-to-body title="流转记录"
479
- :visible.sync="flowRecordObj.dialogVisible"
480
- width="90%" height="90%"
481
- top="5vh">
482
- <flow-roam-record :instId="flowRecordObj.instId + ''" v-if="flowRecordObj.dialogVisible"></flow-roam-record>
483
- <div slot="footer" class="dialog-footer">
484
- <el-button @click="flowRecordObj.dialogVisible = false" size="small" icon="el-icon-error">关闭</el-button>
485
- </div>
486
- </el-dialog>
487
-
488
- <el-dialog :close-on-click-modal="false" append-to-body title="流转记录"
489
- :visible.sync="flowRecordObj.oldDialogVisible"
490
- width="90%" height="90%"
491
- top="5vh">
492
- <roam-record :flow-inst-id="flowRecordObj.instId + ''" v-if="flowRecordObj.oldDialogVisible"></roam-record>
493
- <div slot="footer" class="dialog-footer">
494
- <el-button @click="flowRecordObj.oldDialogVisible = false" size="small" icon="el-icon-error">关闭</el-button>
495
- </div>
496
- </el-dialog>
497
-
498
- <el-dialog :close-on-click-modal="false" append-to-body title="选择退回节点"
499
- :visible.sync="backDialogVisible"
500
- width="450px" height="320px"
501
- top="30vh">
502
- <el-form label-width="80px">
503
- <el-form-item label="退回节点">
504
- <el-select v-model="backNodeId" clearable style="width: 100%">
505
- <el-option v-for="item in backNodeArr" :key="item.nodeId" :label="item.nodeName" :value="item.nodeId">
506
- </el-option>
507
- </el-select>
508
- </el-form-item>
509
- <el-form-item label="退回备注">
510
- <el-input v-model="backMsg" type="textarea" :autosize="{minRows:4,maxRows:4}"></el-input>
511
- </el-form-item>
512
- </el-form>
513
- <div slot="footer" class="dialog-footer">
514
- <el-button @click="beginBack" size="small" type="primary" icon="el-icon-success" :disabled="isDisabled2?false:true">确定</el-button>
515
- <el-button @click="backDialogVisible = false" size="small" icon="el-icon-error">关闭</el-button>
516
- </div>
517
- </el-dialog>
518
332
  </div>
519
333
  </template>
520
334
 
@@ -556,6 +370,9 @@
556
370
  formAboutInfoObj: {type: Object, default: () => ({})},
557
371
  sysDataObj: {type: Object, default: () => ({})},
558
372
  },
373
+ updated() {
374
+
375
+ },
559
376
  data() {
560
377
  let vm = this;
561
378
  return {
@@ -584,16 +401,16 @@
584
401
 
585
402
  currentInst: {},//当前流程实例
586
403
 
587
- // 列表按钮
588
- listButtonObj: {
589
- add: "新增",
590
- delete: "删除",
591
- update: "修改",
592
- view: "查看",
593
- deal: "处理",
594
- flowRecord: "流转记录",
595
- flowChart: "流程图",
596
- },
404
+ // // 列表按钮
405
+ // listButtonObj: {
406
+ // add: "新增",
407
+ // delete: "删除",
408
+ // update: "修改",
409
+ // view: "查看",
410
+ // deal: "处理",
411
+ // flowRecord: "流转记录",
412
+ // flowChart: "流程图",
413
+ // },
597
414
 
598
415
  // 批量处理
599
416
  flowBatchPendingDialog: false,
@@ -610,223 +427,6 @@
610
427
  nodeFormBtnObj: {},
611
428
 
612
429
  formBtnArr: [],
613
- formBtnObjDefault: {
614
- saveDraft: {
615
- text: "存草稿",
616
- type: "success",
617
- icon: "el-icon-check",
618
- disabled: false,
619
- show: true,
620
- method: () => {
621
- this.saveDraft();
622
- }
623
- },
624
-
625
- nextStep: {
626
- text: "下一步",
627
- type: "primary",
628
- icon: "el-icon-d-arrow-right",
629
- disabled: false,
630
- show: true,
631
- method: () => {
632
- this.nextStep();
633
- this.isDisabled1 = true;
634
- }
635
- },
636
-
637
- completeSign: {
638
- text: "加签",
639
- type: "primary",
640
- icon: "saspiconfont pl-icon-jiaqian",
641
- disabled: false,
642
- show: false,
643
- method: () => {
644
- this.completeSignDialog = true;
645
- }
646
- },
647
-
648
- turnSign: {
649
- text: "转签",
650
- type: "primary",
651
- icon: "saspiconfont pl-icon-zhuanqian-icon",
652
- disabled: false,
653
- show: false,
654
- method: () => {
655
- this.turnSignDialog = true;
656
- }
657
- },
658
-
659
- back: {
660
- text: "退回",
661
- type: "danger",
662
- icon: "el-icon-d-arrow-left",
663
- disabled: false,
664
- show: false,
665
- method: () => {
666
- this.backToPrevious(this.currentInst);
667
- }
668
- },
669
-
670
- retSpecified: {
671
- text: "退回指定节点",
672
- type: "danger",
673
- icon: "el-icon-refresh-left",
674
- disabled: false,
675
- show: false,
676
- method: () => {
677
- this.retSpecified(this.currentInst); //退回指定节点
678
- }
679
- },
680
-
681
- stopped: {
682
- text: "中止",
683
- type: "danger",
684
- icon: "saspiconfont pl-icon-yizhongzhi",
685
- disabled: false,
686
- show: false,
687
- method: () => {
688
- this.saspFlowAxios.post(this.api.plFlowInst.stopFlow, {
689
- instId: this.currentInst.flowInstId, type: "0",
690
- procInstId: this.currentInst.linkProcId,
691
- taskId: this.currentInst.taskId
692
- }).then(res => {
693
- if (res && res.data) {
694
- if (res.data.operateSuccess) {
695
- this.$message({type: "success", message: "中止成功!"});
696
- if (this.flowBatchPendingDialog) {
697
- this.batchTabRemove(this.currentInst.dataId);
698
- } else {
699
- this.tabCrudSearch();
700
- this.flowInstDataDialog = false;
701
- }
702
- this.initTabNum();
703
-
704
- let remindParam = {
705
- instId:this.currentInst.flowInstId,
706
- flowId:this.flowDefine.id,
707
- flowName:this.flowDefine.flowName,
708
- formId:this.formInfo.formId,
709
- listViewId:this.formInfo.listViewId,
710
- dataId:this.formInfo.dataId,
711
- instType:"stopped"
712
- };
713
- this.saspFlowAxios.post(this.api.plFlowInst.saveRemind,remindParam);
714
-
715
- //执行事件规则
716
- let currentNodeObj = this.flowNodeIdToInfo[this.currentInst.currentNode] ||{};
717
- if(currentNodeObj.openEvent == '1'){
718
- this.exeNewFlowEvent("suspend",currentNodeObj.nodeLinkId||'');
719
- }
720
- } else {
721
- this.$message({type: "error", message: res.data.operateMessage});
722
- }
723
- }
724
- });
725
- }
726
- },
727
-
728
- cancel: {
729
- text: "撤销",
730
- type: "danger",
731
- icon: "saspiconfont pl-icon-chexiao",
732
- disabled: false,
733
- show: false,
734
- isView: true,
735
- method: () => {
736
- this.saspFlowAxios.post(this.api.plFlowInst.revokeFlow, {
737
- instId: this.currentInst.flowInstId,
738
- taskId: this.currentInst.taskId
739
- }).then(res => {
740
- if (res && res.data) {
741
- if (res.data.operateSuccess) {
742
- this.$message({type: "success", message: "撤销成功!"});
743
- this.tabCrudSearch();
744
- this.flowInstDataDialog = false;
745
- this.initTabNum();
746
-
747
- let remindParam = {
748
- instId:this.currentInst.flowInstId,
749
- flowId:this.flowDefine.id,
750
- flowName:this.flowDefine.flowName,
751
- formId:this.formInfo.formId,
752
- listViewId:this.formInfo.listViewId,
753
- dataId:this.formInfo.dataId,
754
- instType:"cancel"
755
- };
756
- this.saspFlowAxios.post(this.api.plFlowInst.saveRemind,remindParam);
757
-
758
-
759
- } else {
760
- this.$message({type: "error", message: res.data.operateMessage});
761
- }
762
- }
763
- });
764
- }
765
- },
766
-
767
- getBack: {
768
- text: "取回",
769
- type: "danger",
770
- icon: "el-icon-refresh-left",
771
- disabled: false,
772
- show: false,
773
- isView: true,
774
- method: () => {
775
- this.getBackPrevious();
776
- }
777
- },
778
-
779
- restore: {
780
- text: "恢复",
781
- type: "success",
782
- icon: "saspiconfont pl-icon-chexiao",
783
- disabled: false,
784
- show: false,
785
- isView: true,
786
- method: () => {
787
- this.restoreFlow();
788
- }
789
- },
790
- record: {
791
- text: "流转记录",
792
- type: "warning",
793
- icon: "saspiconfont pl-icon-liuchengtu",
794
- disabled: false,
795
- show: true,
796
- isView: true,
797
- method: () => {
798
- this.openFlowRecord(this.currentInst);
799
- }
800
- },
801
- close: {
802
- text: "关闭",
803
- type: "",
804
- icon: "el-icon-close",
805
- disabled: false,
806
- show: true,
807
- isView: true,
808
- method: () => {
809
- this.flowInstDataDialog = false;
810
- this.flowBatchPendingDialog = false;
811
- }
812
- },
813
- },
814
-
815
- //表单按钮
816
- formButtonObj: {
817
- saveDraft: "存草稿",
818
- completeSign: "加签",
819
- turnSign: "转签",
820
- nextStep: "下一步",
821
- back: "退回",
822
- getBack: "取回",
823
- cancel: "撤销",
824
- stopped: "中止",
825
- close: "关闭",
826
- export: "导出",
827
- retSpecified: "退回指定节点"
828
- },
829
-
830
430
  nodeListButtonObj: {},
831
431
  nodeFormButtonObj: {},
832
432
  optColumnWidth: 336,
@@ -899,14 +499,7 @@
899
499
  // 表单信息
900
500
  formInfo: {
901
501
  formId: "",
902
- formDefineKey:"",
903
- listViewId: "",
904
- tableViewId: "",
905
502
  dataId: "",
906
- fieldStatus: {},
907
- fieldDefaultVal: {},
908
- fieldDefaultValChangeNum:{},
909
- flowFieldDefaultFromForm:{},
910
503
 
911
504
  opt: "view",
912
505
  },
@@ -948,8 +541,6 @@
948
541
  startNodeKeyObjByFlowId: {},
949
542
  flowVersionNodeObj: {}, //版本号对应的节点对象
950
543
  flowVersionNodeObjByFlowId: {},
951
- parentListViewId:"",
952
- parentTableViewId:"",
953
544
  scriptObj:{},
954
545
  newScriptObj:{}, //新事件规则-脚本
955
546
  newEventObj:{}, //新事件规则-规则
@@ -1002,7 +593,10 @@
1002
593
  total: 0, //总条数
1003
594
  pageSize: 50, //每页多少条
1004
595
  flowEventScriptByFlowId: {},
1005
- diyButtonsObj: {} // 自定义按钮对象
596
+ diyButtonsObj: {}, // 自定义按钮对象
597
+ saveInstId:"",
598
+ workFlowUtil:null, // 工作流工具类
599
+ indexForm:1,
1006
600
  }
1007
601
  },
1008
602
  watch:{
@@ -1011,6 +605,9 @@
1011
605
  this.isDisabled1 = true;
1012
606
  this.isDisabled['nextStep'] = true;
1013
607
  }
608
+ },
609
+ tabActive(){
610
+ this.workFlowUtil.tabActive = this.tabActive;
1014
611
  }
1015
612
  },
1016
613
  created() {
@@ -1030,6 +627,26 @@
1030
627
  this.loginUser = this.FLOW_CACHE_GLOBAL.getLoginUser();
1031
628
  this.userDept = this.FLOW_CACHE_GLOBAL.getLoginDept();
1032
629
 
630
+ this.workFlowUtil = new this.WORK_FLOW_UTIL(this,{
631
+ flowId: this.flowData.flowId,
632
+ skipAutoInit: true,
633
+ methods: {
634
+ initTabNum: this.initTabNum,
635
+ tabCrudSearch: this.tabCrudSearch,
636
+ batchTabRemove: this.batchTabRemove,
637
+ setFlowTabInfo: this.setFlowTabInfo,
638
+ getFlowBatchDialog: this.getFlowBatchDialog,
639
+ closeFlowBatchDialog: this.closeFlowBatchDialog,
640
+ initFormInfo: this.initFormInfo,
641
+ saveFormInfo: this.saveFormInfo,
642
+ getFormInfo: this.getFormInfo,
643
+ forceUpdateComponent: this.forceUpdateComponent,
644
+ setParams:this.setParams
645
+ }
646
+ });
647
+
648
+ this.workFlowUtil.init();
649
+
1033
650
  if (this.flowId.includes(",")) {
1034
651
  this.getMultiFlowInfo().then(() => {
1035
652
  this.initSuccess = true;
@@ -1037,9 +654,9 @@
1037
654
  });
1038
655
  }else {
1039
656
  this.initTabOpts(); // 初始化外部选项卡权限
1040
- this.getFlowInfo().then(res => {
657
+ this.getFlowInfo().then(() => {
1041
658
  this.initSuccess = true;
1042
- this.initFlowObj();
659
+ // this.initFlowObj();
1043
660
  this.getFlowAgent(); //加载流程代理
1044
661
  // this.initFieldSysData();
1045
662
  });
@@ -1047,6 +664,17 @@
1047
664
  }
1048
665
  },
1049
666
  methods: {
667
+ forceUpdateComponent(){
668
+ this.indexForm++;
669
+ },
670
+
671
+ getFlowBatchDialog() {
672
+ return this.flowBatchPendingDialog;
673
+ },
674
+ closeFlowBatchDialog(){
675
+ this.flowBatchPendingDialog = false;
676
+ },
677
+
1050
678
  // 新批量处理关闭弹框时数据重做的回调
1051
679
  newBatchDealClose() {
1052
680
  Object.assign(this.formSearchObj, {isNewSelectBatchDeal: false, taskNode: ""});
@@ -1084,158 +712,75 @@
1084
712
  * 打开[添加]窗口
1085
713
  */
1086
714
  openAddFlowForm() {
1087
- let nowVersion = this.flowDefine.releaseVersion; //只要已发布最小版本为1.0
1088
- this.currentRowData = {};
1089
- this.initFieldStatus(this.startNodeKeyObj[nowVersion],nowVersion).then(()=>{
1090
- this.flowInstDataDialog = true;
1091
- this.initFormInfoFunc('add').then(() => {
1092
- this.formBtnArr = this.getAddAndUpdateFormBtn({});
1093
- Object.assign(this.formInfo, {
1094
- dataId: "",
1095
- opt: "add"
1096
- });
1097
- this.currentInst = {};
1098
- this.$nextTick(() => {
1099
- this.exeFlowEvent("add","afterClick");
1100
- let startNodeKey = this.startNodeKeyObj[nowVersion];
1101
- let startNodeObj = this.flowVersionNodeObj[nowVersion][startNodeKey] || {};
1102
- if(startNodeObj.openEvent == '1'){
1103
- this.exeNewFlowEvent("addAfter");//新事件规则
1104
- }
1105
- })
1106
- })
1107
- });
1108
- // this.$refs.flowInstDataInfo && (this.$refs.flowInstDataInfo.optFormData = {});
1109
- // this.initFieldStatus(this.startNodeKeyObj[nowVersion],nowVersion).then(()=>{
1110
- // this.formBtnArr = this.getAddAndUpdateFormBtn({});
1111
- // Object.assign(this.formInfo, {
1112
- // dataId: "",
1113
- // opt: "add"
1114
- // });
1115
- // this.currentInst = {};
1116
- // this.$nextTick(() => {
1117
- // this.$refs.flowInstDataInfo.loadData().then(() => {
1118
- // this.exeFlowEvent("add","afterClick");
1119
- // let startNodeKey = this.startNodeKeyObj[nowVersion];
1120
- // let startNodeObj = this.flowVersionNodeObj[nowVersion][startNodeKey] || {};
1121
- // if(startNodeObj.openEvent == '1'){
1122
- // this.exeNewFlowEvent("addAfter");//新事件规则
1123
- // }
1124
- // })
1125
- // })
1126
- // });
1127
- },
1128
- initFormInfoFunc(type,rowData){
1129
- if(!rowData){
1130
- rowData = {};
1131
- }
1132
- let dataId = rowData.dataId || "";
1133
- let nodeObjs = this.flowVersionNodeObj[this.flowDefine.releaseVersion];
1134
- let startNodeKey = this.startNodeKeyObj[rowData.version];
1135
- let nodeKey = rowData.nodeKey;
1136
- let currentNode = nodeObjs[nodeKey || startNodeKey];
1137
- if(type === 'add'){
1138
- let version = this.flowDefine.releaseVersion;
1139
- currentNode = this.flowVersionNodeObj[version][this.startNodeKeyObj[version]];
1140
- }
1141
- return new Promise(resolve => {
1142
- if(this.initFormInfo){
1143
- let promise = this.initFormInfo(type,dataId,JSON.parse(currentNode.fieldOperate || "{}"),rowData);
1144
- if(promise.then){
1145
- promise.then(() => {
1146
- resolve();
1147
- })
1148
- }else{
1149
- resolve();
1150
- }
1151
- } else{
1152
- resolve();
1153
- }
715
+ this.workFlowUtil.openAddFlowForm().then(addFlowDatas => {
716
+ this.currentRowData = addFlowDatas.currentRowData;
717
+ this.formBtnArr = addFlowDatas.formBtnArr;
718
+ this.currentInst = addFlowDatas.currentInst;
719
+ this.formInfo = addFlowDatas.formInfo;
720
+ this.dataId = this.formInfo.dataId;
1154
721
  })
1155
722
  },
1156
723
  /**
1157
724
  * 打开[修改和处理]窗口
1158
725
  */
1159
726
  initUpdateFlowForm(row, type) {
1160
- this.currentRowData = row;
1161
- this.currNodeName = 'noEnd';
1162
- if (this.flowId.includes(',')) {
1163
- this.flowDefine = this.flowDefineByFlowId[row.flowId];
1164
- this.startNodeKeyObj = this.startNodeKeyObjByFlowId[row.flowId];
1165
- this.flowVersionNodeObj = this.flowVersionNodeObjByFlowId[row.flowId];
1166
- this.initFlowObj();
1167
- // 加载工作流脚本与工作流事件规则
1168
- // this.initFlowScript();
1169
- // Object.assign(this.formInfo, this.formInfoByFlowId[row.flowId]);
1170
- }
1171
-
1172
- return new Promise(resolve => {
1173
- let startNodeKey = this.startNodeKeyObj[row.version];
1174
- this.initFieldStatus(row.nodeKey || startNodeKey,row.version).then(()=>{
1175
- this.initFormInfoFunc(type,row).then(() => {
1176
- this.currentStartUser = this.userMap[row.startUserId] || "";
1177
- this.currentStartTime = row.startTime;
1178
- this.currentInst = row;
1179
-
1180
- Object.assign(this.formInfo, {
1181
- dataId: row.dataId,
1182
- opt: "update"
1183
- });
1184
- this.formBtnArr = this.getAddAndUpdateFormBtn(row);
1185
- resolve(true);
1186
- });
1187
- })
1188
- })
727
+ return new Promise(resolve => {
728
+ this.workFlowUtil.initUpdateFlowForm(row, type).then(updateFlowDatas => {
729
+ this.currentRowData = updateFlowDatas.currentRowData;
730
+ this.currNodeName = updateFlowDatas.currNodeName;
731
+ this.formBtnArr = updateFlowDatas.formBtnArr;
732
+ this.flowDefine = updateFlowDatas.flowDefine;
733
+ this.startNodeKeyObj = updateFlowDatas.startNodeKeyObj;
734
+ this.flowVersionNodeObj = updateFlowDatas.flowVersionNodeObj;
735
+ this.currentStartUser = updateFlowDatas.currentStartUser;
736
+ this.currentStartTime = updateFlowDatas.currentStartTime;
737
+ this.currentInst = updateFlowDatas.currentInst;
738
+ this.formInfo = updateFlowDatas.formInfo;
739
+ this.formBtnArr = updateFlowDatas.formBtnArr;
740
+ this.dataId = updateFlowDatas.dataId;
741
+ console.log(this.dataId);
742
+ resolve();
743
+ });
744
+ });
1189
745
  },
1190
746
 
1191
747
  /**
1192
748
  * 打开[修改和处理]窗口
1193
749
  */
1194
750
  openUpdateFlowForm(row,executePosition) {
1195
- if (this.flowId.includes(",")) {
1196
- this.setFlowScript(row.flowId);
1197
- }
1198
- this.currentRowData = row;
1199
- this.currNodeName = 'noEnd';
1200
- let currentNodeObj1 = this.flowNodeIdToInfo[row.currentNode] ||{};
1201
- let result = this.exeNewFlowEvent("editBefore",currentNodeObj1.nodeLinkId ||'');//新事件规则
1202
- if(result === false && typeof result == "boolean"){
1203
- return;
1204
- }
1205
- this.flowInstDataDialog = true;
1206
- this.initUpdateFlowForm(row, 'update').then(() =>{
1207
- this.$nextTick(() => {
1208
- this.exeFlowEvent(executePosition,"afterClick",row.currentNode);
1209
- let currentNodeObj = this.flowNodeIdToInfo[row.currentNode] ||{};
1210
- if(currentNodeObj.openEvent === '1'){ //开启事件
1211
- this.exeNewFlowEvent("editAfter",currentNodeObj.nodeLinkId ||'');//新事件规则
1212
- }
1213
- })
1214
- });
751
+ this.workFlowUtil.openUpdateFlowForm(row,executePosition).then(updateInfos => {
752
+ this.currentRowData = updateInfos.currentRowData;
753
+ this.currNodeName = updateInfos.currNodeName;
754
+ this.flowDefine = updateInfos.flowDefine;
755
+ this.startNodeKeyObj = updateInfos.startNodeKeyObj;
756
+ this.flowVersionNodeObj = updateInfos.flowVersionNodeObj;
757
+ this.currentStartUser = updateInfos.currentStartUser;
758
+ this.currentStartTime = updateInfos.currentStartTime;
759
+ this.currentInst = updateInfos.currentInst;
760
+ this.formInfo = updateInfos.formInfo;
761
+ this.formBtnArr = updateInfos.formBtnArr
762
+ this.dataId = this.formInfo.dataId;
763
+ })
1215
764
  },
1216
765
 
1217
766
  /**
1218
767
  * 打开[查看]窗口
1219
768
  */
1220
769
  openViewFlowForm(row) {
1221
- this.currentRowData = row;
1222
- let startNodeKey = this.startNodeKeyObj[row.version];
1223
- if (row.currentNodeName === "结束"){
1224
- this.currNodeName = "end";
1225
- }
1226
- this.initFieldStatus(row.nodeKey || startNodeKey,row.version,row.flowStatus).then(() =>{
1227
- this.flowInstDataDialog = true;
1228
- this.initFormInfoFunc('view',row).then(() => {
1229
- this.currentStartUser = this.userMap[row.startUserId] || "";
1230
- this.currentStartTime = row.startTime;
1231
- this.currentInst = row;
1232
-
1233
- Object.assign(this.formInfo, {
1234
- dataId: row.dataId,
1235
- opt: "view",
1236
- });
1237
- this.formBtnArr = this.getViewFormBtn(row);
1238
- });
770
+ this.workFlowUtil.openViewFlowForm(row).then(viewDatas => {
771
+ this.currentRowData = viewDatas.currentRowData;
772
+ this.currNodeName = viewDatas.currNodeName;
773
+ this.currentStartUser = viewDatas.currentStartUser;
774
+ this.currentStartTime = viewDatas.currentStartTime;
775
+ this.currentInst = viewDatas.currentInst;
776
+ this.formInfo = viewDatas.formInfo;
777
+ this.formBtnArr = viewDatas.formBtnArr;
778
+ })
779
+ },
780
+
781
+ setParams(params) {
782
+ Object.keys(params).forEach(key => {
783
+ this[key] = params[key];
1239
784
  });
1240
785
  },
1241
786
 
@@ -1259,7 +804,7 @@
1259
804
  let result = null;
1260
805
  let type = "update";
1261
806
  if (currentNodeObj.openEvent === '1') {
1262
- result = this.exeNewFlowEvent("editBefore",currentNodeObj.nodeLinkId ||'');//新事件规则
807
+ result = this.workFlowUtil.exeNewFlowEvent("editBefore",currentNodeObj.nodeLinkId ||'');//新事件规则
1263
808
  if (result === false && typeof result == "boolean") {
1264
809
  type = "view";
1265
810
  }
@@ -1267,7 +812,6 @@
1267
812
  this.flowBatchPendingDialog = true;
1268
813
  this.initUpdateFlowForm(arrRows[0],type).then(()=>{
1269
814
  // this.batchUpdateFormInfo.formShow = true;
1270
- let ref='batchTableForm'+arrRows[0].dataId+'Ref'
1271
815
 
1272
816
  this.$nextTick(()=>{
1273
817
  // this.$refs[ref][0].loadData().then(() => {
@@ -1278,9 +822,9 @@
1278
822
  }
1279
823
  });
1280
824
  }
1281
- this.exeFlowEvent("handle","afterClick",arrRows[0].currentNode,ref);
825
+ this.workFlowUtil.exeFlowEvent("handle","afterClick",arrRows[0].currentNode);
1282
826
  if(currentNodeObj.openEvent === '1'){ //开启事件
1283
- this.exeNewFlowEvent("editAfter",currentNodeObj.nodeLinkId ||'');//新事件规则
827
+ this.workFlowUtil.exeNewFlowEvent("editAfter",currentNodeObj.nodeLinkId ||'');//新事件规则
1284
828
  }
1285
829
  // })
1286
830
  })
@@ -1598,93 +1142,6 @@
1598
1142
  });
1599
1143
  },
1600
1144
 
1601
- /**
1602
- * 获取[添加、修改和处理]的操作按钮
1603
- */
1604
- getAddAndUpdateFormBtn(row) {
1605
- //走版本
1606
- let arrNodeFormBtns = [];
1607
- if(row.version){
1608
- arrNodeFormBtns = this.nodeFormBtnObj[(this.flowVersionNodeObj[row.version][row.nodeKey || this.startNodeKeyObj[row.version]] || {}).id];
1609
- }else {
1610
- arrNodeFormBtns = this.nodeFormBtnObj[this.flowVersionNodeObj[this.flowDefine.releaseVersion][this.startNodeKeyObj[this.flowDefine.releaseVersion]].id];
1611
- }
1612
- let hideBtnTypes = new Set(["getBack","stopped"]);
1613
- if (this.tabActive == "draft") {
1614
- hideBtnTypes.add("flowRecord");
1615
- hideBtnTypes.add("record");
1616
- }else if(this.tabActive == "pending"){//待处理
1617
- hideBtnTypes.add("cancel");
1618
- if(row.operateStatus=='1'||row.operateStatus=='3'){//如果是加签转签 不需要部分按钮
1619
- hideBtnTypes.add("retSpecified");
1620
- hideBtnTypes.add("back");
1621
- hideBtnTypes.add("completeSign");
1622
- hideBtnTypes.add("turnSign");
1623
- }
1624
- }
1625
-
1626
- return this.formatterFormBtnByHideBtnTypes(arrNodeFormBtns, hideBtnTypes);
1627
- },
1628
-
1629
- /**
1630
- * 获取[查看]的操作按钮
1631
- */
1632
- getViewFormBtn(row) {
1633
- //走版本
1634
- let arrNodeFormBtns = [];
1635
- if(row.version){
1636
- arrNodeFormBtns = this.nodeFormBtnObj[(this.flowVersionNodeObj[row.version][row.nodeKey || this.startNodeKeyObj[row.version]] || {}).id];
1637
- }else {
1638
- arrNodeFormBtns = this.nodeFormBtnObj[this.flowVersionNodeObj[this.flowDefine.releaseVersion][this.startNodeKeyObj[this.flowDefine.releaseVersion]].id];
1639
- }
1640
- let hideBtnTypes = new Set(["getBack", "cancel", "restore"]);
1641
- if (this.tabActive == "processed") { // 已处理
1642
-
1643
- // 上个节点的处理可以取回(已开启按钮的情况下)
1644
- if ((row.beforeDealer || "").split(",").indexOf(this.loginUser.id) > -1) {
1645
- hideBtnTypes.delete("getBack");
1646
- }
1647
-
1648
- // 流程的发起人可以撤销(已开启按钮的情况下)
1649
- if (row.startUserId == this.loginUser.id) {
1650
- // hideBtnTypes.delete("cancel");
1651
- }
1652
- //被挂起数据只有查看按钮
1653
- if(row.hangUp == '1'){
1654
- hideBtnTypes.add("getBack");
1655
- hideBtnTypes.add("cancel");
1656
- hideBtnTypes.add("restore");
1657
- }
1658
- } else if (this.tabActive == "discontinue" && row.discontinueUserId == this.loginUser.id) { // 已中止
1659
- // 当前登陆用户是中止人才显示恢复按钮(已开启按钮的情况下)
1660
- hideBtnTypes.delete("restore");
1661
- }
1662
-
1663
- return this.formatterFormBtnByHideBtnTypes(arrNodeFormBtns, hideBtnTypes);
1664
- },
1665
-
1666
- /**
1667
- * 根据隐藏按钮类型格式化按钮信息
1668
- */
1669
- formatterFormBtnByHideBtnTypes(arrFormBtns, hideBtnTypes) {
1670
- let arrResults = [];
1671
- arrFormBtns.forEach(data => {
1672
- let objTmp = Object.assign({}, data);
1673
- hideBtnTypes.has(data.btnType) && (objTmp.show = false);
1674
- if(this.tabActive == "discontinue" && data.btnType == "restore" && !hideBtnTypes.has(data.btnType)){
1675
- objTmp.show = true;
1676
- }
1677
- if(this.tabActive == "processed" && data.btnType == "getBack" && !hideBtnTypes.has(data.btnType)){
1678
- objTmp.show = true;
1679
- }
1680
- if(this.tabActive == "processed" && data.btnType == "cancel" && !hideBtnTypes.has(data.btnType)){
1681
- objTmp.show = true;
1682
- }
1683
- arrResults.push(objTmp);
1684
- });
1685
- return arrResults;
1686
- },
1687
-
1688
1145
  /**
1689
1146
  * 打开流程图窗口
1690
1147
  * @param row 流程实例ID
@@ -1701,478 +1158,75 @@
1701
1158
  isRelease = row.isRelease;
1702
1159
  }
1703
1160
  this.flowChartObj = {flowId: flowId,instId: instId,linkProcId:linkProcId,isRelease:isRelease, dialogVisible: true};
1161
+ this.$flowDialog.fillFlowDialogParams({
1162
+ flowChartObj: this.flowChartObj,
1163
+ })
1704
1164
  },
1705
1165
 
1706
- /**
1707
- * 打开流转记录窗口
1708
- * @param row 流程行数据
1709
- */
1710
1166
  openFlowRecord(row) {
1711
- let arr = ["2", "3", "4"]; // 旧版本的已办结已撤销以及已中止数据通过旧版接口查询流转记录
1712
- if (arr.indexOf(row.flowStatus) > -1 && row.isOldData === "1") {
1713
- this.flowRecordObj = {instId: row.flowInstId || "", oldDialogVisible: true};
1714
- } else {
1715
- this.flowRecordObj = {instId: row.flowInstId || "", dialogVisible: true};
1716
- }
1167
+ let arr = ["2", "3", "4"]; // 旧版本的已办结已撤销以及已中止数据通过旧版接口查询流转记录
1168
+ if (arr.indexOf(row.flowStatus) > -1 && row.isOldData === "1") {
1169
+ this.flowRecordObj = {instId: row.flowInstId || "", oldDialogVisible: true};
1170
+ } else {
1171
+ this.flowRecordObj = {instId: row.flowInstId || "", dialogVisible: true};
1172
+ }
1173
+ this.$flowDialog.fillFlowDialogParams({
1174
+ flowRecordObj: this.flowRecordObj,
1175
+ })
1717
1176
  },
1718
1177
 
1719
1178
  /**
1720
- * 存草稿
1179
+ * 关闭批量处理页面
1721
1180
  */
1722
- saveDraft() {
1723
- // let loading = this.$loading({
1724
- // lock: true,
1725
- // spinner: 'el-icon-loading',
1726
- // background: 'rgba(0, 0, 0, 0.7)'
1727
- // })
1728
-
1729
- this.saveDataFunc('draft').then(resData => {
1730
- this.tabCrudSearch();
1731
-
1732
- this.flowInstDataDialog = false;
1733
- if (resData.flowInstId) {
1734
- this.$message({type: "success", message: "保存成功!"});
1735
- if (this.flowBatchPendingDialog) {//批量处理 需处理tab页
1736
- this.batchSaveDraft();
1737
- }
1738
- } else {
1739
- this.$message({type: "error", message: "保存失败!"});
1740
- }
1741
- // loading && loading.close();
1742
- this.currentInst={};
1181
+ closeFlowBatchPending() {
1182
+ this.flowBatchPendingDialog = false;
1183
+ this.$nextTick(() => {
1184
+ this.pendingNums = 0;
1743
1185
  });
1744
1186
  },
1745
1187
 
1746
- saveDataFunc(type){ // 保存完成后返回流程的相关变量,通过变量传递到后台驱动流程运转
1747
- // 保存草稿、下一步保存
1748
- return new Promise(resolve => {
1749
- if(this.saveFormInfo){
1750
- let result = this.saveFormInfo(type);
1751
- if(result && result.then){
1752
- result.then(res => {
1753
- if(!res){
1754
- this.isDisabled['nextStep'] = true;
1755
- return;
1756
- }
1757
- if(typeof res !== 'object'){
1758
- res = {};
1759
- }
1760
- this.saveFlowData(res).then(flowInstData => {
1761
- res['flowInstId'] = flowInstData.id;
1762
- resolve(res);
1763
- })
1764
- })
1765
- }else{
1766
- if(!result){
1767
- return;
1768
- }
1769
- if(typeof result !== 'object'){
1770
- result = {};
1771
- }
1772
- this.saveFlowData(result).then(flowInstData => {
1773
- result['flowInstId'] = flowInstData.id;
1774
- resolve(result);
1775
- })
1776
- }
1777
- }else{
1778
- this.saveFlowData().then(flowInstData => {
1779
- let obj = {};
1780
- obj['flowInstId'] = flowInstData.id;
1781
- resolve(obj);
1782
- })
1783
- }
1784
- })
1785
- },
1188
+ /**
1189
+ * 点击标签页
1190
+ */
1191
+ batchTabClick(val) {
1192
+ this.batchUpdateFormInfo.batchDataId = val.name;
1193
+ let dataId=this.batchUpdateFormInfo.dataRows[val.index].dataId;
1194
+ let currentNode=this.batchUpdateFormInfo.dataRows[val.index].currentNode;
1786
1195
 
1787
- saveFlowData(flowParams){
1788
- return new Promise(resolve => {
1789
- flowParams = flowParams || {};
1790
- let flowSummary = this.getFlowSummary(flowParams);
1791
- let flowInst = {};
1792
- let dataId = (flowParams || {}).flowDataId || "";
1793
- this.dataId = dataId;
1794
- if(this.currentInst && this.currentInst.id){
1795
- this.$set(this.formInfo,"opt","update");
1796
- flowInst = {
1797
- "id": this.currentInst.id,
1798
- "flowSummary": flowSummary,
1799
- "updated": this.loginUser.id,
1800
- };
1801
- if(this.formInfo.opt == 'add' || this.tabActive == 'draft'){ //版本号也要随之更新
1802
- flowInst = Object.assign(flowInst,{"version":this.flowDefine.releaseVersion,"isRelease":this.flowDefine.isRelease})
1803
- }
1804
- this.saspFlowAxios.post(this.api.plFlowInst.url + "/" + this.formInfo.opt, flowInst).then(instRes => {
1805
- this.runFlowEvt();
1806
- resolve(instRes.data.operateObj);
1807
- });
1808
- }else{
1809
- let startNodeKey = this.startNodeKeyObj[this.flowDefine.releaseVersion];
1810
- if (this.formInfo.opt == "add") {
1811
- flowInst = {
1812
- flowId: this.flowDefine.id,
1813
- flowSummary: flowSummary,
1814
- dataId: dataId,
1815
- version:this.flowDefine.releaseVersion, //版本号
1816
- startTime: this.DATE_UTIL.getCurrentDateTime(), flowStatus: "0",
1817
- created: this.loginUser.id,
1818
- currentNode: this.flowVersionNodeObj[this.flowDefine.releaseVersion][startNodeKey].id,
1819
- isRelease:this.flowDefine.isRelease
1820
- };
1821
- } else {
1822
- flowInst = {
1823
- id: this.currentInst.id,
1824
- flowSummary: flowSummary,
1825
- version:this.flowDefine.releaseVersion, //版本号也要随之更新
1826
- updated: this.loginUser.id,
1827
- };
1196
+ let currentNodeObj = this.flowNodeIdToInfo[currentNode] ||{};
1197
+ let result = null;
1198
+ let type = "update";
1199
+ if (currentNodeObj.openEvent === '1') {
1200
+ result = this.workFlowUtil.exeNewFlowEvent("editBefore",currentNodeObj.nodeLinkId ||'');//新事件规则
1201
+ if (result === false && typeof result == "boolean") {
1202
+ type = "view";
1203
+ }
1204
+ }
1205
+ this.initUpdateFlowForm(this.batchUpdateFormInfo.dataRows[val.index], type).then(() => {
1206
+ this.$nextTick(()=>{
1207
+ if(result === false && typeof result == "boolean"){
1208
+ this.formBtnArr.forEach(item => {
1209
+ if (item.btnType !== "close" && item.btnType !== "record") {
1210
+ this.$set(item, 'disabled', true);
1828
1211
  }
1829
- this.saspFlowAxios.post(this.api.plFlowInst.url + "/" + this.formInfo.opt, flowInst).then(instRes => {
1830
- this.runFlowEvt();
1831
- resolve(instRes.data.operateObj);
1832
- this.currentInst=instRes.data.operateObj;
1833
- });
1834
- }
1835
- })
1836
- },
1837
-
1838
- runFlowEvt(){
1839
- let type = this.flowBatchPendingDialog ? "batch" : "";
1840
- let afterClickResult;
1841
- let currentNodeObj = this.flowNodeIdToInfo[this.currentInst.currentNode || this.draftNodeId] ||{};
1842
- if (type == 'batch') {//批量处理 需处理tab页
1843
- let ref = "batchTableForm"+this.batchUpdateFormInfo.activeName+"Ref";
1844
- if(currentNodeObj.openEvent == '1'){
1845
- afterClickResult=this.exeNewFlowEvent("saveAfter", currentNodeObj.nodeLinkId,ref);
1212
+ });
1846
1213
  }
1847
- }else {
1848
- if(currentNodeObj.openEvent == '1'){
1849
- afterClickResult=this.exeNewFlowEvent("saveAfter", currentNodeObj.nodeLinkId);
1214
+ this.workFlowUtil.exeFlowEvent("handle","afterClick",currentNode);
1215
+ if(currentNodeObj.openEvent === '1'){ //开启事件
1216
+ this.workFlowUtil.exeNewFlowEvent("editAfter",currentNodeObj.nodeLinkId ||'');//新事件规则
1850
1217
  }
1851
- }
1852
- },
1853
-
1854
- /**
1855
- * 保存草稿
1856
- */
1857
- saveData() {
1858
- let type = this.flowBatchPendingDialog ? "batch" : "";
1859
- return new Promise(resolve => {
1860
- // let flowInstDataInfoRef = "";
1861
- // if (type == 'batch') {
1862
- // // 批量处理
1863
- // flowInstDataInfoRef = this.$refs[`batchTableForm${this.batchUpdateFormInfo.activeName}Ref`];
1864
- // flowInstDataInfoRef = flowInstDataInfoRef[0] || flowInstDataInfoRef;
1865
- // } else {
1866
- // flowInstDataInfoRef = this.$refs.flowInstDataInfo;
1867
- // }
1868
- // let startNodeKey = this.startNodeKeyObj[this.flowDefine.releaseVersion];
1869
- // flowInstDataInfoRef.saveData(this.loginUser.id).then(res => {
1870
- // if (res && res.operateSuccess) {
1871
- // let flowSummary = this.getFlowSummary(flowInstDataInfoRef.optFormData,flowInstDataInfoRef.fieldSysDataObj || {});
1872
- // let flowInst = {};
1873
- // let dataId = res.operateObj;
1874
- // this.dataId = dataId;
1875
- // if(this.currentInst && this.currentInst.id){
1876
- // this.$set(this.formInfo,"opt","update");
1877
- // flowInst = {
1878
- // "id": this.currentInst.id,
1879
- // "flowSummary": flowSummary,
1880
- // "updated": this.loginUser.id,
1881
- // };
1882
- // if(this.formInfo.opt == 'add' || this.tabActive == 'draft'){ //版本号也要随之更新
1883
- // flowInst = Object.assign(flowInst,{"version":this.flowDefine.releaseVersion,"isRelease":this.flowDefine.isRelease})
1884
- // }
1885
- // this.saspFlowAxios.post(this.api.plFlowInst.url + "/" + this.formInfo.opt, flowInst).then(instRes => {
1886
- // resolve(instRes.data);
1887
- // });
1888
- // }else{
1889
- // if (this.formInfo.opt == "add") {
1890
- // flowInst = {
1891
- // flowId: this.flowDefine.id,
1892
- // flowSummary: flowSummary,
1893
- // dataId: dataId,
1894
- // startUserId: this.loginUser.id,
1895
- // version:this.flowDefine.releaseVersion, //版本号
1896
- // startTime: this.DATE_UTIL.getCurrentDateTime(), flowStatus: "0",
1897
- // created: this.loginUser.id,
1898
- // currentNode: this.flowVersionNodeObj[this.flowDefine.releaseVersion][startNodeKey].id,
1899
- // isRelease:this.flowDefine.isRelease
1900
- // };
1901
- // } else {
1902
- // flowInst = {
1903
- // id: this.currentInst.id,
1904
- // flowSummary: flowSummary,
1905
- // version:this.flowDefine.releaseVersion, //版本号也要随之更新
1906
- // updated: this.loginUser.id,
1907
- // };
1908
- // }
1909
- // this.saspFlowAxios.post(this.api.plFlowInst.url + "/" + this.formInfo.opt, flowInst).then(instRes => {
1910
- // resolve(instRes.data);
1911
- // this.currentInst=instRes.data;
1912
- // });
1913
- // }
1914
- // let afterClickResult;
1915
- // let currentNodeObj = this.flowNodeIdToInfo[this.currentInst.currentNode || this.draftNodeId] ||{};
1916
- // if (type == 'batch') {//批量处理 需处理tab页
1917
- // let ref = "batchTableForm"+this.batchUpdateFormInfo.activeName+"Ref";
1918
- // if(currentNodeObj.openEvent == '1'){
1919
- // afterClickResult=this.exeNewFlowEvent("saveAfter", currentNodeObj.nodeLinkId,ref);
1920
- // }
1921
- // }else {
1922
- // if(currentNodeObj.openEvent == '1'){
1923
- // afterClickResult=this.exeNewFlowEvent("saveAfter", currentNodeObj.nodeLinkId);
1924
- // }
1925
- // }
1926
- // }else{
1927
- // this.$message({type:"error",message:"保存失败!"});
1928
- // }
1929
- // });
1930
- });
1218
+ // })
1219
+ })
1220
+ })
1931
1221
  },
1932
1222
 
1933
1223
  /**
1934
- * 下一步,保存数据以及获取处理人
1224
+ * 关闭标签页
1935
1225
  */
1936
- nextStep() {
1937
- // let type = this.flowBatchPendingDialog ? "batch" : "";
1938
- let afterClickResult;
1939
- let result;
1940
- let currentNodeObj = this.flowNodeIdToInfo[this.currentInst.currentNode || this.draftNodeId] ||{};
1941
- afterClickResult=this.exeFlowEvent("nextStep","afterClick", this.currentInst.currentNode || this.draftNodeId);
1942
-
1943
- if(typeof afterClickResult == "boolean" && afterClickResult === false){
1226
+ batchTabRemove(targetName) {
1227
+ if(!this.flowBatchPendingDialog){
1944
1228
  return;
1945
1229
  }
1946
-
1947
- if(currentNodeObj.openEvent === '1'){
1948
- afterClickResult = this.exeNewFlowEvent("nextClick",currentNodeObj.nodeLinkId);
1949
- }
1950
-
1951
- if(typeof afterClickResult == "boolean" && afterClickResult === false){
1952
- return;
1953
- }
1954
-
1955
- // let afterValidateResult;
1956
- // let currentNodeObj = this.flowNodeIdToInfo[this.currentInst.currentNode || this.draftNodeId] ||{};
1957
- result = this.exeFlowEvent("nextStep","afterValidate", this.currentInst.currentNode || this.draftNodeId);
1958
- if(typeof result == "boolean" && result === false){
1959
- return;
1960
- }
1961
- if(currentNodeObj.openEvent === '1'){
1962
- result = this.exeNewFlowEvent("nextCheck",currentNodeObj.nodeLinkId);
1963
- if(typeof result == "boolean" && result === false){
1964
- return;
1965
- }
1966
- }
1967
-
1968
- this.isDisabled['nextStep'] = false;
1969
- this.flowParams = {};
1970
- this.saveDataFunc('nextStep').then(flowParams => {
1971
- this.flowParams = JSON.parse(JSON.stringify(flowParams));
1972
- let instId = flowParams.flowInstId;
1973
- this.$set(this.formInfo,"opt","update");
1974
- this.currentInst.id = instId;
1975
- this.description = "";
1976
- this.saveInstId = instId;
1977
- this.nowNode = this.allNodeInfo[currentNodeObj.id] || {};
1978
- this.isProceedNext = true;
1979
- //获取处理人
1980
- let obj = {instId: instId, taskId: this.currentInst.taskId,};
1981
- if(this.nowNode && this.nowNode.dealType && this.nowNode.dealType == 'multi'){
1982
- this.$set(obj,'passCondition',this.nowNode.passCondition)
1983
- }
1984
- let params = {"SASP_FLOW_USE_VARIABLES":"yes"};
1985
- // Object.assign(params,flowParams || {},obj);
1986
- Object.assign(params,obj);
1987
- let allParamKeys = Object.keys(flowParams || {});
1988
- allParamKeys.forEach(templateKey => {
1989
- if(this.isRefreshGetNextUsers.indexOf(templateKey) > -1){
1990
- params[templateKey] = flowParams[templateKey];
1991
- if(allParamKeys.indexOf(templateKey + "_SASP_SYS_DATA") > -1){
1992
- params[templateKey + "_SASP_SYS_DATA"] = flowParams[templateKey + "_SASP_SYS_DATA"];
1993
- }
1994
- if(allParamKeys.indexOf(templateKey + "_SASP_SYS_DATA_ID") > -1){
1995
- params[templateKey + "_SASP_SYS_DATA_ID"] = flowParams[templateKey + "_SASP_SYS_DATA_ID"];
1996
- }
1997
- }
1998
- })
1999
- this.saspFlowAxios.post(this.api.plFlowInst.getNextUsers, params).then(res => {
2000
- if(!res.data.operateSuccess){
2001
- this.isDisabled['nextStep'] = true;
2002
- if(res.data.resultObject === 'requestException'){
2003
- this.$message.error(res.data.errorInfo);
2004
- }else{
2005
- this.$message.error("未获取到处理人");
2006
- }
2007
- return;
2008
- }
2009
- let obj = {};
2010
- if (res && res.data) {
2011
- obj = res.data.operateObj || {};
2012
- if(res.data.operateMap && res.data.operateMap.isPassCondition == 0){
2013
- this.isProceedNext = false;
2014
- }
2015
- }
2016
- this.nextNodeName = "";
2017
- this.choosePosUserIds = "";
2018
- this.choosePosUserIdsObj = {};
2019
- if (obj.nextType == "inclusiveGateway") {
2020
- this.nextNode = obj;
2021
- this.chooseNextUserIdObj = {};
2022
- this.chooseNextUserNameObj = {};
2023
- let autoChooseUser = false;
2024
- (obj.result || []).forEach(item => {
2025
- //获取下一个节点信息
2026
- let nextNodeTmp = this.flowNodeIdToInfo[item.nextNodeId] || {};
2027
- if (nextNodeTmp.nodeType == "UserTask") {
2028
- item.mulitiChooseUser = nextNodeTmp.dealType != "single";
2029
- autoChooseUser = nextNodeTmp.autoChooseUser == "1";
2030
- if (item.mulitiChooseUser) {
2031
- this.$set(this.chooseNextUserIdObj, item.nodeKey, []);
2032
- } else {
2033
- this.$set(this.chooseNextUserIdObj, item.nodeKey, "");
2034
- }
2035
- } else if (this.nextNode.nodeType == "EndEvent") {
2036
- return;
2037
- }
2038
- let userArr = item.userArr || [];
2039
- //自动执行时的自动执行人
2040
- if (autoChooseUser) {
2041
- if (item.type == "user" && userArr.length == 0) {
2042
- // this.$message({type:"error",message:"没有处理人!"});
2043
- return;
2044
- } else {
2045
- let userIds = "";
2046
- let userNames = "";
2047
- userArr.forEach(userInfo => {
2048
- userIds += "," + userInfo.id;
2049
- userNames += "," + userInfo.userName;
2050
- });
2051
- this.chooseNextUserIdObj[item.nodeKey] = userIds.substring(1);
2052
- this.chooseNextUserId = userIds.substring(1);
2053
- this.chooseNextUserName = userNames.substring(1);
2054
- this.saveNextStept();
2055
- }
2056
- }
2057
- item.nextSteptUserType = obj.type;
2058
- if (item.type == "user" || item.type== 'all') {
2059
- item.nextSteptUserArr = userArr;
2060
- }
2061
- });
2062
- if(!autoChooseUser){
2063
- this.nextSteptUserDialog = true;
2064
- }
2065
- } else {
2066
- //获取下一个节点信息
2067
- this.nextNode = this.allNodeInfo[obj.nextNodeId] || {};
2068
- this.nextNodeName = obj.nextNodeName || "";
2069
- let autoChooseUser = false;
2070
- if (this.nextNode.nodeType == "UserTask") {
2071
- this.mulitiChooseUser = this.nextNode.dealType != "single";
2072
- autoChooseUser = this.nextNode.autoChooseUser == "1";
2073
- this.chooseNextUserId = "";
2074
- this.chooseNextUserName = "";
2075
- } else if (this.nextNode.nodeType == "EndEvent") {
2076
- this.nextSteptUserDialog = true;
2077
- return;
2078
- }
2079
- let userArr = obj.userArr || [];
2080
- //自动执行时的自动执行人
2081
- if (autoChooseUser) {
2082
- if (obj.type == "user" && userArr.length == 0) {
2083
- this.$message({type: "error", message: "没有处理人!"});
2084
- return;
2085
- } else {
2086
- let userIds = "";
2087
- let userNames = "";
2088
- userArr.forEach(userInfo => {
2089
- userIds += "," + userInfo.id;
2090
- userNames += "," + userInfo.userName;
2091
- });
2092
- if (userIds) {
2093
- this.chooseNextUserId = userIds.substring(1);
2094
- this.chooseNextUserName = userNames.substring(1);
2095
- }
2096
- this.saveNextStept();
2097
- }
2098
- }
2099
- this.nextSteptUserType = obj.type;
2100
- if (obj.type == "user" || obj.type == 'all') {
2101
- this.nextSteptUserArr = userArr;
2102
- }
2103
- if(!autoChooseUser){
2104
- this.nextSteptUserDialog = true;
2105
- }
2106
- }
2107
- if(this.nextNode.nextType == 'inclusiveGateway'){
2108
- (this.nextNode.result || []).forEach(item => {
2109
- this.chooseNextUserIdObj[item.nodeKey] = (item.userArr || {}).id;
2110
- });
2111
- }else{
2112
- let userInfo = this.nextSteptUserArr[0] || {};
2113
- if(this.nextNode.dealType=="single"){
2114
- this.chooseNextUserId = userInfo.id;
2115
- this.chooseNextUserName = userInfo.userName;
2116
- }
2117
- if(this.nextNode.dealType === "multi" && this.nextSteptUserArr.length === 1){
2118
- this.chooseNextUserId = [userInfo.id];
2119
- }
2120
- }
2121
- });
2122
- });
2123
- },
2124
-
2125
- /**
2126
- * 关闭批量处理页面
2127
- */
2128
- closeFlowBatchPending() {
2129
- this.flowBatchPendingDialog = false;
2130
- this.$nextTick(() => {
2131
- this.pendingNums = 0;
2132
- });
2133
- },
2134
-
2135
- /**
2136
- * 点击标签页
2137
- */
2138
- batchTabClick(val) {
2139
- this.batchUpdateFormInfo.batchDataId = val.name;
2140
- let dataId=this.batchUpdateFormInfo.dataRows[val.index].dataId;
2141
- let currentNode=this.batchUpdateFormInfo.dataRows[val.index].currentNode;
2142
-
2143
- let currentNodeObj = this.flowNodeIdToInfo[currentNode] ||{};
2144
- let result = null;
2145
- let type = "update";
2146
- if (currentNodeObj.openEvent === '1') {
2147
- result = this.exeNewFlowEvent("editBefore",currentNodeObj.nodeLinkId ||'');//新事件规则
2148
- if (result === false && typeof result == "boolean") {
2149
- type = "view";
2150
- }
2151
- }
2152
- this.initUpdateFlowForm(this.batchUpdateFormInfo.dataRows[val.index], type).then(() => {
2153
- let ref='batchTableForm'+dataId+'Ref';
2154
- this.$nextTick(()=>{
2155
- if(result === false && typeof result == "boolean"){
2156
- this.formBtnArr.forEach(item => {
2157
- if (item.btnType !== "close" && item.btnType !== "record") {
2158
- this.$set(item, 'disabled', true);
2159
- }
2160
- });
2161
- }
2162
- // this.$refs[ref][0].loadData().then(() => {
2163
- this.exeFlowEvent("handle","afterClick",currentNode,ref);
2164
- if(currentNodeObj.openEvent === '1'){ //开启事件
2165
- this.exeNewFlowEvent("editAfter",currentNodeObj.nodeLinkId ||'');//新事件规则
2166
- }
2167
- // })
2168
- })
2169
- })
2170
- },
2171
-
2172
- /**
2173
- * 关闭标签页
2174
- */
2175
- batchTabRemove(targetName) {
2176
1230
  let dataRows = this.batchUpdateFormInfo.dataRows;
2177
1231
  let nextTab;
2178
1232
  let i;
@@ -2195,7 +1249,7 @@
2195
1249
  let result = null;
2196
1250
  let type = "update";
2197
1251
  if (currentNodeObj.openEvent === '1') {
2198
- result = this.exeNewFlowEvent("editBefore",currentNodeObj.nodeLinkId ||'');//新事件规则
1252
+ result = this.workFlowUtil.exeNewFlowEvent("editBefore",currentNodeObj.nodeLinkId ||'');//新事件规则
2199
1253
  if (result === false && typeof result == "boolean") {
2200
1254
  type = "view";
2201
1255
  }
@@ -2204,7 +1258,6 @@
2204
1258
  this.batchUpdateFormInfo.formShow = true;
2205
1259
  this.initUpdateFlowForm(nextTab, type).then(()=>{
2206
1260
  this.$nextTick(()=>{
2207
- let ref='batchTableForm'+nextTab.dataId+'Ref';
2208
1261
  if(result === false && typeof result == "boolean"){
2209
1262
  this.formBtnArr.forEach(item => {
2210
1263
  if (item.btnType !== "close" && item.btnType !== "record") {
@@ -2213,9 +1266,9 @@
2213
1266
  });
2214
1267
  }
2215
1268
  // this.$refs[ref][0].loadData().then(() => {
2216
- this.exeFlowEvent("handle","afterClick",nextTab.currentNode,ref);
1269
+ this.workFlowUtil.exeFlowEvent("handle","afterClick",nextTab.currentNode);
2217
1270
  if(currentNodeObj.openEvent === '1'){ //开启事件
2218
- this.exeNewFlowEvent("editAfter",currentNodeObj.nodeLinkId ||'');//新事件规则
1271
+ this.workFlowUtil.exeNewFlowEvent("editAfter",currentNodeObj.nodeLinkId ||'');//新事件规则
2219
1272
  }
2220
1273
  // })
2221
1274
  })
@@ -2230,330 +1283,6 @@
2230
1283
  this.tabCrudSearch();
2231
1284
  },
2232
1285
 
2233
- /**
2234
- * 选择下一步执行人
2235
- */
2236
- chooseUser(nodekey) {
2237
- this.inclusiveChooseKey = nodekey || "";
2238
- this.sysOrgPosUserDialog = true;
2239
- },
2240
-
2241
- /**
2242
- * 确认执行人
2243
- */
2244
- sureNextUser() {
2245
- let checkedUserArr = this.$refs.orgPosUserRef.chooseUsers || [];
2246
- let userName = "";
2247
- let userId = "";
2248
- let arr = [];
2249
- let posUserIdArr = [];
2250
- checkedUserArr.forEach(item => {
2251
- userName += "," + item.dataLabel;
2252
- userId += "," + (item.dataKey.startsWith("user_") ? item.dataKey.replace("user_", "") : item.dataKey);
2253
- arr.push(item.dataKey.startsWith("user_") ? item.dataKey.replace("user_", "") : item.dataKey);
2254
- posUserIdArr.push(item.dataKey.startsWith("user_") ? item.dataKey.replace("user_", "") : item.dataKey);
2255
- });
2256
- if (userName) {
2257
- userName = userName.substring(1);
2258
- userId = userId.substring(1);
2259
- }
2260
- this.chooseNextUserName = userName;
2261
- this.chooseNextUserId = userId;
2262
- this.choosePosUserIds = posUserIdArr.join(",");
2263
- if(this.inclusiveChooseKey){
2264
- this.chooseNextUserNameObj[this.inclusiveChooseKey] = userName;
2265
- this.chooseNextUserIdObj[this.inclusiveChooseKey] = arr;
2266
- this.choosePosUserIdsObj[this.inclusiveChooseKey] = posUserIdArr.join(",");
2267
- }
2268
- this.sysOrgPosUserDialog = false;
2269
- },
2270
-
2271
- /**
2272
- * 下一步确定
2273
- */
2274
- saveNextStept() {
2275
- this.isDisabled1 = false;
2276
- let dealers = this.chooseNextUserId;
2277
- let dealerNames = this.chooseNextUserName;
2278
- let dealersObj = {};
2279
- if (this.nextNode.nextType == "inclusiveGateway") {
2280
- // 校验是否选人了
2281
- let tempResult = true;
2282
- Object.keys(this.chooseNextUserIdObj).forEach(key => {
2283
- let dealers = this.chooseNextUserIdObj[key];
2284
- if(Array.isArray(dealers)){
2285
- dealersObj[key] = dealers.join(",");
2286
- }else{
2287
- dealersObj[key] = dealers;
2288
- }
2289
- if ((this.chooseNextUserIdObj[key] || []).length == 0) {
2290
- tempResult = false;
2291
- }
2292
- });
2293
- if (!tempResult) {
2294
- this.$message.error("所有任务都需要设置执行人!");
2295
- this.isDisabled1 = true;
2296
- return;
2297
- }
2298
- } else {
2299
- if (dealers && !dealerNames) {
2300
- let userName = "";
2301
- this.nextSteptUserArr.forEach(item => {
2302
- if (("," + dealers + ",").indexOf("," + item.id + ",") > -1) {
2303
- userName += "," + item.userName;
2304
- }
2305
- });
2306
- if (userName) {
2307
- userName = userName.substring(1);
2308
- }
2309
- this.chooseNextUserName = userName;
2310
- dealerNames = this.chooseNextUserName;
2311
- }
2312
- if (this.nextNode.nodeType != 'EndEvent') {
2313
- if ((!this.chooseNextUserId || this.chooseNextUserId.length == 0) && this.isProceedNext) {
2314
- this.$message({type: "error", message: "请选择处理人!"});
2315
- this.isDisabled1 = true;
2316
- return;
2317
- }
2318
- if (this.nextNode.dealType != "single") {
2319
- if (typeof this.chooseNextUserId == 'string') {
2320
- dealers = this.chooseNextUserId;
2321
- } else {
2322
- dealers = this.chooseNextUserId.join(",");
2323
- }
2324
- if (typeof this.chooseNextUserName == 'string') {
2325
- dealerNames = this.chooseNextUserName;
2326
- } else {
2327
- dealerNames = this.chooseNextUserName.join(",");
2328
- }
2329
- }else if(this.nextNode.dealType == "single"){
2330
- dealers=dealers.split(",")[0];
2331
- dealerNames=dealerNames.split(",")[0];
2332
- }
2333
- } else {
2334
- dealers = "";
2335
- }
2336
- dealersObj[this.nextNode["nodeLinkId"]] = dealers;
2337
- }
2338
-
2339
- this.nextUserInfo['dealers'] = dealers;
2340
- this.nextUserInfo['dealerNames'] = dealerNames;
2341
- this.nextUserInfo['dealersObj'] = dealersObj;
2342
-
2343
- let obj = {
2344
- instId: this.saveInstId,
2345
- dealers: dealers,
2346
- dealerNames: dealerNames,
2347
- nextNodeType: this.nextNode.nodeType,
2348
- dealersObj: JSON.stringify(dealersObj),
2349
- taskId: this.currentInst.taskId,
2350
- nextNodeId: this.nextNode.id,
2351
- nextNodeKey: this.nextNode.nodeLinkId,
2352
- }
2353
- if(this.nowNode && this.nowNode.dealType && this.nowNode.dealType == 'multi'){
2354
- this.$set(obj,'passCondition',this.nowNode.passCondition)
2355
- }
2356
- if(this.flowNextOperation) {
2357
- this.flowNextOperation(obj.instId, obj.dealers, obj.dealerNames, obj.taskId);
2358
- }
2359
- let params = {"SASP_FLOW_USE_VARIABLES":"yes"};
2360
- Object.assign(params,this.flowParams || {},obj);
2361
- this.saspFlowAxios.post(this.api.plFlowInst.executeNextStep,params).then(res => {
2362
- if (res && res.data && res.data.operateSuccess) {
2363
- this.initTabNum();
2364
- this.$message({type: "success", message: "提交成功!"});
2365
- if (this.flowBatchPendingDialog) {
2366
- this.batchTabRemove(this.currentInst.dataId);
2367
- } else {
2368
- this.tabCrudSearch();
2369
- }
2370
-
2371
- this.nextSteptUserDialog = false;
2372
- this.flowInstDataDialog = false;
2373
-
2374
- let type = this.flowBatchPendingDialog ? "batch" : "";
2375
- let currentNodeObj = this.flowNodeIdToInfo[this.currentInst.currentNode || this.draftNodeId] ||{};
2376
- let submitSuccessRusult;
2377
- if (type == 'batch') {
2378
- // 批量处理
2379
- let ref = "batchTableForm"+this.batchUpdateFormInfo.activeName+"Ref";
2380
- submitSuccessRusult=this.exeFlowEvent("nextStep","submitSuccess", this.currentInst.currentNode || this.draftNodeId,ref);
2381
- if(currentNodeObj.openEvent == '1'){
2382
- submitSuccessRusult = this.exeNewFlowEvent("nextSubmit",currentNodeObj.nodeLinkId||'',ref)
2383
- }
2384
- } else {
2385
- submitSuccessRusult=this.exeFlowEvent("nextStep","submitSuccess", this.currentInst.currentNode || this.draftNodeId);
2386
- if(currentNodeObj.openEvent == '1'){
2387
- submitSuccessRusult =this.exeNewFlowEvent("nextSubmit",currentNodeObj.nodeLinkId||'')
2388
- }
2389
- }
2390
- if(submitSuccessRusult){
2391
- //办结提醒
2392
- if(this.nextNode.nodeType == "EndEvent"){
2393
- let remindParam = {
2394
- instId:this.saveInstId,
2395
- flowId:this.flowDefine.id,
2396
- flowName:this.flowDefine.flowName,
2397
- formId:this.formInfo.formId,
2398
- listViewId:this.formInfo.listViewId,
2399
- dataId:this.formInfo.dataId,
2400
- instType:"end"
2401
- };
2402
- this.saspFlowAxios.post(this.api.plFlowInst.saveRemind,remindParam);
2403
- }
2404
- }else{
2405
- console.log("脚本异常")
2406
- }
2407
-
2408
-
2409
- } else {
2410
- this.$message({type: "error", message: "保存失败!"});
2411
- this.isDisabled1 = true;
2412
- this.isDisabled['nextStep'] = true;
2413
- }
2414
- });
2415
- },
2416
-
2417
-
2418
- /**
2419
- * 确认加签
2420
- */
2421
- sureCompleteSign() {
2422
- let checkedUserArr = this.$refs.completeSignRef.chooseUsers || [];
2423
- if (checkedUserArr.length === 0) {
2424
- this.$message({type: "error", message: "请选择加签人!"});
2425
- return;
2426
- }
2427
- let userIds = "";
2428
- checkedUserArr.forEach(item => {
2429
- userIds += "," + item.dataKey.startsWith("user_") ? item.dataKey.replace("user_", "") : item.dataKey;
2430
- });
2431
- this.disableSign = true;
2432
- this.saspFlowAxios.post(this.api.plFlowInst.completeSign, {
2433
- taskId: this.currentInst.taskId,
2434
- dealers: userIds.substring(1)
2435
- }).then(res => {
2436
- if (res && res.data && res.data.operateSuccess) {
2437
- this.completeSignDialog = false;
2438
- this.flowInstDataDialog = false;
2439
- this.initTabNum();
2440
- this.$message({type: "success", message: "加签成功!"});
2441
- this.tabCrudSearch();
2442
- } else {
2443
- this.$message({type: "error", message: "加签失败!"});
2444
- }
2445
- this.disableSign = false;
2446
- });
2447
- },
2448
-
2449
- /**
2450
- * 确认转签
2451
- */
2452
- sureTurnSign() {
2453
- let checkedUserArr = this.$refs.turnSignRef.chooseUsers || [];
2454
- if (checkedUserArr.length === 0) {
2455
- this.$message({type: "error", message: "请选择转签人!"});
2456
- return;
2457
- }
2458
- let userId = checkedUserArr[0].dataKey.startsWith("user_") ? checkedUserArr[0].dataKey.replace("user_", "") : checkedUserArr[0].dataKey;
2459
- this.disableSign = true;
2460
- this.saspFlowAxios.post(this.api.plFlowInst.turnSign, {
2461
- taskId: this.currentInst.taskId,
2462
- dealers: userId
2463
- }).then(res => {
2464
- if (res && res.data && res.data.operateSuccess) {
2465
- this.turnSignDialog = false;
2466
- this.flowInstDataDialog = false;
2467
- this.initTabNum();
2468
- this.$message({type: "success", message: "转签成功!"});
2469
- this.tabCrudSearch();
2470
- } else {
2471
- this.$message({type: "error", message: "转签失败!"});
2472
- }
2473
- this.disableSign = false;
2474
- });
2475
-
2476
- },
2477
-
2478
- /**
2479
- * 回退到上一步
2480
- */
2481
- backToPrevious() {
2482
- let loading = this.$loading({
2483
- lock: true,
2484
- text: '正在退回,请稍后....',
2485
- spinner: 'el-icon-loading',
2486
- background: 'rgba(0, 0, 0, 0.7)'
2487
- })
2488
- let currentInst = this.currentInst;
2489
- this.$prompt('退回备注', '确定要退回至上一个节点吗?', {
2490
- confirmButtonText: '确定',
2491
- cancelButtonText: '取消',
2492
- inputType: 'textarea',
2493
- }).then(({ value }) => {
2494
- this.saspFlowAxios.post(this.api.plFlowInst.backRewrite,
2495
- {
2496
- taskId:currentInst.taskId,
2497
- remarks: value
2498
- }).then(res => {
2499
- if (res && res.data && res.data.operateSuccess) {
2500
- this.$message({type: "success", message: "退回成功!"});
2501
- this.initTabNum();
2502
- if (this.flowBatchPendingDialog) {
2503
- this.batchTabRemove(this.currentInst.dataId);
2504
- } else {
2505
- this.tabCrudSearch();
2506
- }
2507
- } else {
2508
- this.$message({type: "error", message: res.data.operateMessage});
2509
- }
2510
- loading && loading.close();
2511
- this.flowInstDataDialog = false;
2512
- })
2513
- }).catch(() => {
2514
- loading && loading.close();
2515
- });
2516
- },
2517
-
2518
-
2519
- /**
2520
- * 取回
2521
- */
2522
- getBackPrevious() {
2523
- let loading = this.$loading({
2524
- lock: true,
2525
- text: '正在取回,请稍后....',
2526
- spinner: 'el-icon-loading',
2527
- background: 'rgba(0, 0, 0, 0.7)'
2528
- })
2529
- let currentInst = this.currentInst;
2530
- this.$confirm('确定要取回吗?', '警告', {
2531
- confirmButtonText: '确定',
2532
- cancelButtonText: '取消',
2533
- }).then(() => {
2534
- this.saspFlowAxios.post(this.api.plFlowInst.getBackRewrite,
2535
- {
2536
- flowInstId: currentInst.flowInstId,
2537
- }).then(res => {
2538
- if (res && res.data && res.data.operateSuccess) {
2539
- this.$message({type: "success", message: "取回成功!"});
2540
- this.initTabNum();
2541
- if (this.flowBatchPendingDialog) {
2542
- this.batchTabRemove(this.currentInst.dataId);
2543
- } else {
2544
- this.tabCrudSearch();
2545
- }
2546
- } else {
2547
- this.$message({type: "error", message: res.data.operateMessage});
2548
- }
2549
- loading && loading.close();
2550
- this.flowInstDataDialog = false;
2551
- })
2552
- }).catch(() => {
2553
- loading && loading.close();
2554
- });
2555
- },
2556
-
2557
1286
  /**
2558
1287
  * 基于当前选中的选项卡进行查询
2559
1288
  */
@@ -2565,226 +1294,9 @@
2565
1294
  * 获取流程概要
2566
1295
  */
2567
1296
  getFlowSummary(dataObj, summaryTemplate) {
2568
- let flowSummary = "";
2569
- let summarySet = summaryTemplate || this.flowDefine.flowSummary;
2570
- if (this.tabActive === "draft") {
2571
- flowSummary = this.platStringUtil.replaceAll(summarySet, "${startUserName*}", this.loginUser.userName);
2572
- flowSummary = this.platStringUtil.replaceAll(flowSummary, "${createTime*}", this.DATE_UTIL.getCurrentDateTime());
2573
- } else {
2574
- flowSummary = this.platStringUtil.replaceAll(summarySet, "${startUserName*}", this.currentStartUser);
2575
- flowSummary = this.platStringUtil.replaceAll(flowSummary, "${createTime*}", this.currentStartTime);
2576
- }
2577
- flowSummary = this.platStringUtil.replaceAll(flowSummary, "${flowName*}", this.flowDefine.flowName);
2578
- if (this.flowDefine.summaryNameId) {
2579
- // flowSummary = flowSummary.toUpperCase();
2580
- let summaryNameId = JSON.parse(this.flowDefine.summaryNameId);
2581
- Object.keys(summaryNameId).forEach(fieldName => {
2582
- let fieldId = summaryNameId[fieldName];
2583
- if (fieldName && dataObj.hasOwnProperty(fieldId)) {
2584
- let replaceVal = dataObj[fieldId];
2585
- if(dataObj[fieldId + "_SASP_SYS_DATA"]){
2586
- replaceVal = dataObj[fieldId+ "_SASP_SYS_DATA"];
2587
- }
2588
- if(dataObj[fieldId + "_sequence"]){ // 自增序列
2589
- replaceVal = dataObj[fieldId + "_sequence"];
2590
- }
2591
- flowSummary = this.platStringUtil.replaceAll(flowSummary, "${" + fieldName + "}", replaceVal);
2592
- }else if(fieldName && dataObj.hasOwnProperty(fieldName)){
2593
- let replaceVal = dataObj[fieldName];
2594
- if(dataObj[fieldName + "_SASP_SYS_DATA"]){
2595
- replaceVal = dataObj[fieldName+ "_SASP_SYS_DATA"];
2596
- }
2597
- if(dataObj[fieldName + "_sequence"]){ // 自增序列
2598
- replaceVal = dataObj[fieldName + "_sequence"];
2599
- }
2600
- flowSummary = this.platStringUtil.replaceAll(flowSummary, "${" + fieldName + "}", replaceVal);
2601
- }else{
2602
- flowSummary = this.platStringUtil.replaceAll(flowSummary, "${" + fieldName + "}", "");
2603
- }
2604
- });
2605
- }
2606
- return flowSummary;
2607
- },
2608
-
2609
- /**
2610
- * 各字段的状态
2611
- * nodeKey 当前key
2612
- * version 当前版本号
2613
- */
2614
- initFieldStatus(nodeKey,version,flowStatus) {
2615
- return new Promise(resolve => {
2616
- // let nodeInfo = this.flowVersionNodeObj[version][nodeKey] || {};
2617
- // this.formInfo.fieldStatus = {};
2618
- // this.formInfo.fieldDefaultVal = {}; //初始化可编辑状态和默认值
2619
- // let orgChargeField = [];
2620
- // let supervisorField = [];
2621
- // let levels = "";
2622
- // if (nodeInfo.fieldOperate) {
2623
- // let fieldOperate = JSON.parse(nodeInfo.fieldOperate);
2624
- // Object.keys(fieldOperate).forEach(field => {
2625
- // let fieldObj = fieldOperate[field];
2626
- // if(flowStatus!='4'){
2627
- // if (fieldObj.edit == "1") {//可编辑
2628
- // this.formInfo.fieldStatus[field] = "edit";
2629
- // } else if (fieldObj.hide == "1") {//不可见
2630
- // this.formInfo.fieldStatus[field] = "hide";
2631
- // }
2632
- // }
2633
- // let defaultValType = fieldObj.defaultValType;
2634
- // let defaultVal = fieldObj.defaultVal;
2635
- // let dateTimeType = fieldObj.dateTimeType;
2636
- // if (defaultVal) {
2637
- // if (defaultValType == "sysData") {
2638
- // this.formInfo.fieldDefaultVal[field] = defaultVal[defaultVal.length - 1];
2639
- // } else if (defaultValType == "formInfo"){
2640
- // this.formInfo.fieldDefaultVal[field] = "&&," + defaultVal + ",&&";
2641
- // } else if (defaultValType == "diyVal" || (defaultValType == "dateTime" && dateTimeType == "diyTime")) {
2642
- // this.formInfo.fieldDefaultVal[field] = defaultVal;
2643
- // } else {
2644
- // if (defaultVal.indexOf("LOGINUSER") > -1) {
2645
- // this.formInfo.fieldDefaultVal[field] = Replace.def(this.loginUser, defaultVal);
2646
- // } else {
2647
- // this.formInfo.fieldDefaultVal[field] = Replace.def(this.userDept, defaultVal);
2648
- // }
2649
- // }
2650
- // }
2651
- // //时间
2652
- // if(defaultValType == "dateTime" && dateTimeType == "sysTime"){
2653
- // let time = "";
2654
- // let dateTimeFormat = fieldObj.dateTimeFormat || "yyyy-MM-dd";
2655
- // let specialDate = fieldObj.specialDate;
2656
- // let specialOpt = fieldObj.specialOpt;
2657
- // let specialVal = fieldObj.specialVal;
2658
- // if(specialDate && specialOpt && specialVal){
2659
- // time = this.DATE_UTIL.timeConversion(new Date(),dateTimeFormat,specialDate,specialOpt,specialVal);
2660
- // }else{
2661
- // time = this.DATE_UTIL.formaterDateOrTime(new Date(),dateTimeFormat);
2662
- // }
2663
- // this.formInfo.fieldDefaultVal[field] = time;
2664
- // }
2665
- //
2666
- // if(defaultValType == "dateTime" && dateTimeType == "formField"){
2667
- // this.formInfo.flowFieldDefaultFromForm[field] = fieldObj;
2668
- // }
2669
- //
2670
- //
2671
- // //处理人上级
2672
- // let dealerLeaderType = fieldObj.dealerLeaderType;
2673
- // if(dealerLeaderType){
2674
- // if(dealerLeaderType == "1"){
2675
- // orgChargeField.push(field);
2676
- // }else{
2677
- // supervisorField.push({field:field,level:fieldObj.leaderLevel})
2678
- // levels += "," + fieldObj.leaderLevel;
2679
- // }
2680
- // }
2681
- // this.formInfo.fieldDefaultValChangeNum[field] = fieldObj.changeNum;
2682
- // });
2683
- // }
2684
- // //防止切换数据污染
2685
- // this.formInfo.listViewId = this.parentListViewId;
2686
- // this.formInfo.tableViewId = this.parentTableViewId;
2687
- // if(nodeInfo.nodeSetForm == '1'){ //开启定制表单
2688
- // //开启定制表单
2689
- // // nodeFormType
2690
- // // nodeResouceId
2691
- // if(nodeInfo.nodeFormType == 'form'){ //智能建表
2692
- // let nodeResouceIdArr = JSON.parse(nodeInfo.nodeResourceId || "[]");
2693
- // if(nodeResouceIdArr.length > 0){
2694
- // let resouceId = nodeResouceIdArr[nodeResouceIdArr.length - 1];
2695
- // this.RES_GLOBAL.getById(resouceId).then(resData => {
2696
- //
2697
- // //获取资源池
2698
- // // this.$set(this.formInfo,'listViewId',resData.rkey);
2699
- // this.FORM_GLOBAL.getViewAndFields(resData.rkey,
2700
- // resData.rclassId,this.loginUser.userType).then(data => {
2701
- // if (data) {
2702
- // let resultMap = data || {};
2703
- // this.formInfo.formId = resultMap.formId;
2704
- // this.formInfo.listViewId = resultMap.listViewId;
2705
- // this.formInfo.tableViewId = resultMap.tableViewId;
2706
- // let fieldList = resultMap.fieldList || [];
2707
- // fieldList.forEach(fieldObj => {
2708
- // this.formFieldObj[fieldObj.id] = fieldObj;
2709
- // });
2710
- // this.initFlowTitle();
2711
- // this.getDefaultUser(orgChargeField,supervisorField,levels,resolve);
2712
- // // resolve(true);
2713
- // }
2714
- // });
2715
- // });
2716
- // }
2717
- // }else {
2718
- // this.getDefaultUser(orgChargeField,supervisorField,levels,resolve);
2719
- // // resolve(true);
2720
- // }
2721
- // }else {
2722
- // this.getDefaultUser(orgChargeField,supervisorField,levels,resolve);
2723
- // // resolve(true);
2724
- // }
2725
- resolve();
2726
- });
1297
+ return this.workFlowUtil.getFlowSummary(dataObj, summaryTemplate);
2727
1298
  },
2728
1299
 
2729
- // getDefaultUser(orgChargeField,supervisorField,levels,resolve){
2730
- // if(orgChargeField.length > 0 && supervisorField.length > 0){
2731
- // this.saspFlowAxios.post(this.api.sysOrgPosUser.getDeptSupervisorByUserId,
2732
- // {userId:this.loginUser.id}).then(res => {
2733
- // if(res && res.data){
2734
- // let userId = (res.data[0] || {}).id;
2735
- // orgChargeField.forEach(fieldId => {
2736
- // this.formInfo.fieldDefaultVal[fieldId] = userId || "";
2737
- // });
2738
- // }
2739
- //
2740
- // this.saspFlowAxios.post(this.api.sysOrgPosUser.getSupervisorByLevels,
2741
- // {userId:this.loginUser.id,levels:levels.substring(1)}).then(res => {
2742
- // if(res && res.data){
2743
- // let userIdMap = res.data || {};
2744
- // supervisorField.forEach(item => {
2745
- // this.formInfo.fieldDefaultVal[item.field] = userIdMap[item.level] || "";
2746
- // });
2747
- // resolve(true);
2748
- // }
2749
- // });
2750
- // });
2751
- // }else if(orgChargeField.length > 0){
2752
- // this.saspFlowAxios.post(this.api.sysOrgPosUser.getDeptSupervisorByUserId,
2753
- // {userId:this.loginUser.id}).then(res => {
2754
- // if (res && res.data) {
2755
- // let userId = (res.data[0] || {}).id;
2756
- // orgChargeField.forEach(fieldId => {
2757
- // this.formInfo.fieldDefaultVal[fieldId] = userId || "";
2758
- // });
2759
- // resolve(true);
2760
- // }
2761
- // });
2762
- // }else if(supervisorField.length > 0){
2763
- // this.saspFlowAxios.post(this.api.sysOrgPosUser.getSupervisorByLevels,
2764
- // {userId:this.loginUser.id,levels:levels.substring(1)}).then(res => {
2765
- // if(res && res.data){
2766
- // let userIdMap = res.data || {};
2767
- // supervisorField.forEach(item => {
2768
- // this.formInfo.fieldDefaultVal[item.field] = userIdMap[item.level] || "";
2769
- // });
2770
- // resolve(true);
2771
- // }
2772
- // });
2773
- // }else{
2774
- // resolve(true);
2775
- // }
2776
- // },
2777
-
2778
-
2779
-
2780
- /**
2781
- * 批量处理存草稿
2782
- */
2783
- batchSaveDraft() {
2784
- this.batchTabRemove(this.currentInst.dataId);
2785
- },
2786
-
2787
-
2788
1300
  /**
2789
1301
  * 关闭下一步执行人弹窗
2790
1302
  */
@@ -2793,39 +1305,8 @@
2793
1305
  this.isDisabled['nextStep'] = true;
2794
1306
  },
2795
1307
 
2796
- /**
2797
- * 恢复方法
2798
- */
2799
- restoreFlow() {
2800
- this.saspFlowAxios.post(this.api.plFlowInst.stopFlow, {
2801
- instId: this.currentInst.flowInstId, type: "1",
2802
- procInstId: this.currentInst.linkProcId,
2803
- taskId: this.currentInst.taskId
2804
- }).then(res => {
2805
- if (res && res.data) {
2806
- if (res.data.operateSuccess) {
2807
- this.$message({type: "success", message: "恢复成功!"});
2808
- this.flowInstDataDialog = false;
2809
- if (this.flowBatchPendingDialog) {
2810
- this.batchTabRemove(this.currentInst.dataId);
2811
- } else {
2812
- this.tabCrudSearch();
2813
- }
2814
- this.initTabNum();
2815
- } else {
2816
- this.$message({type: "error", message: res.data.operateMessage});
2817
- }
2818
- }
2819
- })
2820
- },
2821
-
2822
1308
  // 获取工作流表单信息弹出框标题
2823
1309
  initFlowTitle() {
2824
- // this.FORM_GLOBAL.getTableViews(this.formInfo.tableViewId,this.loginUser.userType).then(data => {
2825
- // if (data) {
2826
- // this.flowFormTitle = data.viewName;
2827
- // }
2828
- // });
2829
1310
  },
2830
1311
 
2831
1312
  initTabNum() {
@@ -2848,679 +1329,97 @@
2848
1329
  // this.$set(this.numberObj, tabType, total);
2849
1330
  // },
2850
1331
 
2851
- getFlowInfo() {
2852
- this.flowDefine.id = this.flowData.flowId;
2853
- return new Promise(resolve => {
2854
- this.FLOW_GLOBAL.getFlowDefineById(this.flowData.flowId).then(flowobj => {
2855
- this.flowDefine = flowobj;
2856
- let tabSetting = JSON.parse(this.flowDefine.tabSetting,"[]");
2857
- (tabSetting || []).forEach(item => {
2858
- if(item.isUse == '1'){
2859
- this.operateType[item.type] = true;
2860
- }
2861
- })
2862
- let activeArr = [];
2863
- Object.keys(this.operateType).forEach(key => {
2864
- if(this.operateType[key] && this.resourceTabOpts.indexOf(key) > -1){
2865
- activeArr.push(key);
2866
- }
2867
- })
2868
- if(activeArr.length > 0 && activeArr.indexOf("pending") == -1){
2869
- this.tabActive = activeArr[0];
2870
- }
2871
- this.showModel = flowobj.showModel;
2872
- this.showInfo = flowobj.showInfo;
2873
- let formType = flowobj.formType;
2874
- // if (formType == "form") {
2875
- // let resourceIdArr = JSON.parse(flowobj.resourceId);
2876
- // let resourceId = resourceIdArr[1];
2877
- // this.RES_GLOBAL.getById(resourceId).then(resourceData => {
2878
- // this.FORM_GLOBAL.getViewAndFields(resourceData.rkey,
2879
- // resourceData.rclassId,this.loginUser.userType).then(data => {
2880
- // if (data) {
2881
- // let resultMap = data || {};
2882
- // this.formInfo.formId = resultMap.formId;
2883
- // this.formInfo.listViewId = resultMap.listViewId;
2884
- // this.formInfo.formDefineKey = resourceData.rclassId;
2885
- // this.parentListViewId = resultMap.listViewId;
2886
- // this.formInfo.tableViewId = resultMap.tableViewId;
2887
- // this.parentTableViewId = resultMap.tableViewId;
2888
- // let fieldList = resultMap.fieldList || [];
2889
- // fieldList.forEach(fieldObj => {
2890
- // this.formFieldObj[fieldObj.id] = fieldObj;
2891
- // });
2892
- //
2893
- // this.initFlowTitle();
2894
- // }
2895
- // });
2896
- // });
2897
- // }
2898
- //工作流节点
2899
- this.startNodeKey = "Activity_draft";
2900
- this.startNodeKeyObj = {};
2901
- // let flowVersion = this.flowDefine.flowVersion || '1.0';
2902
- this.FLOW_GLOBAL.getFlowNodesByFlowId(this.flowData.flowId).then(nodeDatas => {
2903
- if (nodeDatas) {
2904
- nodeDatas.forEach(item => {
2905
- if (item.nodeLinkId.indexOf("Activity_draft") > -1) {
2906
- this.startNodeKey = item.nodeLinkId;
2907
- this.startNodeKeyObj[item.version] = item.nodeLinkId; //开始节点对应版本号
2908
- }
2909
- if(!this.flowVersionNodeObj[item.version]){
2910
- this.$set(this.flowVersionNodeObj,item.version,{});
2911
- }
2912
- this.$set(this.flowVersionNodeObj[item.version],item.nodeLinkId,item); //版本节点对象
2913
- // if(item.version == this.flowDefine.releaseVersion){ //节点信息只取最新版本
2914
- this.flowNodeIdToInfo[item.id] = item;
2915
- if(item.nodeType&&['StartEvent','ParallelGateway','SequenceFlow','ExclusiveGateway','InclusiveGateway'].indexOf(item.nodeType) == -1){
2916
- if(!this.flowNodeNameObj[item.nodeLinkId]){
2917
- this.$set(this.flowNodeNameObj,item.nodeLinkId,item.nodeName);
2918
- }else {
2919
- if(this.flowNodeNameObj[item.nodeLinkId] != item.nodeName){
2920
- this.flowNodeNameObj[item.nodeLinkId] = this.flowNodeNameObj[item.nodeLinkId] + "," + item.nodeName;
2921
- }
2922
- }
2923
- }
2924
- if(item.nodeType == "UserTask" && (item.nodeLinkId || "").indexOf("Activity_draft") > -1){
2925
- this.draftNodeId = item.id; // 草稿节点id
2926
- }
2927
- // }
2928
- this.allNodeInfo[item.id] = item;
2929
- // 行按钮
2930
- let listButton = JSON.parse(item.listButton || "[]") || [];
2931
- listButton = listButton.filter(item => !item.buttonId);
2932
- listButton.forEach(button => {
2933
- button.showName = button.showName ? button.showName : this.listButtonObj[button.type];
2934
- });
2935
- this.nodeListButtonObj[item.id] = listButton;
2936
-
2937
- // 表单按钮
2938
- let formButton = JSON.parse(item.formButton || "[]") || [];
2939
- formButton = formButton.filter(item => !item.buttonId);
2940
- formButton.forEach(button => {
2941
- button.showName = button.showName ? button.showName : this.formButtonObj[button.type];
2942
- });
2943
-
2944
- this.nodeFormButtonObj[item.id] = this.sortButtonArr(formButton);
2945
- this.nodeFormBtnObj[item.id] = this.formatterFormButton(formButton);
2946
-
2947
- // 自定义按钮
2948
- if(item.plFlowButtons) {
2949
- (item.plFlowButtons || []).forEach(button => {
2950
- this.diyButtonsObj[button.id] = button;
2951
- })
2952
- }
2953
-
2954
- let width = 0;
2955
- (this.nodeListButtonObj[item.id] || []).forEach(item => {
2956
- let nameLength = item.showName.length;
2957
- if (nameLength > 2) {
2958
- width += 100 + (nameLength - 2) * 12;
2959
- } else {
2960
- width += 100;
2961
- }
2962
- });
2963
- if (this.optColumnWidth < width) {
2964
- this.optColumnWidth = width;
2965
- }
2966
- });
2967
-
2968
- // 显示
2969
- this.isShowAgentSet = true;
2970
- this.$forceUpdate();
2971
- }
2972
- // 加载工作流脚本与工作流事件规则
2973
- this.initFlowScript().then(() => {
2974
- resolve(true);
2975
- })
2976
- });
2977
-
2978
- if (this.flowData.defaultTab) {
2979
- this.tabActive = this.flowData.defaultTab;
2980
- }
2981
-
2982
- });
2983
- });
2984
- },
2985
-
2986
1332
  getMultiFlowInfo() {
2987
1333
  return new Promise(resolve => {
2988
- let flowIdArr = this.flowId.split(",").filter(item => item);
2989
- flowIdArr.forEach(flowId => {
2990
- this.FLOW_GLOBAL.getFlowDefineById(flowId).then(flowDefine => {
2991
- this.flowDefineByFlowId[flowId] = flowDefine;
2992
- });
2993
- });
2994
-
2995
- const initFlowNodeFunc = flowIdArr.map(flowId => (() => this.FLOW_GLOBAL.getFlowNodesByFlowId(flowId)));
2996
- Promise.all(initFlowNodeFunc.map(func => func())).then(allFlowNodeArr => {
2997
- //工作流节点
2998
- this.startNodeKey = "Activity_draft";
2999
- for (const allFlowNode of allFlowNodeArr) {
3000
- this.startNodeKeyObj = {};
3001
- this.flowVersionNodeObj = {};
3002
- let flowId = allFlowNode[0].flowId;
3003
- this.flowDefine = this.flowDefineByFlowId[flowId];
3004
- (allFlowNode || []).forEach(item => {
3005
- if (item.nodeLinkId.indexOf("Activity_draft") > -1) {
3006
- this.startNodeKey = item.nodeLinkId;
3007
- this.startNodeKeyObj[item.version] = item.nodeLinkId; //开始节点对应版本号
3008
- }
3009
- if (!this.flowVersionNodeObj[item.version]) {
3010
- this.$set(this.flowVersionNodeObj, item.version, {});
3011
- }
3012
- this.$set(this.flowVersionNodeObj[item.version], item.nodeLinkId, item); //版本节点对象
3013
-
3014
- this.allNodeInfo[item.id] = item;
3015
- this.flowNodeIdToInfo[item.id] = item;
3016
- let nodeArr = ['StartEvent', 'ParallelGateway', 'SequenceFlow', 'ExclusiveGateway', 'InclusiveGateway'];
3017
- if (item.nodeType && nodeArr.indexOf(item.nodeType) === -1) {
3018
- if (!this.flowNodeNameObj[item.nodeLinkId]) {
3019
- let nodeName = item.nodeName;
3020
- if (this.flowId.includes(",")) {
3021
- nodeName = this.flowDefine.flowName + "-" + item.nodeName;
3022
- }
3023
- this.$set(this.flowNodeNameObj, item.nodeLinkId, nodeName);
3024
- } else {
3025
- if (this.flowNodeNameObj[item.nodeLinkId] !== item.nodeName) {
3026
- this.flowNodeNameObj[item.nodeLinkId] = this.flowNodeNameObj[item.nodeLinkId] + "," + item.nodeName;
3027
- }
3028
- }
3029
- }
3030
- if (item.nodeType === "UserTask" && (item.nodeLinkId || "").indexOf("Activity_draft") > -1) {
3031
- this.draftNodeId = item.id; // 草稿节点id
3032
- }
3033
- // 行按钮
3034
- let listButton = JSON.parse(item.listButton || "[]") || [];
3035
- listButton.forEach(button => {
3036
- button.showName = button.showName ? button.showName : this.listButtonObj[button.type];
3037
- });
3038
- this.nodeListButtonObj[item.id] = listButton;
3039
-
3040
- // 表单按钮
3041
- let formButton = JSON.parse(item.formButton || "[]") || [];
3042
- formButton.forEach(button => {
3043
- button.showName = button.showName ? button.showName : this.formButtonObj[button.type];
3044
- });
3045
-
3046
- this.nodeFormButtonObj[item.id] = this.sortButtonArr(formButton);
3047
- this.nodeFormBtnObj[item.id] = this.formatterFormButton(formButton);
3048
- });
3049
- this.$set(this.startNodeKeyObjByFlowId, flowId, this.startNodeKeyObj);
3050
- this.$set(this.flowVersionNodeObjByFlowId, flowId, this.flowVersionNodeObj);
3051
- // this.initFlowScript().then(() => {
3052
- // resolve(true);
3053
- // });
3054
- }
3055
- const initFlowScriptFunc = flowIdArr.map(flowId => () => this.initFlowScript(flowId));
3056
- Promise.all(initFlowScriptFunc.map(func => func())).then(scriptArr => {
3057
- (scriptArr || []).forEach(scriptEventObj => {
3058
- Object.keys(scriptEventObj).forEach(key => {
3059
- if (key) {
3060
- this.flowEventScriptByFlowId[key] = scriptEventObj[key];
3061
- }
3062
- });
3063
- });
3064
- }).catch(reason => {
3065
- console.log('流程脚本加载出错了', reason);
3066
- });
3067
- resolve(true);
3068
- });
1334
+ this.workFlowUtil.getMultiFlowInfo().then(flowDataInfos => {
1335
+ this.flowDefineByFlowId = flowDataInfos.flowDefineByFlowId;
1336
+ this.startNodeKeyObj = flowDataInfos.startNodeKeyObj;
1337
+ this.flowDefine = this.flowDefineByFlowId[this.flowId];
1338
+ this.startNodeKey = flowDataInfos.startNodeKey;
1339
+ this.allNodeInfo = flowDataInfos.allNodeInfo;
1340
+ this.flowNodeIdToInfo = flowDataInfos.flowNodeIdToInfo;
1341
+ this.flowNodeNameObj = flowDataInfos.flowNodeNameObj;
1342
+ this.draftNodeId = flowDataInfos.draftNodeId;
1343
+ this.nodeListButtonObj = flowDataInfos.nodeListButtonObj;
1344
+ this.nodeFormButtonObj = flowDataInfos.nodeFormButtonObj;
1345
+ this.nodeFormBtnObj = flowDataInfos.nodeFormBtnObj;
1346
+ this.startNodeKeyObjByFlowId = flowDataInfos.startNodeKeyObjByFlowId;
1347
+ this.flowVersionNodeObjByFlowId = flowDataInfos.flowVersionNodeObjByFlowId;
1348
+ this.flowEventScriptByFlowId = flowDataInfos.flowEventScriptByFlowId;
1349
+ resolve();
1350
+ })
3069
1351
  });
3070
1352
  },
3071
1353
 
3072
- setFlowScript(flowId) {
3073
- if (flowId) {
3074
- let scriptObj = this.flowEventScriptByFlowId[flowId] || {};
3075
- this.scriptObj = scriptObj.scriptObj || {};
3076
- this.newScriptObj = scriptObj.newScriptObj || {};
3077
- this.newEventObj = scriptObj.newEventObj || {};
1354
+ getFlowInfo() {
1355
+ return new Promise(resolve => {
1356
+ this.flowDefine.id = this.flowId;
1357
+ this.workFlowUtil.getFlowInfo().then(flowDataInfos => {
1358
+ this.operateType = flowDataInfos.operateType;
1359
+ this.tabActive = flowDataInfos.tabActive;
1360
+ this.flowDefine = flowDataInfos.flowDefine;
1361
+ this.startNodeKey = flowDataInfos.startNodeKey;
1362
+ this.startNodeKeyObj = flowDataInfos.startNodeKeyObj;
1363
+ this.flowVersionNodeObj = flowDataInfos.flowVersionNodeObj;
1364
+ this.allNodeInfo = flowDataInfos.allNodeInfo;
1365
+ this.flowNodeNameObj = flowDataInfos.flowNodeNameObj;
1366
+ this.flowNodeIdToInfo = flowDataInfos.flowNodeIdToInfo;
1367
+ this.nodeListButtonObj = flowDataInfos.nodeListButtonObj;
1368
+ this.nodeFormButtonObj = flowDataInfos.nodeFormButtonObj;
1369
+ this.nodeFormBtnObj = flowDataInfos.nodeFormBtnObj;
1370
+ this.optColumnWidth = flowDataInfos.optColumnWidth;
1371
+ this.diyButtonsObj = flowDataInfos.diyButtonsObj;
1372
+
1373
+ this.showModel = this.flowDefine.showModel;
1374
+ this.showInfo = this.flowDefine.showInfo;
1375
+
1376
+ // 显示
1377
+ this.isShowAgentSet = true;
1378
+ this.$forceUpdate();
1379
+ resolve();
1380
+ });
1381
+ if (this.flowData.defaultTab) {
1382
+ this.tabActive = this.flowData.defaultTab;
3078
1383
  }
3079
- },
1384
+ })
1385
+ },
1386
+
1387
+ setFlowTabInfo(result){
1388
+ this.isRefreshGetNextUsers = result.isRefreshGetNextUsers;
1389
+ this.tabTypeObj = result.tabTypeObj;
1390
+ },
3080
1391
 
3081
1392
  /**
3082
1393
  * 加载工作流脚本与工作流事件规则
3083
1394
  */
3084
1395
  initFlowScript(flowId){
3085
- if (flowId) {
3086
- this.flowDefine = this.flowDefineByFlowId[flowId] || {};
3087
- }
3088
- return new Promise(resolve => {
3089
- this.saspFlowAxios.all([
3090
- this.saspFlowAxios.post(this.api.plFlowScript.find,{"flowId": this.flowDefine.id}),
3091
- this.saspFlowAxios.post(this.api.plFlowEventDetail.findByFlowAndLeadFunc,{"flowId": this.flowDefine.id,"version":this.flowDefine.flowVersion || "1.0"})
3092
- ]).then(this.saspFlowAxios.spread((resScript, resEvent) => {
3093
- // 流程脚本
3094
- if(resScript){
3095
- let scriptDatas = resScript.data || [];
3096
- // 脚本order排序
3097
- scriptDatas = scriptDatas.sort(sortScript);
3098
- function sortScript(a,b){
3099
- return Number(a.scriptOrder) - Number(b.scriptOrder);
3100
- }
3101
- // 根据节点区分
3102
- let scriptObj = {};
3103
- let arr = ['vm','axios','CTX','formData','LOGINUSER','Ajax','nextNode','resolve'];
3104
- let serviceName = (window.SERVICE_NAME || {});
3105
- let adminServeName = serviceName.admin || "/admin/";
3106
- let formServeName = serviceName.form || "/form/";
3107
- let flowServeName = serviceName.flow || "/flow/";
3108
- let oaServeName = serviceName.oa || "/oaproject/";
3109
- scriptDatas.forEach(item => {
3110
- // 添加修改是单独区分开,没有节点概念
3111
- if(item.executePosition == "add" || item.executePosition == "update"){
3112
- if(!scriptObj[item.executePosition]){
3113
- scriptObj[item.executePosition] = {};
3114
- }
3115
- if(!scriptObj[item.executePosition][item.executeTime]){
3116
- scriptObj[item.executePosition][item.executeTime] = [];
3117
- }
3118
- try{
3119
- if(item.content){
3120
- let value = item.content;
3121
- // value = this.platStringUtil.replaceAll(value,"/admin/",adminServeName);
3122
- // value = this.platStringUtil.replaceAll(value,"/form/",formServeName);
3123
- // value = this.platStringUtil.replaceAll(value,"/flow/",flowServeName);
3124
- // value = this.platStringUtil.replaceAll(value,"/oaproject/",oaServeName);
3125
- // value = this.platStringUtil.replaceAll(value,"/oaadmin/",adminServeName);
3126
- // value = this.platStringUtil.replaceAll(value,"/oaform/",formServeName);
3127
- // value = this.platStringUtil.replaceAll(value,"/oaflow/",flowServeName);
3128
- value = this.replaceUrl(value);
3129
- item.content = value;
3130
- }
3131
- scriptObj[item.executePosition][item.executeTime].push(new Function(...arr,item.content));
3132
- }catch (e) {
3133
- console.log(item.content);
3134
- console.log("脚本编译失败!");
3135
- }
3136
- }else{
3137
- if(!scriptObj[item.nodeId]){
3138
- scriptObj[item.nodeId] = {};
3139
- }
3140
- let nodeObj = scriptObj[item.nodeId]; // 节点的所有内容
3141
- if(!nodeObj[item.executePosition]){
3142
- nodeObj[item.executePosition] = {};
3143
- }
3144
- let positionObj = nodeObj[item.executePosition]; // 脚本的执行位置,add,update,deal,等
3145
- if(!positionObj[item.executeTime]){
3146
- positionObj[item.executeTime] = [];
3147
- }
3148
- let executeTimeArr = positionObj[item.executeTime]; // 在该时间对应的脚本内容数组
3149
- try{
3150
- if(item.content){
3151
- let value = item.content;
3152
- // value = this.platStringUtil.replaceAll(value,"/admin/",adminServeName);
3153
- // value = this.platStringUtil.replaceAll(value,"/form/",formServeName);
3154
- // value = this.platStringUtil.replaceAll(value,"/flow/",flowServeName);
3155
- // value = this.platStringUtil.replaceAll(value,"/oaadmin/",adminServeName);
3156
- // value = this.platStringUtil.replaceAll(value,"/oaform/",formServeName);
3157
- // value = this.platStringUtil.replaceAll(value,"/oaflow/",flowServeName);
3158
- value = this.replaceUrl(value);
3159
- item.content = value;
3160
- }
3161
- executeTimeArr.push(new Function(...arr,item.content));
3162
- }catch (e) {
3163
- console.log(item.content);
3164
- console.log("脚本编译失败!");
3165
- }
3166
- }
3167
- })
3168
- this.scriptObj = scriptObj;
3169
- }
3170
- // 流程事件规则
3171
- if(resEvent){
3172
- let eventDataArr = resEvent.data || [];
3173
- let scriptObj = {};
3174
- let eventObj = {};
3175
- let arr = ['vm','axios','CTX','formData','LOGINUSER','Ajax','nextNode','resolve'];
3176
- let serviceName = (window.SERVICE_NAME || {});
3177
- let adminServeName = serviceName.admin || "/admin/";
3178
- let formServeName = serviceName.form || "/form/";
3179
- let flowServeName = serviceName.flow || "/flow/";
3180
- let oaServeName = serviceName.oa || "/oaproject/";
3181
- eventDataArr.forEach(item =>{
3182
- let executeTypeArr = (item.executeType || '').split(",");
3183
- executeTypeArr.forEach(executeType =>{
3184
- if (item.source == 'diy'){
3185
- //自定义
3186
- // 添加是单独区分开,没有节点概念
3187
- if(executeType == "addAfter"){
3188
- if(!scriptObj[executeType]){
3189
- scriptObj[executeType] = [];
3190
- }
3191
- try{
3192
- if(item.funcBody){ //方法体
3193
- let value = item.funcBody;
3194
- // value = this.platStringUtil.replaceAll(value,"/admin/",adminServeName);
3195
- // value = this.platStringUtil.replaceAll(value,"/form/",formServeName);
3196
- // value = this.platStringUtil.replaceAll(value,"/flow/",flowServeName);
3197
- // value = this.platStringUtil.replaceAll(value,"/oaproject/",oaServeName);
3198
- // value = this.platStringUtil.replaceAll(value,"/oaadmin/",adminServeName);
3199
- // value = this.platStringUtil.replaceAll(value,"/oaform/",formServeName);
3200
- // value = this.platStringUtil.replaceAll(value,"/oaflow/",flowServeName);
3201
- value = this.replaceUrl(value);
3202
- item.funcBody = value;
3203
- }
3204
- scriptObj[executeType].push(new Function(...arr,item.funcBody));
3205
- }catch (e) {
3206
- console.log(item.funcBody);
3207
- console.log("脚本编译失败!");
3208
- }
3209
- }else{
3210
- if(!scriptObj[item.nodeKey]){
3211
- scriptObj[item.nodeKey] = {};
3212
- }
3213
- let nodeObj = scriptObj[item.nodeKey]; // 节点的所有内容
3214
- if(!nodeObj[executeType]){
3215
- nodeObj[executeType] = [];
3216
- }
3217
- let positionArr = nodeObj[executeType]; // 脚本的执行位置,add,update,deal,等
3218
- try{
3219
- if(item.funcBody){
3220
- let value = item.funcBody;
3221
- // value = this.platStringUtil.replaceAll(value,"/admin/",adminServeName);
3222
- // value = this.platStringUtil.replaceAll(value,"/form/",formServeName);
3223
- // value = this.platStringUtil.replaceAll(value,"/flow/",flowServeName);
3224
- // value = this.platStringUtil.replaceAll(value,"/oaproject/",oaServeName);
3225
- // value = this.platStringUtil.replaceAll(value,"/oaadmin/",adminServeName);
3226
- // value = this.platStringUtil.replaceAll(value,"/oaform/",formServeName);
3227
- // value = this.platStringUtil.replaceAll(value,"/oaflow/",flowServeName);
3228
- value = this.replaceUrl(value);
3229
- item.funcBody = value;
3230
- }
3231
- positionArr.push(new Function(...arr,item.funcBody));
3232
- }catch (e) {
3233
- console.log(item.funcBody);
3234
- console.log("脚本编译失败!");
3235
- }
3236
- }
3237
- this.newScriptObj = scriptObj;
3238
- }else if(item.source == 'event'){ //事件规则
3239
- //获取响应配置
3240
- // 添加单独区分开,没有节点概念
3241
- if(executeType == "addAfter"){
3242
- if(!eventObj[executeType]){
3243
- eventObj[executeType] = {};
3244
- }
3245
- try{
3246
- if(item.resConfigurateion){ //响应配置
3247
- let resConfigurateionObj = JSON.parse(item.resConfigurateion || "{}");
3248
- let eventKey = resConfigurateionObj.eventKey;
3249
- if(!eventObj[executeType][eventKey]){
3250
- eventObj[executeType][eventKey] = [];
3251
- }
3252
- eventObj[executeType][eventKey].push(resConfigurateionObj); //复制响应配置
3253
- }
3254
- }catch (e) {
3255
- console.log(item.funcBody);
3256
- console.log("脚本编译失败!");
3257
- }
3258
- }else{
3259
- if(!eventObj[item.nodeKey]){
3260
- eventObj[item.nodeKey] = {};
3261
- }
3262
- let nodeObj = eventObj[item.nodeKey]; // 节点的所有内容
3263
- if(!nodeObj[executeType]){
3264
- nodeObj[executeType] = {};
3265
- }
3266
- let positionObj = nodeObj[executeType]; // 脚本的执行位置,add,update,deal,等
3267
- try{
3268
- if(item.resConfigurateion){//响应配置
3269
- let resConfigurateionObj = JSON.parse(item.resConfigurateion || "{}");
3270
- let eventKey = resConfigurateionObj.eventKey;
3271
- if(!positionObj[eventKey]){
3272
- positionObj[eventKey] = [];
3273
- }
3274
- positionObj[eventKey].push(resConfigurateionObj); //复制响应配\
3275
- }
3276
- }catch (e) {
3277
- console.log(item.funcBody);
3278
- console.log("脚本编译失败!");
3279
- }
3280
- }
3281
- this.newEventObj = eventObj;
3282
- }
3283
- });
3284
- });
3285
- }
3286
- // 结束
3287
- let obj = {"scriptObj": this.scriptObj, "newScriptObj": this.newScriptObj, "newEventObj": this.newEventObj};
3288
- resolve({[flowId]: obj});
3289
- }));
3290
- })
1396
+
3291
1397
  },
3292
1398
 
3293
1399
  replaceUrl(value){
3294
- if(window.ADMIN_URL && (value.indexOf("/admin/") > -1 || value.indexOf("/oaadmin/") > -1)){
3295
- if(value.indexOf("/admin/") > -1){
3296
- value = this.platStringUtil.replaceAll(value,"/admin/", window.ADMIN_URL + "/");
3297
- }else{
3298
- value = this.platStringUtil.replaceAll(value,"/oaadmin/",window.ADMIN_URL + "/");
3299
- }
3300
- }
3301
- if(window.FLOW_URL && (value.indexOf("/flow/") > -1 || value.indexOf("/oaflow/") > -1)){
3302
- if(value.indexOf("/flow/") > -1){
3303
- value = this.platStringUtil.replaceAll(value,"/flow/", window.FLOW_URL + "/");
3304
- }else{
3305
- value = this.platStringUtil.replaceAll(value,"/oaflow/",window.FLOW_URL + "/");
3306
- }
3307
- }
3308
- if(window.FORM_RENDER_URL && (value.indexOf("/form/") > -1|| value.indexOf("/oaform/") > -1)){
3309
- if(value.indexOf("/form/") > -1){
3310
- value = this.platStringUtil.replaceAll(value,"/form/", window.FORM_RENDER_URL + "/");
3311
- }else{
3312
- value = this.platStringUtil.replaceAll(value,"/oaform/",window.FORM_RENDER_URL + "/");
3313
- }
3314
- }
3315
- if(window.OA_URL && (value.indexOf("/project/") > -1 || value.indexOf("/oaproject/") > -1)){
3316
- if(value.indexOf("/project/") > -1){
3317
- value = this.platStringUtil.replaceAll(value,"/project/", window.OA_URL + "/");
3318
- }else{
3319
- value = this.platStringUtil.replaceAll(value,"/oaproject/",window.OA_URL + "/");
3320
- }
3321
- }
3322
- value = this.platStringUtil.replaceAll(value,"window.JAVA_URL","''");
3323
- value = this.platStringUtil.replaceAll(value,"JAVA_URL","''");
3324
- value = this.platStringUtil.replaceAll(value,"window.baseUrl","''");
3325
- value = this.platStringUtil.replaceAll(value,"baseUrl","''");
3326
- return value;
3327
1400
  },
3328
1401
 
3329
1402
  /**
3330
1403
  * 执行工作流脚本,为兼容1.0版本定制
3331
1404
  */
3332
- exeFlowEvent(executePosition,executeTime,nodeId,batchDataRef){
3333
- // executePosition(为方便1.0转换,与1.0保持相同):add/update/handle/nextStep/view/columnFormatter
3334
- // executePosition:add:['afterClick'],update:['afterClick'],handle:['afterClick'],
3335
- // nextStep:['afterClick','afterValidate','submitSuccess'],view:['afterClick'],
3336
- // (columnFormatter:['finished','end']?暂时不用)
3337
- let formData = {};
3338
- if(this.getFormInfo){
3339
- formData = this.getFormInfo();
3340
- }
3341
- // if(batchDataRef){//批量处理走单独方法
3342
- // formData=this.$refs[batchDataRef][0] && this.$refs[batchDataRef][0].optFormData || {};
3343
- // }else{
3344
- // formData=(this.$refs.flowInstDataInfo && this.$refs.flowInstDataInfo.optFormData) || {};
3345
- // }
3346
- // let CTX = window.JAVA_URL;
3347
- let CTX = "";
3348
- let paramValues = [this,this.saspFlowAxios,CTX,formData,this.loginUser,AjaxUtil,this.nextNode,null]; // 入参
3349
- if(executePosition == "add" || executePosition == "update"){
3350
- ((this.scriptObj[executePosition] || {})[executeTime] || []).forEach(event => {
3351
- event && event(...paramValues); // 执行事件
3352
- });
3353
- return;
3354
- }
3355
- let eventArr = ((this.scriptObj[nodeId] || {})[executePosition] || {})[executeTime] || [];
3356
- let result=true;
3357
- try{
3358
- eventArr.forEach(event => {
3359
- let eventResult=event && event(...paramValues); // 执行事件
3360
- if(eventResult ==false){
3361
- throw new Error("ending");//报错,就跳出循环
3362
- }
3363
- })
3364
- }catch (e) {
3365
- console.log(e);
3366
- result=false;
3367
- }
3368
- return result;
1405
+ exeFlowEvent(executePosition,executeTime,nodeId){
1406
+ return this.workFlowUtil.exeFlowEvent(executePosition,executeTime,nodeId);
3369
1407
  },
3370
1408
 
3371
1409
  // 自定义按钮窗口回调函数
3372
1410
  openDiyButtonEvent(type,row, button) {
3373
- let formData = {};
3374
- if(this.getFormInfo){
3375
- formData = this.getFormInfo();
3376
- }
3377
- if(type === 'list') {
3378
- this.execDiyBtnScripts(type,row,button.funcBody);
3379
- }else {
3380
- this.execDiyBtnScripts(type,formData,button.funcBody);
3381
- }
1411
+ this.workFlowUtil.openDiyButtonEvent(type,row,button);
3382
1412
  },
3383
1413
 
3384
1414
  judeDiyButton(tabActive,button) {
3385
- if(tabActive === 'pending') {
3386
- return button.position === 'table' && button.nodeId === this.currentInst.currentNode;
3387
- }
3388
- return button.position === 'table' && button.buttonSign.indexOf(tabActive) > -1;
3389
- },
3390
-
3391
- execDiyBtnScripts(type,data,fnBody) {
3392
- try {
3393
- fnBody = this.replaceUrl(fnBody);
3394
- fnBody = fnBody.replace(/\\'/g, "'").replace(/&quot;/g, "\"");
3395
- if(type === 'list') {
3396
- new Function('vm,rowData,Ajax', fnBody)(this,data,AjaxUtil);
3397
- }else {
3398
- new Function('vm,formData,Ajax', fnBody)(this,data,AjaxUtil);
3399
- }
3400
- } catch (e) {
3401
- console.log("自定义按钮事件执行错误!", e);
3402
- }
1415
+ return this.workFlowUtil.judeDiyButton(tabActive,button);
3403
1416
  },
3404
1417
 
3405
1418
  /**
3406
1419
  * 执行工作流新版本事件规则
3407
1420
  */
3408
- exeNewFlowEvent(executeType,nodeKey,batchDataRef){
3409
- let formData = {};
3410
- if(this.getFormInfo){
3411
- formData = this.getFormInfo();
3412
- }
3413
- // let formData;
3414
- // if(batchDataRef){//批量处理走单独方法
3415
- // formData=this.$refs[batchDataRef][0] && this.$refs[batchDataRef][0].optFormData || {};
3416
- // }else{
3417
- // formData=(this.$refs.flowInstDataInfo && this.$refs.flowInstDataInfo.optFormData) || {};
3418
- // }
3419
- //执行自定义脚本
3420
- // let CTX = window.JAVA_URL;
3421
- let CTX = "";
3422
- let paramValues = [this,this.saspFlowAxios,CTX,formData,this.loginUser,AjaxUtil,this.nextNode]; // 入参
3423
- if(executeType == "addAfter"){ //新增或后
3424
- (this.newScriptObj[executeType] || []).forEach(event => {
3425
- event && event(...paramValues); // 执行事件
3426
- });
3427
-
3428
- //执行事件规则脚本
3429
- Object.keys(this.newEventObj[executeType] || {}).forEach(eventKey =>{
3430
- if(this.installListObj[eventKey]
3431
- && this.installListObj[eventKey]["config"]
3432
- && this.installListObj[eventKey]["config"].methods.renderFlowConfig){
3433
- let affectContentArr = this.newEventObj[executeType][eventKey] || [];
3434
- affectContentArr.forEach(affectContent =>{
3435
- this.installListObj[eventKey]["config"].methods.renderFlowConfig(this,this.CTX,this.saspFlowAxios,this.nextNode,formData,affectContent);
3436
- });
3437
- }
3438
- });
3439
- return;
3440
- }
3441
- let eventArr = (this.newScriptObj[nodeKey] || {})[executeType] || [];
3442
- let result=true;
3443
- try{
3444
- eventArr.forEach(event => {
3445
- let eventResult=event && event(...paramValues); // 执行事件
3446
- if(eventResult ==false){
3447
- throw new Error("ending");//报错,就跳出循环
3448
- }
3449
- });
3450
-
3451
- let eventObj = (this.newEventObj[nodeKey] || {})[executeType] || {};
3452
- Object.keys(eventObj).forEach(eventKey =>{
3453
- if(this.installListObj[eventKey]
3454
- && this.installListObj[eventKey]["config"]
3455
- && this.installListObj[eventKey]["config"].methods.renderFlowConfig){
3456
- let affectContentArr = eventObj[eventKey] || [];
3457
- affectContentArr.forEach(affectContent =>{
3458
- this.installListObj[eventKey]["config"].methods.renderFlowConfig(this,this.CTX,this.saspFlowAxios,this.nextNode,formData,affectContent,executeType);
3459
- });
3460
- }
3461
- });
3462
- }catch (e) {
3463
- console.log(e);
3464
- result=false;
3465
- }
3466
-
3467
- // if(affect.eventKey
3468
- // && this.installListObj[affect.eventKey]
3469
- // && this.installListObj[affect.eventKey]["config"]
3470
- // && this.installListObj[affect.eventKey]["config"].methods.renderTableViewConfig){
3471
- // //调用渲染方法
3472
- // this.$set(affect,"field",field);//当前响应控件
3473
- // this.installListObj[affect.eventKey]["config"].methods.renderTableViewConfig(this,this.CTX,this.saspFlowAxios,this.dataAllObj,affect);
3474
- // }
3475
-
3476
-
3477
- return result;
3478
-
3479
- },
3480
-
3481
-
3482
- /**
3483
- * 格式化表单操作按钮
3484
- */
3485
- formatterFormButton(formButton) {
3486
-
3487
- let formBtnObj = {};
3488
- let formBtnArr = [];
3489
-
3490
- for (let [key, data] of Object.entries(this.formBtnObjDefault)) {
3491
- formBtnObj[key] = Object.assign({btnType: key}, data);
3492
- }
3493
-
3494
- let objTmp;
3495
- (formButton || []).forEach(data => {
3496
- if (formBtnObj[data.type]) {
3497
- objTmp = formBtnObj[data.type];
3498
- objTmp.show = (data.isUse != '0');
3499
- objTmp.text = data.showName || objTmp.text;
3500
- }
3501
- });
3502
-
3503
- for (let [key, data] of Object.entries(formBtnObj)) {
3504
- formBtnArr.push(data);
3505
- }
3506
- return formBtnArr;
3507
- },
3508
-
3509
- sortButtonArr(formButton) {
3510
- let objBtnOrder = {
3511
- "saveDraft": 1,
3512
- "nextStep": 2,
3513
- "completeSign": 3,
3514
- "turnSign": 4,
3515
- "retSpecified": 5,
3516
- "back": 6,
3517
- "stopped": 7,
3518
- "close": 8
3519
- };
3520
- (formButton || []).forEach(data => {
3521
- data.order = objBtnOrder[data.type] || data.order;
3522
- });
3523
- return formButton;
1421
+ exeNewFlowEvent(executeType,nodeKey){
1422
+ return this.workFlowUtil.exeNewFlowEvent(executeType,nodeKey);
3524
1423
  },
3525
1424
 
3526
1425
  tabClick(tab) {
@@ -3541,50 +1440,6 @@
3541
1440
  }
3542
1441
  },
3543
1442
 
3544
- initFlowObj() {//处理流程定义对象
3545
- this.isRefreshGetNextUsers = [];
3546
- let gatewayFields = this.flowDefine.gatewayFields || "";
3547
- this.isRefreshGetNextUsers = gatewayFields.split(",");
3548
- Object.keys(this.allNodeInfo).forEach(key => {
3549
- let obj = this.allNodeInfo[key];
3550
- if (obj.nodeType === "UserTask" && (!obj.nodeLinkId || obj.nodeLinkId.indexOf('Activity_draft') === -1)) {
3551
- if (obj.dealerType === "form" && obj.formField) {
3552
- this.isRefreshGetNextUsers.push(obj.formField);
3553
- }
3554
- if (obj.dealerType === "variable" && obj.variable) {
3555
- this.isRefreshGetNextUsers.push(obj.variable);
3556
- }
3557
- if (obj.dealerType === "interface" && obj.dealerUrlParam) {
3558
- let dealerUrlParam = JSON.parse(obj.dealerUrlParam || "[]");
3559
- dealerUrlParam.forEach(param => {
3560
- if (param.paramType === "variable") {
3561
- this.isRefreshGetNextUsers.push(param.paramVal);
3562
- }
3563
- })
3564
- }
3565
- }
3566
- });
3567
- if (!this.flowId.includes(",")) {
3568
- let tabSetting = JSON.parse(this.flowDefine.tabSetting);
3569
- tabSetting.forEach(data => {
3570
- this.$set(this.tabTypeObj, data.type, data);
3571
- });
3572
- Object.keys(this.tabTypeObj).forEach(key => {
3573
- let objTemp = this.tabTypeObj[key];
3574
- objTemp.tabName = objTemp["showName"] || objTemp["name"];
3575
- });
3576
- let tabTitleType = this.flowDefine.tabTitleType;
3577
- if (tabTitleType === "1") {
3578
- this.tabTypeObj["showtTabText"] = true;
3579
- this.tabTypeObj["showTabIcon"] = true;
3580
- } else if (tabTitleType === "2") {
3581
- this.tabTypeObj["showtTabText"] = true;
3582
- } else if (tabTitleType === "3") {
3583
- this.tabTypeObj["showTabIcon"] = true;
3584
- }
3585
- }
3586
- },
3587
-
3588
1443
  /**
3589
1444
  * 初始化流程代理
3590
1445
  */
@@ -3644,71 +1499,6 @@
3644
1499
  }
3645
1500
  },
3646
1501
 
3647
- /**
3648
- * 打开退回节点窗口
3649
- */
3650
- retSpecified(currentInst){
3651
- let flowInstId = currentInst.flowInstId;
3652
- this.saspFlowAxios.post(this.api.plFlowInst.getBackData,{"flowInstId":flowInstId}).then(res => {
3653
- this.backNodeArr = [];
3654
- if(res.data.operateSuccess){
3655
- let result = res.data.resultObject || [];
3656
- if(result.length == 0){
3657
- this.$message.warning("没有可以退回的节点!");
3658
- return;
3659
- }
3660
- let arr = [];
3661
- result.forEach((item,index) =>{
3662
- // if(index != res.data.resultObject.length -1){
3663
- // this.backNodeArr.push(item);
3664
- // }
3665
- if(item["endTimeNull"]){
3666
- arr.push(item);
3667
- }else{
3668
- this.backNodeArr.push(item);
3669
- }
3670
- });
3671
- this.backNodeArr = this.backNodeArr.concat(arr);
3672
- this.backNodeArr.splice(this.backNodeArr.length - 1,1);
3673
- this.isDisabled2 = true;
3674
- this.backMsg = "";
3675
- this.backNodeId = "";
3676
- this.backDialogVisible = true;
3677
- }
3678
- })
3679
- },
3680
-
3681
- /**
3682
- * 执行退回
3683
- */
3684
- beginBack(){
3685
- if(!this.backNodeId){
3686
- this.$message.error("没有选择要退回的节点!");
3687
- return;
3688
- }
3689
- this.isDisabled2 = false;
3690
- this.saspFlowAxios.post(this.api.plFlowInst.skipToNode,
3691
- {"instId":this.currentInst.flowInstId,"skipNode":this.backNodeId,
3692
- "backMsg":this.backMsg,"skipStatus":"skip"}).then(res => {
3693
- if(res.data.operateSuccess){
3694
- this.initTabNum();
3695
- this.$message.success("退回成功!");
3696
- this.backDialogVisible = false;
3697
- this.isDisabled2 = true;
3698
- this.isDisabled['retSpecified'] = true;
3699
- this.flowInstDataDialog = false;
3700
- if (this.flowBatchPendingDialog) {
3701
- this.batchTabRemove(this.currentInst.dataId);
3702
- } else {
3703
- this.tabCrudSearch();
3704
- }
3705
- this.initTabNum();
3706
- }else{
3707
- this.$message.error("退回失败!");
3708
- this.isDisabled['retSpecified'] = true;
3709
- }
3710
- })
3711
- },
3712
1502
  isOldData(btnObj){
3713
1503
  if(this.currentRowData.isOldData == "1"){
3714
1504
  let type = btnObj["btnType"];
@@ -3724,7 +1514,7 @@
3724
1514
 
3725
1515
  <style lang="scss" scoped>
3726
1516
  /deep/ .el-tabs__content {
3727
- height: calc(100% - 60px);
1517
+ height: calc(100% - 70px);
3728
1518
  }
3729
1519
 
3730
1520
  .el-tab-pane {