sasp-flow-render 1.1.27-decoupling → 1.1.29-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.
package/index.js CHANGED
@@ -125,7 +125,8 @@ let initAxios = (Vue, props) => {
125
125
  let loadFlowDialog = (Vue,opts) => {
126
126
  // 创建 Dialog 实例并挂载到 body
127
127
  const DialogConstructor = Vue.extend(flowDialog);
128
- const instance = new DialogConstructor().$mount();
128
+ let router = opts.router;
129
+ const instance = new DialogConstructor({router}).$mount();
129
130
  document.body.appendChild(instance.$el);
130
131
 
131
132
  // 将实例挂载到 Vue 原型,方便全局调用
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sasp-flow-render",
3
- "version": "1.1.27-decoupling",
3
+ "version": "1.1.29-decoupling",
4
4
  "description": "业务应用支撑平台-智慧流程渲染组件",
5
5
  "scripts": {
6
6
  "build": "vue-cli-service build"
@@ -251,6 +251,7 @@ let objResult = {
251
251
  saveDataFlowDrafts: "/flowEngine/saveDataFlowDrafts",
252
252
  startFlow: "/flowEngine/startFlow",
253
253
  completeTask: "/flowEngine/completeTask",
254
+ saveFlowDraft: "/flowEngine/saveFlowDraft",
254
255
  }
255
256
  };
256
257
 
@@ -23,6 +23,12 @@ class WorkflowEngine {
23
23
  this.currentInst = {};
24
24
  this.installListObj = this.$this.EVENT_PLUGIN['installEventObj']||{}; //已经安装的流程事件
25
25
  this.loginUser = this.$this.FLOW_CACHE_GLOBAL.getLoginUser();
26
+ if(!this.loginUser.id){ // 判断是否是表单独立登录
27
+ if(this.$this.FORM_USER_GLOBAL){
28
+ this.loginUser = this.$this.FORM_USER_GLOBAL.getLoginUser();
29
+ }
30
+ }
31
+
26
32
  this.skipAutoInit = false;
27
33
  if(flowAttrs.skipAutoInit){
28
34
  this.skipAutoInit = flowAttrs.skipAutoInit;
@@ -50,7 +56,8 @@ class WorkflowEngine {
50
56
  this.getFormInfo = methods["getFormInfo"];
51
57
  this.flowNextOperation = methods["flowNextOperation"];
52
58
  this.forceUpdateComponent = methods["forceUpdateComponent"];
53
- this.nextStepAfterSave = methods["nextStepAfterSave"];
59
+ this.nextStepAfterSave = methods["nextStepAfterSave"]; // 流程下一步保存表单数据后的回调
60
+ this.afterNextStepSuccess = methods["afterNextStepSuccess"]; // 流程下一步成功后,即关闭对话框后的回调
54
61
  this.setParams = methods["setParams"];
55
62
 
56
63
  if(!this.initFormInfo){
@@ -159,7 +166,7 @@ class WorkflowEngine {
159
166
  type: "success",
160
167
  icon: "el-icon-check",
161
168
  disabled: false,
162
- show: true,
169
+ show: false,
163
170
  method: () => {
164
171
  this.saveDraft();
165
172
  }
@@ -170,7 +177,7 @@ class WorkflowEngine {
170
177
  type: "primary",
171
178
  icon: "el-icon-d-arrow-right",
172
179
  disabled: false,
173
- show: true,
180
+ show: false,
174
181
  method: () => {
175
182
  this.nextStep();
176
183
  // this.isDisabled1 = true;
@@ -342,7 +349,7 @@ class WorkflowEngine {
342
349
  type: "warning",
343
350
  icon: "saspiconfont pl-icon-liuchengtu",
344
351
  disabled: false,
345
- show: true,
352
+ show: false,
346
353
  isView: true,
347
354
  method: () => {
348
355
  this.openFlowRecord(this.currentInst);
@@ -353,7 +360,7 @@ class WorkflowEngine {
353
360
  type: "",
354
361
  icon: "el-icon-close",
355
362
  disabled: false,
356
- show: true,
363
+ show: false,
357
364
  isView: true,
358
365
  method: () => {
359
366
  this.flowInstDataDialog = false;
@@ -1843,6 +1850,13 @@ class WorkflowEngine {
1843
1850
  })
1844
1851
  }
1845
1852
 
1853
+ syncFlowDialogPrams(params){
1854
+ Object.keys(params).forEach(key => {
1855
+ this[key] = params[key];
1856
+ });
1857
+ this.setParams && this.setParams(params);
1858
+ }
1859
+
1846
1860
  /**
1847
1861
  * 恢复方法
1848
1862
  */
@@ -1876,14 +1890,14 @@ class WorkflowEngine {
1876
1890
  */
1877
1891
  openFlowRecord(row) {
1878
1892
  let arr = ["2", "3", "4"]; // 旧版本的已办结已撤销以及已中止数据通过旧版接口查询流转记录
1893
+ this.$flowDialog.fillFlowDialogParams({
1894
+ flowRecordObj: this.flowRecordObj
1895
+ });
1879
1896
  if (arr.indexOf(row.flowStatus) > -1 && row.isOldData === "1") {
1880
1897
  this.flowRecordObj = {instId: row.flowInstId || "", oldDialogVisible: true};
1881
1898
  } else {
1882
1899
  this.flowRecordObj = {instId: row.flowInstId || "", dialogVisible: true};
1883
1900
  }
1884
- this.$flowDialog.fillFlowDialogParams({
1885
- flowRecordObj: this.flowRecordObj
1886
- });
1887
1901
  }
1888
1902
 
1889
1903
  openFlowChart(row) {
@@ -2206,7 +2220,14 @@ class WorkflowEngine {
2206
2220
  })
2207
2221
  }
2208
2222
 
2209
- open(dataId,type,callback){
2223
+ /**
2224
+ *
2225
+ * @param dataId 数据ID
2226
+ * @param type 操作类型,view-查看、update-编辑
2227
+ * @param forceOpen 是否强制打开,默认false,为true时可以将非工作流列表数据自动插入草稿数据并打开
2228
+ * @param callback 回调函数
2229
+ */
2230
+ open(dataId,type,forceOpen,callback){
2210
2231
  if(!this.tableviewId){
2211
2232
  this.$this.$message.error("请先设置tableviewId");
2212
2233
  return;
@@ -2220,12 +2241,11 @@ class WorkflowEngine {
2220
2241
  formInfo: this.formInfo
2221
2242
  });
2222
2243
  if(dataId){
2223
- this.$this.saspFlowAxios.post(this.$this.api.plFlowInst.getFlowInstByFlowDataId,{flowId:this.flowId,dataId:dataId}).then(res => {
2224
- if(!res.data){
2244
+ this.getDataByDataId(dataId,forceOpen).then(rowData => {
2245
+ if(!rowData){
2225
2246
  this.$this.$message.error("未获取到此流程数据!");
2226
2247
  return;
2227
2248
  }
2228
- let rowData = res.data || {};
2229
2249
  if(type !== "view" && rowData.operateAuth === "0"){
2230
2250
  console.log("当前登录用户无此流程数据操作权限,已自动切换为查看!");
2231
2251
  type = "view";
@@ -2260,6 +2280,53 @@ class WorkflowEngine {
2260
2280
  })
2261
2281
  }
2262
2282
 
2283
+ /**
2284
+ * 根据数据ID获取流程数据
2285
+ * @param dataId
2286
+ * @returns {Promise<unknown>}
2287
+ */
2288
+ getDataByDataId(dataId,forceOpen){
2289
+ return new Promise(resolve => {
2290
+ this.getFlowInstByDataId(dataId).then(rowData => {
2291
+ if(!rowData) {
2292
+ if (forceOpen) {
2293
+ this.$this.axios.post(this.$this.api.flowEngine.saveFlowDraft, {
2294
+ flowId: this.flowId,
2295
+ dataId: dataId,
2296
+ userCode: this.loginUser.id
2297
+ }).then(flowDraftRes => {
2298
+ let flowDraftData = flowDraftRes.data || {};
2299
+ if (flowDraftData.requestStatus === "1") {
2300
+ this.getFlowInstByDataId(dataId).then(rowData => {
2301
+ resolve(rowData);
2302
+ });
2303
+ }else{
2304
+ resolve(false);
2305
+ }
2306
+ });
2307
+ }else{
2308
+ resolve(false);
2309
+ }
2310
+ }else{
2311
+ resolve(rowData);
2312
+ }
2313
+ })
2314
+ })
2315
+ }
2316
+
2317
+ getFlowInstByDataId(dataId){
2318
+ return new Promise(resolve => {
2319
+ this.$this.saspFlowAxios.post(this.$this.api.plFlowInst.getFlowInstByFlowDataId,{flowId:this.flowId,dataId:dataId}).then(res => {
2320
+ if(!res.data){
2321
+ resolve(false);
2322
+ return;
2323
+ }
2324
+ let rowData = res.data || {};
2325
+ resolve(rowData);
2326
+ });
2327
+ })
2328
+ }
2329
+
2263
2330
  openFlowDialog(args){
2264
2331
  this.$flowDialog.openFlowDialog(args);
2265
2332
  }
@@ -645,6 +645,11 @@ export default {
645
645
  if(this.flowNextOperation) {
646
646
  this.flowNextOperation(obj.instId, obj.dealers, obj.dealerNames, obj.taskId);
647
647
  }
648
+ this.workFlowUtil.syncFlowDialogPrams({
649
+ chooseNextUserId: this.chooseNextUserId,
650
+ chooseNextUserName: this.chooseNextUserName,
651
+ chooseNextUserIdObj: this.chooseNextUserIdObj
652
+ });
648
653
  let params = {"SASP_FLOW_USE_VARIABLES":"yes"};
649
654
  Object.assign(params,this.flowParams || {},obj);
650
655
  this.saspFlowAxios.post(this.api.plFlowInst.executeNextStep,params).then(res => {
@@ -663,19 +668,11 @@ export default {
663
668
  let type = this.flowBatchPendingDialog ? "batch" : "";
664
669
  let currentNodeObj = this.flowNodeIdToInfo[this.currentInst.currentNode || this.draftNodeId] ||{};
665
670
  let submitSuccessRusult;
666
- if (type == 'batch') {
667
- // 批量处理
668
- let ref = "batchTableForm"+this.batchUpdateFormInfo.activeName+"Ref";
669
- submitSuccessRusult=this.workFlowUtil.exeFlowEvent("nextStep","submitSuccess", this.currentInst.currentNode || this.draftNodeId,ref);
670
- if(currentNodeObj.openEvent == '1'){
671
- submitSuccessRusult = this.workFlowUtil.exeNewFlowEvent("nextSubmit",currentNodeObj.nodeLinkId||'',ref)
672
- }
673
- } else {
674
- submitSuccessRusult=this.workFlowUtil.exeFlowEvent("nextStep","submitSuccess", this.currentInst.currentNode || this.draftNodeId);
675
- if(currentNodeObj.openEvent == '1'){
676
- submitSuccessRusult =this.workFlowUtil.exeNewFlowEvent("nextSubmit",currentNodeObj.nodeLinkId||'')
677
- }
671
+ submitSuccessRusult=this.workFlowUtil.exeFlowEvent("nextStep","submitSuccess", this.currentInst.currentNode || this.draftNodeId);
672
+ if(currentNodeObj.openEvent == '1'){
673
+ submitSuccessRusult =this.workFlowUtil.exeNewFlowEvent("nextSubmit",currentNodeObj.nodeLinkId||'')
678
674
  }
675
+ this.workFlowUtil.afterNextStepSuccess && this.workFlowUtil.afterNextStepSuccess(this.workFlowUtil.$this,this.workFlowUtil);
679
676
  if(submitSuccessRusult){
680
677
  //办结提醒
681
678
  if(this.nextNode.nodeType == "EndEvent"){
@@ -138,10 +138,11 @@
138
138
  "label":"用户名称",
139
139
  },
140
140
  ], //用户信息
141
+ loginUser:{}
141
142
  }
142
143
  },
143
144
  created(){
144
-
145
+ this.loginUser = this.FLOW_CACHE_GLOBAL.getLoginUser() || {};
145
146
  },
146
147
  methods:{
147
148
  /**