sasp-flow-render 1.1.3 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,39 @@
1
1
  <template>
2
2
  <div class="flow-inst" style="height: 100%;background-color: white;">
3
- <div class="flow-chart" style="z-index:100;position:absolute;top:9px;right:0;text-align: right;">
3
+ <div class="flow-chart" style="z-index:100;position:absolute;top:9px;right:0;text-align: right;" v-if="!flowId.includes(',')">
4
4
  <el-button size="mini" style="margin-right: 12px;"
5
5
  type="warning" round icon="saspiconfont pl-icon-gongzuoliuchengtu"
6
6
  @click="openFlowChart()">流程图
7
7
  </el-button>
8
8
  </div>
9
9
 
10
+ <div style="height: 100%" v-if="flowId.includes(',')">
11
+ <flow-inst-list ref="pendingRef"
12
+ v-if="initSuccess"
13
+ tab-type="pending"
14
+ :flow-define="flowDefine"
15
+ :flow-ids="flowId"
16
+ :userArr="userArr"
17
+ :userMap="userMap"
18
+ :form-id="formInfo.formId"
19
+ :flow-node-id-to-info="flowNodeIdToInfo"
20
+ :flow-node-name-obj="flowNodeNameObj"
21
+ :node-list-button-obj="nodeListButtonObj"
22
+ :opt-column-width="optColumnWidth"
23
+ :show-model="showModel"
24
+ :start-node-key-obj="startNodeKeyObj"
25
+ :flow-version-node-obj="flowVersionNodeObj"
26
+ @initTabNum="initTabNum"
27
+ :open-flow-chart="openFlowChart"
28
+ :open-flow-record="openFlowRecord"
29
+ :open-update-flow-form="openUpdateFlowForm"
30
+ :open-batch-update-flow-form="openBatchUpdateFlowForm"
31
+ :openNewBatchUpdateFlowForm="openNewBatchUpdateFlowForm"
32
+ @setDataValue="setDataValue"
33
+ >
34
+ </flow-inst-list>
35
+ </div>
36
+ <div style="height: 100%" v-else>
10
37
  <el-tabs v-model="tabActive" v-if="initSuccess" type="border-card" @tab-click="tabClick"
11
38
  style="width: 100%;height: 100%;">
12
39
  <el-tab-pane name="draft" v-if="tabShow('draft')" style="height: 100%;" :lazy="true">
@@ -39,10 +66,10 @@
39
66
  </flow-inst-list>
40
67
  </el-tab-pane>
41
68
  <el-tab-pane name="pending" v-if="tabShow('pending')" style="height: 100%;">
42
- <span slot="label">
43
- <i v-if="tabTypeObj['showTabIcon']" :class="tabTypeObj['pending'].iconShow"></i>
44
- {{tabTypeObj['showtTabText']? tabTypeObj['pending'].tabName : ''}}
45
- <span style="color: red">({{numberObj['pending']}})</span>
69
+ <span slot="label">
70
+ <i v-if="tabTypeObj['showTabIcon']" :class="tabTypeObj['pending'].iconShow"></i>
71
+ {{ tabTypeObj['showtTabText'] ? tabTypeObj['pending'].tabName : '' }}
72
+ <span style="color: red">({{ numberObj['pending'] }})</span>
46
73
  </span>
47
74
  <flow-inst-list ref="pendingRef"
48
75
  tab-type="pending"
@@ -58,11 +85,13 @@
58
85
  :start-node-key-obj="startNodeKeyObj"
59
86
  :flow-version-node-obj="flowVersionNodeObj"
60
87
  @initTabNum="initTabNum"
61
-
88
+ :getFormDataByDataIds="getFormDataByDataIds"
62
89
  :open-flow-chart="openFlowChart"
63
90
  :open-flow-record="openFlowRecord"
64
91
  :open-update-flow-form="openUpdateFlowForm"
65
92
  :open-batch-update-flow-form="openBatchUpdateFlowForm"
93
+ :openNewBatchUpdateFlowForm="openNewBatchUpdateFlowForm"
94
+ @setDataValue="setDataValue"
66
95
  >
67
96
  </flow-inst-list>
68
97
  </el-tab-pane>
@@ -118,7 +147,7 @@
118
147
  </flow-inst-list>
119
148
  </el-tab-pane>
120
149
  <el-tab-pane name="rescinded" v-if="tabShow('rescinded')" :lazy="true">
121
- <span slot="label">
150
+ <span slot="label">
122
151
  <i v-if="tabTypeObj['showTabIcon']" :class="tabTypeObj['rescinded'].iconShow"></i>
123
152
  {{tabTypeObj['showtTabText']? tabTypeObj['rescinded'].tabName : ''}}
124
153
  <span style="color: red">({{numberObj['rescinded']}})</span>
@@ -143,7 +172,7 @@
143
172
  </flow-inst-list>
144
173
  </el-tab-pane>
145
174
  <el-tab-pane name="discontinue" v-if="tabShow('discontinue')" :lazy="true">
146
- <span slot="label">
175
+ <span slot="label">
147
176
  <i v-if="tabTypeObj['showTabIcon']" :class="tabTypeObj['discontinue'].iconShow"></i>
148
177
  {{tabTypeObj['showtTabText']? tabTypeObj['discontinue'].tabName : ''}}
149
178
  <span style="color: red">({{numberObj['discontinue']}})</span>
@@ -168,7 +197,7 @@
168
197
  </flow-inst-list>
169
198
  </el-tab-pane>
170
199
  <el-tab-pane name="flowQuery" v-if="tabShow('flowQuery')" :lazy="true">
171
- <span slot="label">
200
+ <span slot="label">
172
201
  <i v-if="tabTypeObj['showTabIcon']" :class="tabTypeObj['flowQuery'].iconShow"></i>
173
202
  {{tabTypeObj['showtTabText']? tabTypeObj['flowQuery'].tabName : ''}}
174
203
  </span>
@@ -193,6 +222,7 @@
193
222
  </flow-inst-list>
194
223
  </el-tab-pane>
195
224
  </el-tabs>
225
+ </div>
196
226
 
197
227
  <!--处理、修改、查看流程信息弹窗-->
198
228
  <el-dialog :close-on-click-modal=false top="5vh" width="90%" height="90%" :visible.sync="flowInstDataDialog" append-to-body
@@ -220,7 +250,7 @@
220
250
  <!-- </table-form-render>-->
221
251
 
222
252
  <div slot="footer" style="height:31px;" class="dialog-footer">
223
- <div>
253
+ <div v-if="!formSearchObj.isNewSelectBatchDeal">
224
254
  <el-button v-for="btn in formBtnArr" @click="btn.method" :disabled="isDisabled[btn.btnType]?false:true"
225
255
  v-show="btn.show && ((formInfo.opt != 'view') || (formInfo.opt=='view' && btn.isView))"
226
256
  :key="btn.btnType"
@@ -230,6 +260,14 @@
230
260
  {{btn.text}}
231
261
  </el-button>
232
262
  </div>
263
+ <div v-else>
264
+ <el-button v-for="btn in formNewBtnArr" @click="btn.method"
265
+ :key="btn.btnType"
266
+ :type="btn.type"
267
+ :icon="btn.icon"
268
+ size="small">{{btn.text}}
269
+ </el-button>
270
+ </div>
233
271
  </div>
234
272
  </el-dialog>
235
273
 
@@ -269,7 +307,23 @@
269
307
  </div>
270
308
  </el-dialog>
271
309
 
310
+ <!--新版批量处理信息弹窗-->
311
+ <el-dialog title="快捷处理" :close-on-click-modal=false top="5vh" width="90%" height="90%" :visible.sync="flowBatchSelectPendingDialog"
312
+ @close="newBatchDealClose" class="batchSelectDialog" append-to-body>
313
+ <flow-new-batch-deal v-if="flowBatchSelectPendingDialog" :formSearchObj="formSearchObj" ref="flowNewBatchDealRef"
314
+ :formDataObj="formDataObj" :allNodeInfo="allNodeInfo" :newBatchDealSubmit="newBatchDealSubmit"
315
+ @openCurrUpdateFlowForm="openCurrUpdateFlowForm" :isRefreshGetNextUsers="isRefreshGetNextUsers"
316
+ :userMap="userMap" :fieldSysDataObj="fieldSysDataObj" :sysDataObj="sysDataObj" :formFieldObj="formFieldObj"
317
+ :currentPage="currentPage" :total="total" :pages="pages" @changePage="changePage"
318
+ >
319
+ </flow-new-batch-deal>
320
+ <div slot="footer" class="dialog-footer">
321
+ <el-button type="primary" size="small" @click="newBatchDealAllSubmit">快速提交</el-button>
322
+ <el-button size="small" @click="flowBatchSelectPendingDialog = false">取消</el-button>
323
+ </div>
324
+ </el-dialog>
272
325
 
326
+ <!--流程下一步处理人选择弹窗-->
273
327
  <el-dialog :close-on-click-modal=false :title="'下一步' + (nextNodeName ? (isProceedNext?' -> ' + nextNodeName:'->等待他人处理') : '')"
274
328
  :top="nextNode.nextType != 'inclusiveGateway' ? '20vh': '10vh'" append-to-body
275
329
  width="500px" :visible.sync="nextSteptUserDialog" @closed="closeNextSteptUserDialog">
@@ -390,7 +444,7 @@
390
444
  :visible.sync="flowChartObj.dialogVisible"
391
445
  width="90%" height="90%"
392
446
  top="5vh">
393
- <flow-chart :flow-id="flowId + ''" :inst-id="flowChartObj.instId + ''"
447
+ <flow-chart :flow-id="flowChartObj.flowId + ''" :inst-id="flowChartObj.instId + ''"
394
448
  :link-proc-id="flowChartObj.linkProcId + ''"
395
449
  :is-release="flowChartObj.isRelease"
396
450
  v-if="flowChartObj.dialogVisible"></flow-chart>
@@ -446,18 +500,17 @@
446
500
  import FlowInstList from "./flowInstList";
447
501
  import FlowChart from "../flowChart";
448
502
  import FlowRoamRecord from "../flowRoamRecords";
449
- import {AjaxUtil} from 'sasp-base';
450
-
451
- // import {Replace} from "sasp-base";
503
+ import {AjaxUtil, Replace} from 'sasp-base';
452
504
  import RoamRecord from "../roamRecord";
453
505
  import UserSelect from "../userSelect";
506
+ import flowNewBatchDeal from "../../components/flowNewBatchDeal.vue";
454
507
  export default {
455
508
  name: "flow-inst-tab",
456
509
  components: {
457
510
  UserSelect,
458
511
  RoamRecord,
459
512
  FlowRoamRecord,
460
- FlowChart, FlowInstList
513
+ FlowChart, FlowInstList, flowNewBatchDeal
461
514
  },
462
515
  props: {
463
516
  flowId: {type: String, default: ''},
@@ -476,6 +529,10 @@
476
529
  formImpMethod:{type: Function,default: null},
477
530
  flowImpParamObj: {type: Object,default: () => ({})},
478
531
  downloadTemplate: {type: Function, default: null},
532
+ getFormDataByDataIds: {type: Function, default: null},
533
+ saveBatchDealFormData: {type: Function, default: null},
534
+ formAboutInfoObj: {type: Object, default: () => ({})},
535
+ sysDataObj: {type: Object, default: () => ({})},
479
536
  },
480
537
  data() {
481
538
  let vm = this;
@@ -491,6 +548,7 @@
491
548
  loginUser: {},//当前登录用户
492
549
  userDept: {},//当前登录用户所在部门信息
493
550
  flowDefine: {},
551
+ flowDefineByFlowId: {},
494
552
  flowNodeIdToInfo: {},//key为id
495
553
  flowNodeNameObj:{}, //节点名称对应节点id分组
496
554
  draftNodeId:"", // 草稿节点id
@@ -517,6 +575,8 @@
517
575
 
518
576
  // 批量处理
519
577
  flowBatchPendingDialog: false,
578
+ // 选择性的批量多条一次性处理
579
+ flowBatchSelectPendingDialog: false,
520
580
  batchUpdateFormInfo: {
521
581
  formShow: false,
522
582
  dataRows: [],
@@ -850,8 +910,10 @@
850
910
  isShowAgentSet:false,//是否显示流程设置
851
911
  loadAgentSuccess:false,//是否显示流程设置
852
912
 
853
- startNodeKeyObj:{}, //当前开始节点 key 和对应版本号
854
- flowVersionNodeObj:{}, //版本号对应的节点对象
913
+ startNodeKeyObj: {}, //当前开始节点 key 和对应版本号
914
+ startNodeKeyObjByFlowId: {},
915
+ flowVersionNodeObj: {}, //版本号对应的节点对象
916
+ flowVersionNodeObjByFlowId: {},
855
917
  parentListViewId:"",
856
918
  parentTableViewId:"",
857
919
  scriptObj:{},
@@ -862,9 +924,49 @@
862
924
  workListViews:{},
863
925
  workTableViews:{},
864
926
  currNodeName: "", //当前节点名称
865
- nextUserInfo:{}, // 下一步处理人的信息
866
- dataId:"", // 表单数据id
867
- disableSign:false, // 禁用加签转签按钮
927
+ nextUserInfo: {}, // 下一步处理人的信息
928
+ dataId: "", // 表单数据id
929
+ disableSign: false, // 禁用加签转签按钮
930
+ formSearchObj: {
931
+ taskNode: "",
932
+ flowNewBatchDealArr: [],
933
+ isNewSelectBatchDeal: false,
934
+ loading: true,
935
+ isInit: false
936
+ },
937
+ formDataObj: {},
938
+ formNewBtnArr: [],
939
+ newBatchDealBtnObj: {
940
+ close: {
941
+ text: "关闭",
942
+ type: "",
943
+ icon: "el-icon-close",
944
+ show: true,
945
+ isView: true,
946
+ method: () => {
947
+ this.flowInstDataDialog = false;
948
+ this.flowBatchPendingDialog = false;
949
+ }
950
+ },
951
+ newBatchDealSave: {
952
+ text: "保存",
953
+ type: "primary",
954
+ icon: "el-icon-check",
955
+ show: true,
956
+ isView: true,
957
+ method: () => {
958
+ this.saveNewBatchDealFormData();
959
+ }
960
+ }
961
+ },
962
+ newBatchDealCurrDataId: "", // 新批量处理当前点击行dataId
963
+ isRefreshGetNextUsers: [], // 是否要刷新下一步处理人的字段,网关字段,表单,变量
964
+ fieldSysDataObj: {},
965
+ flowNewBatchDealDataIds: "",
966
+ currentPage: 1, //当前页
967
+ pages: 1, //总页数
968
+ total: 0, //总条数
969
+ pageSize: 50, //每页多少条
868
970
  }
869
971
  },
870
972
  watch:{
@@ -891,17 +993,56 @@
891
993
  this.isShowAgentSet = false;
892
994
  this.loginUser = this.FLOW_CACHE_GLOBAL.getLoginUser();
893
995
  this.userDept = this.FLOW_CACHE_GLOBAL.getLoginDept();
894
- this.initTabOpts(); // 初始化外部选项卡权限
895
-
896
- this.getFlowInfo().then(res => {
897
- this.initSuccess = true;
898
- this.initflowObj();
899
- this.getFlowAgent(); //加载流程代理
900
- });
901
- this.initTabNum();
902
- // this.initWorkStageTurnOn();
996
+
997
+ if (this.flowId.includes(",")) {
998
+ this.getMultiFlowInfo().then(() => {
999
+ this.initSuccess = true;
1000
+ this.getFlowAgent();
1001
+ });
1002
+ }else {
1003
+ this.initTabOpts(); // 初始化外部选项卡权限
1004
+ this.getFlowInfo().then(res => {
1005
+ this.initSuccess = true;
1006
+ this.initFlowObj();
1007
+ this.getFlowAgent(); //加载流程代理
1008
+ // this.initFieldSysData();
1009
+ });
1010
+ this.initTabNum();
1011
+ }
903
1012
  },
904
1013
  methods: {
1014
+ // 新批量处理关闭弹框时数据重做的回调
1015
+ newBatchDealClose() {
1016
+ Object.assign(this.formSearchObj, {isNewSelectBatchDeal: false, taskNode: ""});
1017
+ this.currentPage = 1;
1018
+ // let flowInstListVm = this.$refs["pendingRef"];
1019
+ // if (flowInstListVm) {
1020
+ // flowInstListVm.initFormDataByDataIds();
1021
+ // // flowInstListVm.initNewBatchDealFunc();
1022
+ // }
1023
+ },
1024
+
1025
+ setDataValue(key, value) {
1026
+ if (key && typeof key === "string") {
1027
+ this[key] = value;
1028
+ }
1029
+ },
1030
+
1031
+ initFieldSysData() {
1032
+ this.formFieldObj = this.formAboutInfoObj["formFieldObj"] || {};
1033
+ let configInfoArr = this.formAboutInfoObj["formControlConfigArr"] || [];
1034
+ let controlTypeArr = ["radio", "checkbox", "select"];
1035
+ configInfoArr.forEach(item => {
1036
+ if (controlTypeArr.includes(item.controlType) && typeof item.specialSet === "string") {
1037
+ let specialSet = JSON.parse(item.specialSet);
1038
+ // console.log('specialSet', specialSet);
1039
+ let paramsKey = item.controlType + "Type";
1040
+ if (specialSet[paramsKey] === "sysData") {
1041
+ this.fieldSysDataObj[item.fieldId] = true;
1042
+ }
1043
+ }
1044
+ });
1045
+ },
905
1046
 
906
1047
  /**
907
1048
  * 打开[添加]窗口
@@ -983,6 +1124,12 @@
983
1124
  initUpdateFlowForm(row) {
984
1125
  this.currentRowData = row;
985
1126
  this.currNodeName = 'noEnd';
1127
+ if (this.flowId.includes(',')) {
1128
+ this.flowDefine = this.flowDefineByFlowId[row.flowId];
1129
+ this.startNodeKeyObj = this.startNodeKeyObjByFlowId[row.flowId];
1130
+ this.flowVersionNodeObj = this.flowVersionNodeObjByFlowId[row.flowId];
1131
+ // Object.assign(this.formInfo, this.formInfoByFlowId[row.flowId]);
1132
+ }
986
1133
 
987
1134
  return new Promise(resolve => {
988
1135
  let startNodeKey = this.startNodeKeyObj[row.version];
@@ -1014,7 +1161,7 @@
1014
1161
  this.$nextTick(() => {
1015
1162
  this.exeFlowEvent(executePosition,"afterClick",row.currentNode);
1016
1163
  let currentNodeObj = this.flowNodeIdToInfo[row.currentNode] ||{};
1017
- if(currentNodeObj.openEvent== '1'){ //开启事件
1164
+ if(currentNodeObj.openEvent === '1'){ //开启事件
1018
1165
  this.exeNewFlowEvent("editAfter",currentNodeObj.nodeLinkId ||'');//新事件规则
1019
1166
  }
1020
1167
  })
@@ -1076,6 +1223,322 @@
1076
1223
  });
1077
1224
  },
1078
1225
 
1226
+ // 新批量处理弹框回调事件
1227
+ openNewBatchUpdateFlowForm() {
1228
+ // console.log('this.sysDataObj', this.sysDataObj, this.loginUser);
1229
+ Object.assign(this.formSearchObj, {
1230
+ flowNewBatchDealArr: [],
1231
+ isNewSelectBatchDeal: false,
1232
+ loading: true,
1233
+ isInit: false
1234
+ });
1235
+ this.initFieldSysData();
1236
+ // 处理按钮渲染
1237
+ let btnTypeArr = ["newBatchDealSave", "close"];
1238
+ let btnArr = [];
1239
+ btnTypeArr.forEach(item => {
1240
+ btnArr.push(this.newBatchDealBtnObj[item]);
1241
+ });
1242
+ this.formNewBtnArr = btnArr;
1243
+ this.initNewBatchDeal().then(arr => {
1244
+ Object.assign(this.formSearchObj, {
1245
+ isInit: true,
1246
+ });
1247
+ this.getFormDataByDataIds(this.formInfo.formId, this.flowNewBatchDealDataIds).then(res => {
1248
+ this.formDataObj = res || {};
1249
+ arr.forEach(flowInst => {
1250
+ let formData = this.formDataObj[flowInst.dataId] || {};
1251
+ // 解析自定义流程概要
1252
+ this.currentStartUser = this.userMap[flowInst.startUserId] || "";
1253
+ this.currentStartTime = flowInst.startTime;
1254
+ flowInst["outlineResult"] = this.getFlowSummary(formData, flowInst.outlineResult);
1255
+ if ((flowInst.settingInfo || []).length > 0) {
1256
+ flowInst.settingInfo.forEach(setInfo => {
1257
+ let defaultVal;
1258
+ let anyVariable = "";
1259
+ if (setInfo.fieldType === "checkbox") {
1260
+ anyVariable = [];
1261
+ if (formData[setInfo.field] && typeof formData[setInfo.field] === "string") {
1262
+ formData[setInfo.field] = JSON.parse(formData[setInfo.field]);
1263
+ }
1264
+ }
1265
+ if (setInfo.defaultValue) {
1266
+ if (setInfo.defaultValueType === "formInfo") {
1267
+ setInfo.defaultValue = formData[setInfo.defaultValue];
1268
+ }
1269
+ if (setInfo.defaultValueType === "loginInfo") {
1270
+ let userInfo = Object.assign({}, this.loginUser, {"userId": this.loginUser.id});
1271
+ setInfo.defaultValue = userInfo[setInfo.defaultValue];
1272
+ }
1273
+ }
1274
+ if (setInfo.defaultValueType === "sysDate") {
1275
+ anyVariable = this.DATE_UTIL.formaterDateOrTime(new Date(), setInfo.fieldFormat);
1276
+ }
1277
+ let defaultValue = formData[setInfo.field] || setInfo.defaultValue;
1278
+ defaultVal = defaultValue || anyVariable;
1279
+ // if (setInfo.defaultValueType === "sysDate") {
1280
+ // defaultVal = this.DATE_UTIL.formaterDateOrTime(new Date(), setInfo.fieldFormat);
1281
+ // }
1282
+ // 给列表审核信息赋默认值
1283
+ setInfo.defaultValue = defaultVal;
1284
+ formData[setInfo.field] = defaultVal;
1285
+ });
1286
+ }
1287
+ });
1288
+ Object.assign(this.formSearchObj, {
1289
+ flowNewBatchDealArr: arr,
1290
+ isNewSelectBatchDeal: true,
1291
+ loading: false
1292
+ });
1293
+ });
1294
+ });
1295
+ this.flowBatchSelectPendingDialog = true;
1296
+ },
1297
+
1298
+ // 获取批量流程数据
1299
+ initNewBatchDeal() {
1300
+ return new Promise(resolve => {
1301
+ this.saspFlowAxios.post(this.api.plFlowInst.findInstPending, {
1302
+ flowId: this.flowDefine.id,
1303
+ currentNode: this.formSearchObj.taskNode,
1304
+ nodeType: "pending",
1305
+ dealUserId: this.loginUser.id,
1306
+ flowStatus: "1",
1307
+ flowVar: "1",
1308
+ rows: this.pageSize,
1309
+ page: this.currentPage
1310
+ }).then(res => {
1311
+ // console.log('initNewBatchDeal', res);
1312
+ this.total = res.data.total;
1313
+ this.pages = res.data.pages;
1314
+ let flowNewBatchDeal = [];
1315
+ this.flowNewBatchDealDataIds = "";
1316
+ if (res.data && res.data.records.length > 0) {
1317
+ res.data.records.forEach((item, index) => {
1318
+ if (item.openBatch === "1") {
1319
+ item.settingInfo = JSON.parse(item.settingInfo);
1320
+ }
1321
+ item['isEdited'] = false;
1322
+ // item['isLoading'] = true;
1323
+ item['nextDealUsers'] = {};
1324
+ if (!index) {
1325
+ this.flowNewBatchDealDataIds += item.dataId;
1326
+ }else {
1327
+ this.flowNewBatchDealDataIds += "," + item.dataId;
1328
+ }
1329
+ flowNewBatchDeal.push(item);
1330
+ });
1331
+ }
1332
+ resolve(flowNewBatchDeal);
1333
+ });
1334
+ });
1335
+ },
1336
+
1337
+ changePage(currPage) {
1338
+ this.currentPage = currPage;
1339
+ this.openNewBatchUpdateFlowForm();
1340
+ },
1341
+
1342
+ // 新批量处理当前行点击编辑按钮打开弹框回调事件
1343
+ openCurrUpdateFlowForm(row) {
1344
+ this.openUpdateFlowForm(row, "update");
1345
+ // this.openBatchUpdateFlowForm(arr);
1346
+ },
1347
+
1348
+ saveNewBatchDealFormData() {
1349
+ this.saveFormInfo().then(result => {
1350
+ // console.log('保存方法1', result);
1351
+ if (result) {
1352
+ let flowNewBatchDealVm = this.$refs.flowNewBatchDealRef;
1353
+ // 数据保存成功,更改行数据
1354
+ let formData = this.formDataObj[result.ID] || {};
1355
+ let flowObj = this.formSearchObj.flowNewBatchDealArr.filter(item => item.dataId === result.ID)[0];
1356
+ // 刷新行数据
1357
+ let keysArr = Object.keys(result);
1358
+ Object.keys(formData).forEach(key => {
1359
+ if(keysArr.indexOf(key) > -1){
1360
+ if(keysArr.indexOf(key + "_SASP_SYS_DATA_ID") > -1){
1361
+ formData[key] = result[key + "_SASP_SYS_DATA_ID"];
1362
+ }else{
1363
+ formData[key] = result[key];
1364
+ }
1365
+ }
1366
+ })
1367
+ // 刷新配置信息
1368
+ if (flowObj.settingInfo && flowObj.settingInfo.length > 0) {
1369
+ flowObj.settingInfo.forEach(settingObj => {
1370
+ let defaultValue = result[settingObj.field] || settingObj.defaultValue;
1371
+ let defaultVal = defaultValue || (settingObj.options[0] || {}).value;
1372
+ // 给列表审核信息赋默认值
1373
+ // this.$set(settingObj, "defaultValue", defaultVal || "");
1374
+ settingObj.defaultValue = defaultVal || "";
1375
+ formData[settingObj.field] = defaultVal || "";
1376
+ });
1377
+ }
1378
+ this.$set(flowObj, "isEdited", true);
1379
+ // console.log('flowObj', flowObj, flowNewBatchDealVm);
1380
+ this.flowInstDataDialog = false;
1381
+ // 刷新下一步处理人
1382
+ if (flowNewBatchDealVm) {
1383
+ flowNewBatchDealVm.initFlowBatchDeal([flowObj]);
1384
+ }
1385
+ }
1386
+ });
1387
+ },
1388
+
1389
+ newBatchDealSubmit(selectionArr, submitType) {
1390
+ // console.log('提交',selectionArr);
1391
+ if (selectionArr.length === 0) {
1392
+ return this.$message.warning('请先勾选要提交的数据!');
1393
+ }
1394
+ // 判断是否选择了下一步处理人
1395
+ let str = "即将提交" + selectionArr.length + "条数据";
1396
+ if(submitType === "all"){
1397
+ str = "即将提交当前显示内容(不包括正在加载的数据)";
1398
+ }
1399
+ this.$confirm(`${str}, 确认是否继续?`, '提示', {
1400
+ confirmButtonText: '确定',
1401
+ cancelButtonText: '取消',
1402
+ type: 'warning'
1403
+ }).then(() => {
1404
+ let params = [];
1405
+ let instIds = "";
1406
+ let nextStepSelectionArr = [];
1407
+ selectionArr.forEach(selectionObj => {
1408
+ let paramsObj = {dataId: selectionObj.dataId};
1409
+ let updateParams = {};
1410
+ (selectionObj.settingInfo || []).forEach(item => {
1411
+ updateParams[item.field] = item.defaultValue;
1412
+ });
1413
+ if (Object.keys(updateParams).length > 0) {
1414
+ paramsObj["updateParams"] = updateParams;
1415
+ params.push(paramsObj);
1416
+ }
1417
+ let flag = selectionObj.flowInstId;
1418
+ if (flag || selectionObj.isEndNode) {
1419
+ instIds += `,${selectionObj.flowInstId}`;
1420
+ nextStepSelectionArr.push(selectionObj);
1421
+ }
1422
+ });
1423
+ // console.log(this.flowDefine, this.allNodeInfo, '提交', selectionArr, nextStepSelectionArr);
1424
+ if (params.length > 0) {
1425
+ this.saveBatchDealFormData(this.formInfo.formId, JSON.stringify(params)).then(resData => {
1426
+ if (resData.operateSuccess) {
1427
+ this.batchUpdateFlow(instIds, nextStepSelectionArr);
1428
+ }
1429
+ });
1430
+ }else {
1431
+ this.batchUpdateFlow(instIds, nextStepSelectionArr);
1432
+ }
1433
+ }).catch(() => {
1434
+ this.$message({
1435
+ type: 'info',
1436
+ message: '已取消提交'
1437
+ });
1438
+ });
1439
+ },
1440
+
1441
+ batchUpdateFlow(instIds, nextStepSelectionArr) {
1442
+ if (!instIds) {
1443
+ return this.$message.warning("instIds不能为空!");
1444
+ }
1445
+ // 更新工作流状态
1446
+ this.saspFlowAxios.post(this.api.plFlowInst.batchUpdateFlowStatus, {
1447
+ instIds: instIds.slice(1)
1448
+ }).then(updateFlowStatusRes => {
1449
+ let type = "error";
1450
+ let message = updateFlowStatusRes.data.operateMessage;
1451
+ if (updateFlowStatusRes && updateFlowStatusRes.data.operateSuccess) {
1452
+ type = "success";
1453
+ // 执行工作流下一步
1454
+ this.newBatchExecuteNextStep(nextStepSelectionArr);
1455
+ // 提交完之后刷新页面,不关闭弹窗
1456
+ this.currentPage = 1;
1457
+ this.openNewBatchUpdateFlowForm();
1458
+
1459
+ let pendingRefVm = this.$refs["pendingRef"];
1460
+ pendingRefVm && pendingRefVm.init();
1461
+ // this.flowBatchSelectPendingDialog = false;
1462
+ }
1463
+ this.$message({
1464
+ type,
1465
+ message
1466
+ });
1467
+ });
1468
+ },
1469
+
1470
+ // 流程批量审批,全部提交
1471
+ newBatchDealAllSubmit() {
1472
+ let flowNewBatchDealVm = this.$refs.flowNewBatchDealRef;
1473
+ let selectArr = [];
1474
+ this.formSearchObj.flowNewBatchDealArr.forEach(item => {
1475
+ if (flowNewBatchDealVm.newBatchDealSelectable(item)) {
1476
+ selectArr.push(item);
1477
+ }
1478
+ });
1479
+ // console.log('全部提交', selectArr);
1480
+ if (selectArr.length === 0) {
1481
+ return this.$message.warning("暂无提交内容!");
1482
+ }
1483
+ this.newBatchDealSubmit(selectArr, "all");
1484
+ },
1485
+
1486
+ newBatchExecuteNextStep(arr) {
1487
+ let params = [];
1488
+ arr.forEach(items => {
1489
+ let nextNodeObj = this.allNodeInfo[items.nextDealUsers.nextNodeId];
1490
+ let dealers = items.chooseNextUserId;
1491
+ if (Array.isArray(items.chooseNextUserId)) {
1492
+ dealers = items.chooseNextUserId.join(",");
1493
+ }
1494
+ let dealersObj = {};
1495
+ dealersObj[(nextNodeObj || {})["nodeLinkId"]] = dealers;
1496
+ let nextStepBaseObj = {
1497
+ flowSaveSuccess: true,
1498
+ flowDataId: items.dataId,
1499
+ flowInstId: items.flowInstId,
1500
+ instId: items.flowInstId,
1501
+ dealers: dealers,
1502
+ // dealerNames: dealerNames,
1503
+ dealersObj: JSON.stringify(dealersObj),
1504
+ taskId: items.taskId,
1505
+ }
1506
+ let nextNode = {};
1507
+ if (nextNodeObj) {
1508
+ nextNode = {
1509
+ nextNodeType: nextNodeObj.nodeType,
1510
+ nextNodeId: nextNodeObj.id,
1511
+ nextNodeKey: nextNodeObj.nodeLinkId,
1512
+ }
1513
+ }
1514
+ let nowNodeObj = this.allNodeInfo[items.currentNode];
1515
+ if (nowNodeObj && nowNodeObj.dealType === 'multi') {
1516
+ this.$set(nextStepBaseObj, 'passCondition', nowNodeObj.passCondition);
1517
+ }
1518
+ // if(this.flowNextOperation) {
1519
+ // this.flowNextOperation(obj.instId, obj.dealers, obj.dealerNames, obj.taskId);
1520
+ // }
1521
+ let paramsSourceObj = {"SASP_FLOW_USE_VARIABLES": "yes"};
1522
+ Object.assign(paramsSourceObj, nextStepBaseObj, nextNode);
1523
+ params.push(paramsSourceObj);
1524
+ });
1525
+ // console.log('params',params);
1526
+ this.saspFlowAxios.post(this.api.plFlowInst.batchExecuteNextStep, {
1527
+ params: JSON.stringify(params)
1528
+ }).then(res => {
1529
+ if (res.data.operateSuccess) {
1530
+ let message = res.data.operateMessage;
1531
+ this.$notify({
1532
+ title: '提示',
1533
+ message: `${message}`,
1534
+ type: 'info',
1535
+ position: 'bottom-right',
1536
+ duration: 10000,
1537
+ });
1538
+ }
1539
+ });
1540
+ },
1541
+
1079
1542
  /**
1080
1543
  * 获取[添加、修改和处理]的操作按钮
1081
1544
  */
@@ -1165,18 +1628,20 @@
1165
1628
 
1166
1629
  /**
1167
1630
  * 打开流程图窗口
1168
- * @param instId 流程实例ID
1631
+ * @param row 流程实例ID
1169
1632
  */
1170
1633
  openFlowChart(row) {
1634
+ let flowId = "";
1171
1635
  let instId = "";
1172
1636
  let linkProcId = "";
1173
1637
  let isRelease = "";
1174
- if(row){
1638
+ if (row) {
1639
+ flowId = row.flowId;
1175
1640
  instId = row.flowInstId;
1176
1641
  linkProcId = row.linkProcId;
1177
1642
  isRelease = row.isRelease;
1178
1643
  }
1179
- this.flowChartObj = {instId: instId,linkProcId:linkProcId,isRelease:isRelease, dialogVisible: true};
1644
+ this.flowChartObj = {flowId: flowId,instId: instId,linkProcId:linkProcId,isRelease:isRelease, dialogVisible: true};
1180
1645
  },
1181
1646
 
1182
1647
  /**
@@ -1184,10 +1649,11 @@
1184
1649
  * @param row 流程行数据
1185
1650
  */
1186
1651
  openFlowRecord(row) {
1187
- let arr = ["2","3","4"]; // 旧版本的已办结已撤销以及已中止数据通过旧版接口查询流转记录
1188
- if(arr.indexOf(row.flowStatus) > -1 && row.isOldData == "1"){
1652
+ console.log('流转记录',row);
1653
+ let arr = ["2", "3", "4"]; // 旧版本的已办结已撤销以及已中止数据通过旧版接口查询流转记录
1654
+ if (arr.indexOf(row.flowStatus) > -1 && row.isOldData === "1") {
1189
1655
  this.flowRecordObj = {instId: row.flowInstId || "", oldDialogVisible: true};
1190
- }else{
1656
+ } else {
1191
1657
  this.flowRecordObj = {instId: row.flowInstId || "", dialogVisible: true};
1192
1658
  }
1193
1659
  },
@@ -1443,7 +1909,20 @@
1443
1909
  this.$set(obj,'passCondition',this.nowNode.passCondition)
1444
1910
  }
1445
1911
  let params = {"SASP_FLOW_USE_VARIABLES":"yes"};
1446
- Object.assign(params,flowParams || {},obj);
1912
+ // Object.assign(params,flowParams || {},obj);
1913
+ Object.assign(params,obj);
1914
+ let allParamKeys = Object.keys(flowParams || {});
1915
+ allParamKeys.forEach(templateKey => {
1916
+ if(this.isRefreshGetNextUsers.indexOf(templateKey) > -1){
1917
+ params[templateKey] = flowParams[templateKey];
1918
+ if(allParamKeys.indexOf(templateKey + "_SASP_SYS_DATA") > -1){
1919
+ params[templateKey + "_SASP_SYS_DATA"] = flowParams[templateKey + "_SASP_SYS_DATA"];
1920
+ }
1921
+ if(allParamKeys.indexOf(templateKey + "_SASP_SYS_DATA_ID") > -1){
1922
+ params[templateKey + "_SASP_SYS_DATA_ID"] = flowParams[templateKey + "_SASP_SYS_DATA_ID"];
1923
+ }
1924
+ }
1925
+ })
1447
1926
  this.saspFlowAxios.post(this.api.plFlowInst.getNextUsers, params).then(res => {
1448
1927
  if(!res.data.operateSuccess){
1449
1928
  this.isDisabled['nextStep'] = true;
@@ -1562,6 +2041,9 @@
1562
2041
  this.chooseNextUserId = userInfo.id;
1563
2042
  this.chooseNextUserName = userInfo.userName;
1564
2043
  }
2044
+ if(this.nextNode.dealType === "multi" && this.nextSteptUserArr.length === 1){
2045
+ this.chooseNextUserId = [userInfo.id];
2046
+ }
1565
2047
  }
1566
2048
  });
1567
2049
  });
@@ -1970,10 +2452,10 @@
1970
2452
  /**
1971
2453
  * 获取流程概要
1972
2454
  */
1973
- getFlowSummary(dataObj) {
2455
+ getFlowSummary(dataObj, summaryTemplate) {
1974
2456
  let flowSummary = "";
1975
- let summarySet = this.flowDefine.flowSummary;
1976
- if (this.tabActive == "draft") {
2457
+ let summarySet = summaryTemplate || this.flowDefine.flowSummary;
2458
+ if (this.tabActive === "draft") {
1977
2459
  flowSummary = this.platStringUtil.replaceAll(summarySet, "${startUserName*}", this.loginUser.userName);
1978
2460
  flowSummary = this.platStringUtil.replaceAll(flowSummary, "${createTime*}", this.DATE_UTIL.getCurrentDateTime());
1979
2461
  } else {
@@ -2364,7 +2846,7 @@
2364
2846
  this.$forceUpdate();
2365
2847
  }
2366
2848
  // 加载工作流脚本与工作流事件规则
2367
- this.initFlowScript().then(() => {
2849
+ this.initFlowScript(this.flowData.flowId).then(() => {
2368
2850
  resolve(true);
2369
2851
  })
2370
2852
  });
@@ -2377,14 +2859,84 @@
2377
2859
  });
2378
2860
  },
2379
2861
 
2862
+ getMultiFlowInfo() {
2863
+ return new Promise(resolve => {
2864
+ let flowIdArr = this.flowId.split(",").filter(item => item);
2865
+ flowIdArr.forEach(flowId => {
2866
+ this.FLOW_GLOBAL.getFlowDefineById(flowId).then(flowDefine => {
2867
+ this.flowDefineByFlowId[flowId] = flowDefine;
2868
+ });
2869
+ });
2870
+
2871
+ const initFlowNodeFunc = flowIdArr.map(flowId => (() => this.FLOW_GLOBAL.getFlowNodesByFlowId(flowId)));
2872
+ Promise.all(initFlowNodeFunc.map(func => func())).then(allFlowNodeArr => {
2873
+ //工作流节点
2874
+ this.startNodeKey = "Activity_draft";
2875
+ for (const allFlowNode of allFlowNodeArr) {
2876
+ this.startNodeKeyObj = {};
2877
+ this.flowVersionNodeObj = {};
2878
+ (allFlowNode || []).forEach(item => {
2879
+ if (item.nodeLinkId.indexOf("Activity_draft") > -1) {
2880
+ this.startNodeKey = item.nodeLinkId;
2881
+ this.startNodeKeyObj[item.version] = item.nodeLinkId; //开始节点对应版本号
2882
+ }
2883
+ if (!this.flowVersionNodeObj[item.version]) {
2884
+ this.$set(this.flowVersionNodeObj, item.version, {});
2885
+ }
2886
+ this.$set(this.flowVersionNodeObj[item.version], item.nodeLinkId, item); //版本节点对象
2887
+
2888
+ this.allNodeInfo[item.id] = item;
2889
+ this.flowNodeIdToInfo[item.id] = item;
2890
+ let nodeArr = ['StartEvent', 'ParallelGateway', 'SequenceFlow', 'ExclusiveGateway', 'InclusiveGateway'];
2891
+ if (item.nodeType && nodeArr.indexOf(item.nodeType) === -1) {
2892
+ if (!this.flowNodeNameObj[item.nodeLinkId]) {
2893
+ this.$set(this.flowNodeNameObj, item.nodeLinkId, item.nodeName);
2894
+ } else {
2895
+ if (this.flowNodeNameObj[item.nodeLinkId] !== item.nodeName) {
2896
+ this.flowNodeNameObj[item.nodeLinkId] = this.flowNodeNameObj[item.nodeLinkId] + "," + item.nodeName;
2897
+ }
2898
+ }
2899
+ }
2900
+ if (item.nodeType === "UserTask" && (item.nodeLinkId || "").indexOf("Activity_draft") > -1) {
2901
+ this.draftNodeId = item.id; // 草稿节点id
2902
+ }
2903
+ // 行按钮
2904
+ let listButton = JSON.parse(item.listButton || "[]") || [];
2905
+ listButton.forEach(button => {
2906
+ button.showName = button.showName ? button.showName : this.listButtonObj[button.type];
2907
+ });
2908
+ this.nodeListButtonObj[item.id] = listButton;
2909
+
2910
+ // 表单按钮
2911
+ let formButton = JSON.parse(item.formButton || "[]") || [];
2912
+ formButton.forEach(button => {
2913
+ button.showName = button.showName ? button.showName : this.formButtonObj[button.type];
2914
+ });
2915
+
2916
+ this.nodeFormButtonObj[item.id] = this.sortButtonArr(formButton);
2917
+ this.nodeFormBtnObj[item.id] = this.formatterFormButton(formButton);
2918
+ });
2919
+ let flowId = allFlowNode[0].flowId;
2920
+ this.$set(this.startNodeKeyObjByFlowId, flowId, this.startNodeKeyObj);
2921
+ this.$set(this.flowVersionNodeObjByFlowId, flowId, this.flowVersionNodeObj);
2922
+ // 加载工作流脚本与工作流事件规则
2923
+ this.flowDefine = this.flowDefineByFlowId[flowId];
2924
+ this.initFlowScript(flowId).then(() => {
2925
+ resolve(true);
2926
+ });
2927
+ }
2928
+ });
2929
+ });
2930
+ },
2931
+
2380
2932
  /**
2381
2933
  * 加载工作流脚本与工作流事件规则
2382
2934
  */
2383
- initFlowScript(){
2935
+ initFlowScript(flowId){
2384
2936
  return new Promise(resolve => {
2385
2937
  this.saspFlowAxios.all([
2386
- this.saspFlowAxios.post(this.api.plFlowScript.find,{"flowId":this.flowData.flowId}),
2387
- this.saspFlowAxios.post(this.api.plFlowEventDetail.findByFlowAndLeadFunc,{"flowId":this.flowData.flowId,"version":this.flowDefine.flowVersion||"1.0"})
2938
+ this.saspFlowAxios.post(this.api.plFlowScript.find,{"flowId": flowId}),
2939
+ this.saspFlowAxios.post(this.api.plFlowEventDetail.findByFlowAndLeadFunc,{"flowId": flowId,"version":this.flowDefine.flowVersion || "1.0"})
2388
2940
  ]).then(this.saspFlowAxios.spread((resScript, resEvent) => {
2389
2941
  // 流程脚本
2390
2942
  if(resScript){
@@ -2804,7 +3356,20 @@
2804
3356
  }
2805
3357
  },
2806
3358
 
2807
- initflowObj() {//处理流程定义对象
3359
+ initFlowObj() {//处理流程定义对象
3360
+ let gatewayFields = this.flowDefine.gatewayFields || "";
3361
+ this.isRefreshGetNextUsers = gatewayFields.split(",");
3362
+ Object.keys(this.allNodeInfo).forEach(key => {
3363
+ let obj = this.allNodeInfo[key];
3364
+ if (obj.nodeType === "UserTask" && (!obj.nodeLinkId || obj.nodeLinkId.indexOf('Activity_draft') === -1)) {
3365
+ if (obj.dealerType === "form" && obj.formField) {
3366
+ this.isRefreshGetNextUsers.push(obj.formField);
3367
+ }
3368
+ if (obj.dealerType === "variable" && obj.variable) {
3369
+ this.isRefreshGetNextUsers.push(obj.variable);
3370
+ }
3371
+ }
3372
+ });
2808
3373
  let tabSetting = JSON.parse(this.flowDefine.tabSetting);
2809
3374
  tabSetting.forEach(data => {
2810
3375
  this.$set(this.tabTypeObj, data.type, data);