2
2
1. 审批人与提交人为同一人时
3
3
2. 审批人拒绝时
4
4
3. 审批人为空时
5
+ 4. 操作按钮
5
6
-->
6
7
<template >
7
8
<div class =" panel-tab__content" >
74
75
</div >
75
76
</div >
76
77
</el-radio-group >
78
+
79
+ <el-divider content-position =" left" >操作按钮</el-divider >
80
+ <div class =" button-setting-pane" >
81
+ <div class =" button-setting-title" >
82
+ <div class =" button-title-label" >操作按钮</div >
83
+ <div class =" pl-4 button-title-label" >显示名称</div >
84
+ <div class =" button-title-label" >启用</div >
85
+ </div >
86
+ <div class =" button-setting-item" v-for =" (item, index) in buttonsSettingEl" :key =" index" >
87
+ <div class =" button-setting-item-label" > {{ OPERATION_BUTTON_NAME.get(item.id) }} </div >
88
+ <div class =" button-setting-item-label" >
89
+ <input
90
+ type =" text"
91
+ class =" editable-title-input"
92
+ @blur =" btnDisplayNameBlurEvent(index)"
93
+ v-mountedFocus
94
+ v-model =" item.displayName"
95
+ :placeholder =" item.displayName"
96
+ v-if =" btnDisplayNameEdit[index]"
97
+ />
98
+ <el-button v-else text @click =" changeBtnDisplayName(index)"
99
+ >{{ item.displayName }}   ; <Icon icon =" ep:edit"
100
+ /></el-button >
101
+ </div >
102
+ <div class =" button-setting-item-label" >
103
+ <el-switch v-model =" item.enable" />
104
+ </div >
105
+ </div >
106
+ </div >
77
107
</div >
78
108
</template >
79
109
@@ -83,7 +113,9 @@ import {
83
113
RejectHandlerType ,
84
114
REJECT_HANDLER_TYPES ,
85
115
ASSIGN_EMPTY_HANDLER_TYPES ,
86
- AssignEmptyHandlerType
116
+ AssignEmptyHandlerType ,
117
+ OPERATION_BUTTON_NAME ,
118
+ DEFAULT_BUTTON_SETTING
87
119
} from ' @/components/SimpleProcessDesignerV2/src/consts'
88
120
import * as UserApi from ' @/api/system/user'
89
121
@@ -111,6 +143,11 @@ const assignEmptyHandlerType = ref()
111
143
const assignEmptyUserIdsEl = ref ()
112
144
const assignEmptyUserIds = ref ()
113
145
146
+ // 操作按钮
147
+ const buttonsSettingEl = ref ()
148
+ const { buttonsSetting, btnDisplayNameEdit, changeBtnDisplayName, btnDisplayNameBlurEvent } =
149
+ useButtonsSetting ()
150
+
114
151
const elExtensionElements = ref ()
115
152
const otherExtensions = ref ()
116
153
const bpmnElement = ref ()
@@ -165,6 +202,22 @@ const resetCustomConfigList = () => {
165
202
return num > Number .MAX_SAFE_INTEGER || num < - Number .MAX_SAFE_INTEGER ? item : num
166
203
})
167
204
205
+ // 操作按钮
206
+ buttonsSettingEl .value = elExtensionElements .value .values ?.filter (
207
+ (ex ) => ex .$type === ` ${prefix }:ButtonsSetting `
208
+ )
209
+ if (buttonsSettingEl .value .length === 0 ) {
210
+ DEFAULT_BUTTON_SETTING .forEach ((item ) => {
211
+ buttonsSettingEl .value .push (
212
+ bpmnInstances ().moddle .create (` ${prefix }:ButtonsSetting ` , {
213
+ ' flowable:id' : item .id ,
214
+ ' flowable:displayName' : item .displayName ,
215
+ ' flowable:enable' : item .enable
216
+ })
217
+ )
218
+ })
219
+ }
220
+
168
221
// 保留剩余扩展元素,便于后面更新该元素对应属性
169
222
otherExtensions .value =
170
223
elExtensionElements .value .values ?.filter (
@@ -173,7 +226,8 @@ const resetCustomConfigList = () => {
173
226
ex .$type !== ` ${prefix }:RejectHandlerType ` &&
174
227
ex .$type !== ` ${prefix }:RejectReturnTaskId ` &&
175
228
ex .$type !== ` ${prefix }:AssignEmptyHandlerType ` &&
176
- ex .$type !== ` ${prefix }:AssignEmptyUserIds `
229
+ ex .$type !== ` ${prefix }:AssignEmptyUserIds ` &&
230
+ ex .$type !== ` ${prefix }:ButtonsSetting `
177
231
) ?? []
178
232
179
233
// 更新元素扩展属性,避免后续报错
@@ -221,7 +275,8 @@ const updateElementExtensions = () => {
221
275
rejectHandlerTypeEl .value ,
222
276
returnNodeIdEl .value ,
223
277
assignEmptyHandlerTypeEl .value ,
224
- assignEmptyUserIdsEl .value
278
+ assignEmptyUserIdsEl .value ,
279
+ ... buttonsSettingEl .value
225
280
]
226
281
})
227
282
bpmnInstances ().modeling .updateProperties (toRaw (bpmnElement .value ), {
@@ -284,9 +339,114 @@ function findAllPredecessorsExcludingStart(elementId, modeler) {
284
339
return Array .from (predecessors ) // 返回前置节点数组
285
340
}
286
341
342
+ function useButtonsSetting() {
343
+ const buttonsSetting = ref <ButtonSetting []>()
344
+ // 操作按钮显示名称可编辑
345
+ const btnDisplayNameEdit = ref <boolean []>([])
346
+ const changeBtnDisplayName = (index : number ) => {
347
+ btnDisplayNameEdit .value [index ] = true
348
+ }
349
+ const btnDisplayNameBlurEvent = (index : number ) => {
350
+ btnDisplayNameEdit .value [index ] = false
351
+ const buttonItem = buttonsSetting .value ! [index ]
352
+ buttonItem .displayName = buttonItem .displayName || OPERATION_BUTTON_NAME .get (buttonItem .id )!
353
+ }
354
+ return {
355
+ buttonsSetting ,
356
+ btnDisplayNameEdit ,
357
+ changeBtnDisplayName ,
358
+ btnDisplayNameBlurEvent
359
+ }
360
+ }
361
+
287
362
const userOptions = ref <UserApi .UserVO []>([]) // 用户列表
288
363
onMounted (async () => {
289
364
// 获得用户列表
290
365
userOptions .value = await UserApi .getSimpleUserList ()
291
366
})
292
367
</script >
368
+
369
+ <style lang="scss" scoped>
370
+ .button-setting-pane {
371
+ display : flex ;
372
+ flex-direction : column ;
373
+ font-size : 14px ;
374
+ margin-top : 8px ;
375
+
376
+ .button-setting-desc {
377
+ padding-right : 8px ;
378
+ margin-bottom : 16px ;
379
+ font-size : 16px ;
380
+ font-weight : 700 ;
381
+ }
382
+
383
+ .button-setting-title {
384
+ display : flex ;
385
+ justify-content : space-between ;
386
+ align-items : center ;
387
+ height : 45px ;
388
+ padding-left : 12px ;
389
+ background-color : #f8fafc0a ;
390
+ border : 1px solid #1f38581a ;
391
+
392
+ & > :first-child {
393
+ width : 100px !important ;
394
+ text-align : left !important ;
395
+ }
396
+
397
+ & > :last-child {
398
+ text-align : center !important ;
399
+ }
400
+
401
+ .button-title-label {
402
+ width : 150px ;
403
+ font-size : 13px ;
404
+ font-weight : 700 ;
405
+ color : #000 ;
406
+ text-align : left ;
407
+ }
408
+ }
409
+
410
+ .button-setting-item {
411
+ align-items : center ;
412
+ display : flex ;
413
+ justify-content : space-between ;
414
+ height : 38px ;
415
+ padding-left : 12px ;
416
+ border : 1px solid #1f38581a ;
417
+ border-top : 0 ;
418
+
419
+ & > :first-child {
420
+ width : 100px !important ;
421
+ }
422
+
423
+ & > :last-child {
424
+ text-align : center !important ;
425
+ }
426
+
427
+ .button-setting-item-label {
428
+ width : 150px ;
429
+ overflow : hidden ;
430
+ text-align : left ;
431
+ text-overflow : ellipsis ;
432
+ white-space : nowrap ;
433
+ }
434
+
435
+ .editable-title-input {
436
+ height : 24px ;
437
+ max-width : 130px ;
438
+ margin-left : 4px ;
439
+ line-height : 24px ;
440
+ border : 1px solid #d9d9d9 ;
441
+ border-radius : 4px ;
442
+ transition : all 0.3s ;
443
+
444
+ & :focus {
445
+ border-color : #40a9ff ;
446
+ outline : 0 ;
447
+ box-shadow : 0 0 0 2px rgb (24 144 255 / 20% );
448
+ }
449
+ }
450
+ }
451
+ }
452
+ </style >
0 commit comments