sasp-flow-render 1.1.18 → 1.1.19

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sasp-flow-render",
3
- "version": "1.1.18",
3
+ "version": "1.1.19",
4
4
  "description": "业务应用支撑平台-智慧流程渲染组件",
5
5
  "scripts": {
6
6
  "build": "vue-cli-service build"
@@ -88,6 +88,15 @@ let objResult = {
88
88
  saveNodeInfoRelease:"/plFlowNodeController/saveNodeInfoRelease", //发布流程实例保存节点配置
89
89
  },
90
90
 
91
+ plFlowButton:{
92
+ url:"/plFlowButtonController",
93
+ add:"/plFlowButtonController/add",
94
+ find:"/plFlowButtonController/find",
95
+ getById:"/plFlowButtonController/getById",
96
+ update:"/plFlowButtonController/update",
97
+ delete:"/plFlowButtonController/delete",
98
+ },
99
+
91
100
  //流程节点配置
92
101
  plFlowInstNodeResult:{
93
102
  listNoPageByResult:"/flowInstNodeResultController/listNoPageByResult",
@@ -49,7 +49,7 @@
49
49
  instId:{type:String},
50
50
  nodeId:{type:String},
51
51
  linkProcId:{type:String,default:""},
52
- isRelease:{type:String,default:"1"} //发布状态默认已发布
52
+ isRelease:{type:String,default:""} //发布状态默认已发布
53
53
  },
54
54
  data(){
55
55
  return {
@@ -161,6 +161,12 @@
161
161
  @click="deleteRowFlow(scope.row)"
162
162
  icon="el-icon-delete" type="danger">删除
163
163
  </el-button>
164
+ <el-button
165
+ v-for="button in Object.values(diyButtonsObj)"
166
+ :key="button.id" size="small" :type="button.buttonColor" :icon="button.buttonIcon"
167
+ v-if="judeDiyButton(tabType,button,scope.row)"
168
+ @click="diyButtonOpt('list',scope.row, button)">{{button.showButtonName}}
169
+ </el-button>
164
170
  </template>
165
171
  </el-table-column>
166
172
  </el-table>
@@ -345,6 +351,13 @@
345
351
  }
346
352
  },
347
353
 
354
+ // 自定义按钮窗口回调函数
355
+ openDiyButtonEvent: {
356
+ type: Function, default() {
357
+
358
+ }
359
+ },
360
+
348
361
  // 打开修改窗口回调函数
349
362
  openUpdateFlowForm: {
350
363
  type: Function, default() {
@@ -399,6 +412,7 @@
399
412
  downloadTemplate: {type: Function, default: null},
400
413
  getFormDataByDataIds: {type: Function, default: null},
401
414
  flowDefineByFlowId: {type: Object, default: () => ({})},
415
+ diyButtonsObj: {type: Object, default: () => ({})}, // 自定义按钮对象
402
416
  },
403
417
  data() {
404
418
 
@@ -517,6 +531,7 @@
517
531
  this.init();
518
532
  this.getListButton();
519
533
  this.initWorkStageTurnOn();
534
+ this.getCurrentWidth();
520
535
  if (this.showModel === "card") {
521
536
  this.checkScreenWidth();
522
537
  window.addEventListener('resize', () => { //监听浏览器窗口大小改变
@@ -643,6 +658,25 @@
643
658
  }
644
659
  },
645
660
 
661
+ getCurrentWidth() {
662
+ Object.values(this.diyButtonsObj).forEach(item => {
663
+ if(item.position === 'list' && item.buttonSign.indexOf(this.tabType) > -1) {
664
+ this.currentOptColumnWidth += 100;
665
+ }
666
+ })
667
+ },
668
+
669
+ judeDiyButton(tabType, button, row) {
670
+ if(tabType === 'pending') {
671
+ return button.position === 'list' && button.nodeId === row.currentNode;
672
+ }
673
+ return button.position === 'list' && button.buttonSign.indexOf(tabType) > -1;
674
+ },
675
+
676
+ diyButtonOpt(type,row, button) {
677
+ this.openDiyButtonEvent(type,row, button);
678
+ },
679
+
646
680
  /**
647
681
  * 判断列表操作按钮显示
648
682
  */
@@ -52,6 +52,7 @@
52
52
  :flow-node-id-to-info="flowNodeIdToInfo"
53
53
  :flow-node-name-obj="flowNodeNameObj"
54
54
  :node-list-button-obj="nodeListButtonObj"
55
+ :diy-buttons-obj="diyButtonsObj"
55
56
  :opt-column-width="150"
56
57
  :show-model="showModel"
57
58
  :start-node-key-obj="startNodeKeyObj"
@@ -60,6 +61,7 @@
60
61
  :open-add-flow-form="openAddFlowForm"
61
62
  :open-update-flow-form="openUpdateFlowForm"
62
63
  :open-batch-update-flow-form="openBatchUpdateFlowForm"
64
+ :open-diy-button-event="openDiyButtonEvent"
63
65
  :formImpMethod="formImpMethod"
64
66
  :flowImpParamObj="flowImpParamObj"
65
67
  :downloadTemplate="downloadTemplate"
@@ -81,6 +83,7 @@
81
83
  :flow-node-id-to-info="flowNodeIdToInfo"
82
84
  :flow-node-name-obj="flowNodeNameObj"
83
85
  :node-list-button-obj="nodeListButtonObj"
86
+ :diy-buttons-obj="diyButtonsObj"
84
87
  :opt-column-width="optColumnWidth"
85
88
  :show-model="showModel"
86
89
  :start-node-key-obj="startNodeKeyObj"
@@ -90,6 +93,7 @@
90
93
  :open-flow-chart="openFlowChart"
91
94
  :open-flow-record="openFlowRecord"
92
95
  :open-update-flow-form="openUpdateFlowForm"
96
+ :open-diy-button-event="openDiyButtonEvent"
93
97
  :open-batch-update-flow-form="openBatchUpdateFlowForm"
94
98
  :openNewBatchUpdateFlowForm="openNewBatchUpdateFlowForm"
95
99
  @setDataValue="setDataValue"
@@ -111,11 +115,13 @@
111
115
  :flow-node-id-to-info="flowNodeIdToInfo"
112
116
  :flow-node-name-obj="flowNodeNameObj"
113
117
  :node-list-button-obj="nodeListButtonObj"
118
+ :diy-buttons-obj="diyButtonsObj"
114
119
  :opt-column-width="optColumnWidth"
115
120
  @initTabNum="initTabNum"
116
121
  :show-model="showModel"
117
122
  :start-node-key-obj="startNodeKeyObj"
118
123
  :flow-version-node-obj="flowVersionNodeObj"
124
+ :open-diy-button-event="openDiyButtonEvent"
119
125
  :open-flow-chart="openFlowChart"
120
126
  :open-flow-record="openFlowRecord"
121
127
  :open-view-flow-form="openViewFlowForm"
@@ -137,6 +143,7 @@
137
143
  :flow-node-id-to-info="flowNodeIdToInfo"
138
144
  :flow-node-name-obj="flowNodeNameObj"
139
145
  :node-list-button-obj="nodeListButtonObj"
146
+ :diy-buttons-obj="diyButtonsObj"
140
147
  :opt-column-width="optColumnWidth"
141
148
  @initTabNum="initTabNum"
142
149
  :show-model="showModel"
@@ -144,6 +151,7 @@
144
151
  :flow-version-node-obj="flowVersionNodeObj"
145
152
  :open-flow-record="openFlowRecord"
146
153
  :open-view-flow-form="openViewFlowForm"
154
+ :open-diy-button-event="openDiyButtonEvent"
147
155
  >
148
156
  </flow-inst-list>
149
157
  </el-tab-pane>
@@ -162,6 +170,7 @@
162
170
  :flow-node-id-to-info="flowNodeIdToInfo"
163
171
  :flow-node-name-obj="flowNodeNameObj"
164
172
  :node-list-button-obj="nodeListButtonObj"
173
+ :diy-buttons-obj="diyButtonsObj"
165
174
  :opt-column-width="optColumnWidth"
166
175
  @initTabNum="initTabNum"
167
176
  :show-model="showModel"
@@ -169,6 +178,7 @@
169
178
  :flow-version-node-obj="flowVersionNodeObj"
170
179
  :open-flow-record="openFlowRecord"
171
180
  :open-view-flow-form="openViewFlowForm"
181
+ :open-diy-button-event="openDiyButtonEvent"
172
182
  >
173
183
  </flow-inst-list>
174
184
  </el-tab-pane>
@@ -187,6 +197,7 @@
187
197
  :flow-node-id-to-info="flowNodeIdToInfo"
188
198
  :flow-node-name-obj="flowNodeNameObj"
189
199
  :node-list-button-obj="nodeListButtonObj"
200
+ :diy-buttons-obj="diyButtonsObj"
190
201
  :opt-column-width="optColumnWidth"
191
202
  @initTabNum="initTabNum"
192
203
  :show-model="showModel"
@@ -194,6 +205,7 @@
194
205
  :flow-version-node-obj="flowVersionNodeObj"
195
206
  :open-flow-record="openFlowRecord"
196
207
  :open-view-flow-form="openViewFlowForm"
208
+ :open-diy-button-event="openDiyButtonEvent"
197
209
  >
198
210
  </flow-inst-list>
199
211
  </el-tab-pane>
@@ -211,6 +223,7 @@
211
223
  :flow-node-id-to-info="flowNodeIdToInfo"
212
224
  :flow-node-name-obj="flowNodeNameObj"
213
225
  :node-list-button-obj="nodeListButtonObj"
226
+ :diy-buttons-obj="diyButtonsObj"
214
227
  :opt-column-width="optColumnWidth"
215
228
  :show-model="showModel"
216
229
  :start-node-key-obj="startNodeKeyObj"
@@ -219,6 +232,7 @@
219
232
  :open-flow-record="openFlowRecord"
220
233
  :open-view-flow-form="openViewFlowForm"
221
234
  :inst-query-power="dataPermis"
235
+ :open-diy-button-event="openDiyButtonEvent"
222
236
  >
223
237
  </flow-inst-list>
224
238
  </el-tab-pane>
@@ -252,6 +266,12 @@
252
266
 
253
267
  <div slot="footer" style="height:31px;" class="dialog-footer">
254
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>
255
275
  <el-button v-for="btn in formBtnArr" @click="btn.method" :disabled="isDisabled[btn.btnType]?false:true"
256
276
  v-show="btn.show && ((formInfo.opt != 'view') || (formInfo.opt=='view' && btn.isView))"
257
277
  :key="btn.btnType"
@@ -982,6 +1002,7 @@
982
1002
  total: 0, //总条数
983
1003
  pageSize: 50, //每页多少条
984
1004
  flowEventScriptByFlowId: {},
1005
+ diyButtonsObj: {} // 自定义按钮对象
985
1006
  }
986
1007
  },
987
1008
  watch:{
@@ -2907,6 +2928,7 @@
2907
2928
  this.allNodeInfo[item.id] = item;
2908
2929
  // 行按钮
2909
2930
  let listButton = JSON.parse(item.listButton || "[]") || [];
2931
+ listButton = listButton.filter(item => !item.buttonId);
2910
2932
  listButton.forEach(button => {
2911
2933
  button.showName = button.showName ? button.showName : this.listButtonObj[button.type];
2912
2934
  });
@@ -2914,6 +2936,7 @@
2914
2936
 
2915
2937
  // 表单按钮
2916
2938
  let formButton = JSON.parse(item.formButton || "[]") || [];
2939
+ formButton = formButton.filter(item => !item.buttonId);
2917
2940
  formButton.forEach(button => {
2918
2941
  button.showName = button.showName ? button.showName : this.formButtonObj[button.type];
2919
2942
  });
@@ -2921,6 +2944,13 @@
2921
2944
  this.nodeFormButtonObj[item.id] = this.sortButtonArr(formButton);
2922
2945
  this.nodeFormBtnObj[item.id] = this.formatterFormButton(formButton);
2923
2946
 
2947
+ // 自定义按钮
2948
+ if(item.plFlowButtons !== null) {
2949
+ item.plFlowButtons.forEach(button => {
2950
+ this.diyButtonsObj[button.id] = button;
2951
+ })
2952
+ }
2953
+
2924
2954
  let width = 0;
2925
2955
  (this.nodeListButtonObj[item.id] || []).forEach(item => {
2926
2956
  let nameLength = item.showName.length;
@@ -3338,7 +3368,39 @@
3338
3368
  return result;
3339
3369
  },
3340
3370
 
3371
+ // 自定义按钮窗口回调函数
3372
+ 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
+ }
3382
+ },
3383
+
3384
+ 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
+ },
3341
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
+ }
3403
+ },
3342
3404
 
3343
3405
  /**
3344
3406
  * 执行工作流新版本事件规则