129
129
/>
130
130
</el-select >
131
131
</el-form-item >
132
+ <el-form-item
133
+ v-if ="
134
+ userTaskForm.candidateStrategy == CandidateStrategy.MULTI_LEVEL_DEPT_LEADER ||
135
+ userTaskForm.candidateStrategy == CandidateStrategy.START_USER_DEPT_LEADER ||
136
+ userTaskForm.candidateStrategy == CandidateStrategy.START_USER_MULTI_LEVEL_DEPT_LEADER ||
137
+ userTaskForm.candidateStrategy == CandidateStrategy.FORM_DEPT_LEADER
138
+ "
139
+ :label =" deptLevelLabel!"
140
+ prop =" deptLevel"
141
+ span =" 24"
142
+ >
143
+ <el-select v-model =" deptLevel" clearable >
144
+ <el-option
145
+ v-for =" (item, index) in MULTI_LEVEL_DEPT"
146
+ :key =" index"
147
+ :label =" item.label"
148
+ :value =" item.value"
149
+ />
150
+ </el-select >
151
+ </el-form-item >
132
152
<el-form-item
133
153
v-if =" userTaskForm.candidateStrategy === CandidateStrategy.EXPRESSION"
134
154
label =" 流程表达式"
154
174
import {
155
175
CANDIDATE_STRATEGY ,
156
176
CandidateStrategy ,
157
- FieldPermissionType
177
+ FieldPermissionType ,
178
+ MULTI_LEVEL_DEPT
158
179
} from ' @/components/SimpleProcessDesignerV2/src/consts'
159
180
import { defaultProps , handleTree } from ' @/utils/tree'
160
181
import * as RoleApi from ' @/api/system/role'
@@ -192,6 +213,19 @@ const userFieldOnFormOptions = computed(() => {
192
213
return formFieldOptions .filter ((item ) => item .type === ' UserSelect' )
193
214
})
194
215
216
+ const deptLevel = ref (1 )
217
+ const deptLevelLabel = computed (() => {
218
+ let label = ' 部门负责人来源'
219
+ if (userTaskForm .value .candidateStrategy == CandidateStrategy .MULTI_LEVEL_DEPT_LEADER ) {
220
+ label = label + ' (指定部门向上)'
221
+ } else if (userTaskForm .value .candidateStrategy == CandidateStrategy .FORM_DEPT_LEADER ) {
222
+ label = label + ' (表单内部门向上)'
223
+ } else {
224
+ label = label + ' (发起人部门向上)'
225
+ }
226
+ return label
227
+ })
228
+
195
229
const otherExtensions = ref ()
196
230
197
231
const resetTaskForm = () => {
@@ -210,9 +244,20 @@ const resetTaskForm = () => {
210
244
(ex ) => ex .$type === ` ${prefix }:CandidateParam `
211
245
)?.[0 ]?.value
212
246
if (candidateParamStr && candidateParamStr .length > 0 ) {
213
- if (userTaskForm .value .candidateStrategy === 60 ) {
247
+ if (userTaskForm .value .candidateStrategy === CandidateStrategy . EXPRESSION ) {
214
248
// 特殊:流程表达式,只有一个 input 输入框
215
249
userTaskForm .value .candidateParam = [candidateParamStr ]
250
+ } else if (userTaskForm .value .candidateStrategy == CandidateStrategy .MULTI_LEVEL_DEPT_LEADER ) {
251
+ // 特殊:多级不部门负责人,需要通过'|'分割
252
+ userTaskForm .value .candidateParam = candidateParamStr
253
+ .split (' |' )[0 ]
254
+ .split (' ,' )
255
+ .map ((item ) => {
256
+ // 如果数字超出了最大安全整数范围,则将其作为字符串处理
257
+ let num = Number (item )
258
+ return num > Number .MAX_SAFE_INTEGER || num < - Number .MAX_SAFE_INTEGER ? item : num
259
+ })
260
+ deptLevel .value = + candidateParamStr .split (' |' )[1 ]
216
261
} else {
217
262
userTaskForm .value .candidateParam = candidateParamStr .split (' ,' ).map ((item ) => {
218
263
// 如果数字超出了最大安全整数范围,则将其作为字符串处理
@@ -253,6 +298,7 @@ const resetTaskForm = () => {
253
298
/** 更新 candidateStrategy 字段时,需要清空 candidateParam,并触发 bpmn 图更新 */
254
299
const changeCandidateStrategy = () => {
255
300
userTaskForm .value .candidateParam = []
301
+ deptLevel .value = 1
256
302
if (userTaskForm .value .candidateStrategy === CandidateStrategy .FORM_USER ) {
257
303
// 特殊处理表单内用户字段,当只有发起人选项时应选中发起人
258
304
if (! userFieldOnFormOptions .value || userFieldOnFormOptions .value .length <= 1 ) {
@@ -264,17 +310,23 @@ const changeCandidateStrategy = () => {
264
310
265
311
/** 选中某个 options 时候,更新 bpmn 图 */
266
312
const updateElementTask = () => {
313
+ let candidateParam =
314
+ userTaskForm .value .candidateParam instanceof Array
315
+ ? userTaskForm .value .candidateParam .join (' ,' )
316
+ : userTaskForm .value .candidateParam
317
+
318
+ // 特殊处理多级部门情况
319
+ if (userTaskForm .value .candidateStrategy == CandidateStrategy .MULTI_LEVEL_DEPT_LEADER ) {
320
+ candidateParam += ' |' + deptLevel .value
321
+ }
267
322
const extensions = bpmnInstances ().moddle .create (' bpmn:ExtensionElements' , {
268
323
values: [
269
324
... otherExtensions .value ,
270
325
bpmnInstances ().moddle .create (` ${prefix }:CandidateStrategy ` , {
271
326
value: userTaskForm .value .candidateStrategy
272
327
}),
273
328
bpmnInstances ().moddle .create (` ${prefix }:CandidateParam ` , {
274
- value:
275
- userTaskForm .value .candidateParam instanceof Array
276
- ? userTaskForm .value .candidateParam .join (' ,' )
277
- : userTaskForm .value .candidateParam
329
+ value: candidateParam
278
330
})
279
331
]
280
332
})
0 commit comments