From 6b397104fcce658896a446e3a652fc5b2c9ce1e2 Mon Sep 17 00:00:00 2001 From: Lesan <1960681385@qq.com> Date: Tue, 10 Dec 2024 16:07:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=90=8C=E6=AD=A5bpm=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=AE=A1=E6=89=B9=E4=BA=BA=E9=85=8D=E7=BD=AE=EF=BC=8C?= =?UTF-8?q?=E8=BF=9E=E7=BB=AD=E5=A4=9A=E7=BA=A7=E9=83=A8=E9=97=A8=E7=9A=84?= =?UTF-8?q?=E8=B4=9F=E8=B4=A3=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../penal/task/task-components/UserTask.vue | 64 +++++++++++++++++-- 1 file changed, 58 insertions(+), 6 deletions(-) diff --git a/src/components/bpmnProcessDesigner/package/penal/task/task-components/UserTask.vue b/src/components/bpmnProcessDesigner/package/penal/task/task-components/UserTask.vue index 4cbe2c55..41daaee7 100644 --- a/src/components/bpmnProcessDesigner/package/penal/task/task-components/UserTask.vue +++ b/src/components/bpmnProcessDesigner/package/penal/task/task-components/UserTask.vue @@ -129,6 +129,26 @@ /> + + + + + { return formFieldOptions.filter((item) => item.type === 'UserSelect') }) +const deptLevel = ref(1) +const deptLevelLabel = computed(() => { + let label = '部门负责人来源' + if (userTaskForm.value.candidateStrategy == CandidateStrategy.MULTI_LEVEL_DEPT_LEADER) { + label = label + '(指定部门向上)' + } else if (userTaskForm.value.candidateStrategy == CandidateStrategy.FORM_DEPT_LEADER) { + label = label + '(表单内部门向上)' + } else { + label = label + '(发起人部门向上)' + } + return label +}) + const otherExtensions = ref() const resetTaskForm = () => { @@ -210,9 +244,20 @@ const resetTaskForm = () => { (ex) => ex.$type === `${prefix}:CandidateParam` )?.[0]?.value if (candidateParamStr && candidateParamStr.length > 0) { - if (userTaskForm.value.candidateStrategy === 60) { + if (userTaskForm.value.candidateStrategy === CandidateStrategy.EXPRESSION) { // 特殊:流程表达式,只有一个 input 输入框 userTaskForm.value.candidateParam = [candidateParamStr] + } else if (userTaskForm.value.candidateStrategy == CandidateStrategy.MULTI_LEVEL_DEPT_LEADER) { + // 特殊:多级不部门负责人,需要通过'|'分割 + userTaskForm.value.candidateParam = candidateParamStr + .split('|')[0] + .split(',') + .map((item) => { + // 如果数字超出了最大安全整数范围,则将其作为字符串处理 + let num = Number(item) + return num > Number.MAX_SAFE_INTEGER || num < -Number.MAX_SAFE_INTEGER ? item : num + }) + deptLevel.value = +candidateParamStr.split('|')[1] } else { userTaskForm.value.candidateParam = candidateParamStr.split(',').map((item) => { // 如果数字超出了最大安全整数范围,则将其作为字符串处理 @@ -253,6 +298,7 @@ const resetTaskForm = () => { /** 更新 candidateStrategy 字段时,需要清空 candidateParam,并触发 bpmn 图更新 */ const changeCandidateStrategy = () => { userTaskForm.value.candidateParam = [] + deptLevel.value = 1 if (userTaskForm.value.candidateStrategy === CandidateStrategy.FORM_USER) { // 特殊处理表单内用户字段,当只有发起人选项时应选中发起人 if (!userFieldOnFormOptions.value || userFieldOnFormOptions.value.length <= 1) { @@ -264,6 +310,15 @@ const changeCandidateStrategy = () => { /** 选中某个 options 时候,更新 bpmn 图 */ const updateElementTask = () => { + let candidateParam = + userTaskForm.value.candidateParam instanceof Array + ? userTaskForm.value.candidateParam.join(',') + : userTaskForm.value.candidateParam + + // 特殊处理多级部门情况 + if (userTaskForm.value.candidateStrategy == CandidateStrategy.MULTI_LEVEL_DEPT_LEADER) { + candidateParam += '|' + deptLevel.value + } const extensions = bpmnInstances().moddle.create('bpmn:ExtensionElements', { values: [ ...otherExtensions.value, @@ -271,10 +326,7 @@ const updateElementTask = () => { value: userTaskForm.value.candidateStrategy }), bpmnInstances().moddle.create(`${prefix}:CandidateParam`, { - value: - userTaskForm.value.candidateParam instanceof Array - ? userTaskForm.value.candidateParam.join(',') - : userTaskForm.value.candidateParam + value: candidateParam }) ] })