Skip to content

Commit 6b39710

Browse files
committed
feat: 同步bpm设计器审批人配置,连续多级部门的负责人
1 parent 9e2958f commit 6b39710

File tree

1 file changed

+58
-6
lines changed
  • src/components/bpmnProcessDesigner/package/penal/task/task-components

1 file changed

+58
-6
lines changed

src/components/bpmnProcessDesigner/package/penal/task/task-components/UserTask.vue

Lines changed: 58 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,26 @@
129129
/>
130130
</el-select>
131131
</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>
132152
<el-form-item
133153
v-if="userTaskForm.candidateStrategy === CandidateStrategy.EXPRESSION"
134154
label="流程表达式"
@@ -154,7 +174,8 @@
154174
import {
155175
CANDIDATE_STRATEGY,
156176
CandidateStrategy,
157-
FieldPermissionType
177+
FieldPermissionType,
178+
MULTI_LEVEL_DEPT
158179
} from '@/components/SimpleProcessDesignerV2/src/consts'
159180
import { defaultProps, handleTree } from '@/utils/tree'
160181
import * as RoleApi from '@/api/system/role'
@@ -192,6 +213,19 @@ const userFieldOnFormOptions = computed(() => {
192213
return formFieldOptions.filter((item) => item.type === 'UserSelect')
193214
})
194215
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+
195229
const otherExtensions = ref()
196230
197231
const resetTaskForm = () => {
@@ -210,9 +244,20 @@ const resetTaskForm = () => {
210244
(ex) => ex.$type === `${prefix}:CandidateParam`
211245
)?.[0]?.value
212246
if (candidateParamStr && candidateParamStr.length > 0) {
213-
if (userTaskForm.value.candidateStrategy === 60) {
247+
if (userTaskForm.value.candidateStrategy === CandidateStrategy.EXPRESSION) {
214248
// 特殊:流程表达式,只有一个 input 输入框
215249
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]
216261
} else {
217262
userTaskForm.value.candidateParam = candidateParamStr.split(',').map((item) => {
218263
// 如果数字超出了最大安全整数范围,则将其作为字符串处理
@@ -253,6 +298,7 @@ const resetTaskForm = () => {
253298
/** 更新 candidateStrategy 字段时,需要清空 candidateParam,并触发 bpmn 图更新 */
254299
const changeCandidateStrategy = () => {
255300
userTaskForm.value.candidateParam = []
301+
deptLevel.value = 1
256302
if (userTaskForm.value.candidateStrategy === CandidateStrategy.FORM_USER) {
257303
// 特殊处理表单内用户字段,当只有发起人选项时应选中发起人
258304
if (!userFieldOnFormOptions.value || userFieldOnFormOptions.value.length <= 1) {
@@ -264,17 +310,23 @@ const changeCandidateStrategy = () => {
264310
265311
/** 选中某个 options 时候,更新 bpmn 图 */
266312
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+
}
267322
const extensions = bpmnInstances().moddle.create('bpmn:ExtensionElements', {
268323
values: [
269324
...otherExtensions.value,
270325
bpmnInstances().moddle.create(`${prefix}:CandidateStrategy`, {
271326
value: userTaskForm.value.candidateStrategy
272327
}),
273328
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
278330
})
279331
]
280332
})

0 commit comments

Comments
 (0)