From 2fe28af05d6d8d736255cb3e10ad52f3052fa799 Mon Sep 17 00:00:00 2001 From: jason <2667446@qq.com> Date: Mon, 18 Nov 2024 09:03:45 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=8A=9F=E8=83=BD=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E3=80=91=E5=80=99=E9=80=89=E4=BA=BA=E7=AD=96=E7=95=A5=EF=BC=9A?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=A1=A8=E5=8D=95=E9=83=A8=E9=97=A8=E8=B4=9F?= =?UTF-8?q?=E8=B4=A3=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SimpleProcessDesignerV2/src/consts.ts | 6 +- .../SimpleProcessDesignerV2/src/node.ts | 22 ++++++ .../src/nodes-config/CopyTaskNodeConfig.vue | 56 ++++++++++++++- .../src/nodes-config/UserTaskNodeConfig.vue | 68 +++++++++++++------ 4 files changed, 127 insertions(+), 25 deletions(-) diff --git a/src/components/SimpleProcessDesignerV2/src/consts.ts b/src/components/SimpleProcessDesignerV2/src/consts.ts index a712fb13..9b78fa11 100644 --- a/src/components/SimpleProcessDesignerV2/src/consts.ts +++ b/src/components/SimpleProcessDesignerV2/src/consts.ts @@ -145,11 +145,14 @@ export enum CandidateStrategy { * 指定用户组 */ USER_GROUP = 40, - /** * 表单内用户字段 */ USER_FIELD_ON_FORM = 50, + /** + * 表单内部门负责人 + */ + DEPT_LEADER_ON_FORM = 51, /** * 流程表达式 */ @@ -430,6 +433,7 @@ export const CANDIDATE_STRATEGY: DictDataVO[] = [ { label: '发起人连续部门负责人', value: CandidateStrategy.START_USER_MULTI_LEVEL_DEPT_LEADER }, { label: '用户组', value: CandidateStrategy.USER_GROUP }, { label: '表单内用户字段', value: CandidateStrategy.USER_FIELD_ON_FORM }, + { label: '表单内部门负责人', value: CandidateStrategy.DEPT_LEADER_ON_FORM }, { label: '流程表达式', value: CandidateStrategy.EXPRESSION } ] // 审批节点 的审批类型 diff --git a/src/components/SimpleProcessDesignerV2/src/node.ts b/src/components/SimpleProcessDesignerV2/src/node.ts index 53e2b11f..167e2c5d 100644 --- a/src/components/SimpleProcessDesignerV2/src/node.ts +++ b/src/components/SimpleProcessDesignerV2/src/node.ts @@ -146,6 +146,7 @@ export type UserTaskFormType = { postIds?: number[] // 岗位 expression?: string // 流程表达式 userFieldOnForm?: string // 表单内用户字段 + deptFieldOnForm?: string // 表单内部门字段 approveRatio?: number rejectHandlerType?: RejectHandlerType returnNodeId?: string @@ -169,6 +170,7 @@ export type CopyTaskFormType = { userGroups?: number[] // 用户组 postIds?: number[] // 岗位 userFieldOnForm?: string // 表单内用户字段 + deptFieldOnForm?: string // 表单内部门字段 expression?: string // 流程表达式 } @@ -285,6 +287,11 @@ export function useNodeForm(nodeType: NodeType) { showText = `表单用户:${item?.title}` } + // 表单内部门负责人 + if (configForm.value?.candidateStrategy === CandidateStrategy.DEPT_LEADER_ON_FORM) { + showText = `表单内部门负责人` + } + // 发起人自选 if (configForm.value?.candidateStrategy === CandidateStrategy.START_USER_SELECT) { showText = `发起人自选` @@ -353,6 +360,13 @@ export function useNodeForm(nodeType: NodeType) { candidateParam = deptIds.concat('|' + configForm.value.deptLevel + '') break } + // 表单内部门的负责人 + case CandidateStrategy.DEPT_LEADER_ON_FORM: { + // 候选人参数格式: | 分隔 。左边为表单内部门字段。 右边为部门层级 + const deptFieldOnForm = configForm.value.deptFieldOnForm! + candidateParam = deptFieldOnForm.concat('|' + configForm.value.deptLevel + '') + break + } default: break } @@ -405,6 +419,14 @@ export function useNodeForm(nodeType: NodeType) { configForm.value.deptLevel = +paramArray[1] break } + // 表单内的部门负责人 + case CandidateStrategy.DEPT_LEADER_ON_FORM: { + // 候选人参数格式: | 分隔 。左边为表单内的部门字段。 右边为部门层级 + const paramArray = candidateParam.split('|') + configForm.value.deptFieldOnForm = paramArray[0] + configForm.value.deptLevel = +paramArray[1] + break + } default: break } diff --git a/src/components/SimpleProcessDesignerV2/src/nodes-config/CopyTaskNodeConfig.vue b/src/components/SimpleProcessDesignerV2/src/nodes-config/CopyTaskNodeConfig.vue index 5df0d882..91ac5b87 100644 --- a/src/components/SimpleProcessDesignerV2/src/nodes-config/CopyTaskNodeConfig.vue +++ b/src/components/SimpleProcessDesignerV2/src/nodes-config/CopyTaskNodeConfig.vue @@ -60,7 +60,8 @@ + + + + + + + + + + { + let label = '部门负责人来源' + if (configForm.value.candidateStrategy == CandidateStrategy.MULTI_LEVEL_DEPT_LEADER) { + label = label + '(指定部门向上)' + } else { + label = label + '(发起人部门向上)' + } + return label +}) // 抽屉配置 const { settingVisible, closeDrawer, openDrawer } = useDrawer() // 当前节点 @@ -252,6 +297,12 @@ const userFieldOnFormOptions = computed(() => { (item) => item.required && item.type === 'UserSelect' ) }) +// 表单内部门字段选项, 必须是必填和部门选择器 +const deptFieldOnFormOptions = computed(() => { + return formFieldOptions.filter( + (item) => item.required && item.type === 'DeptSelect' + ) +}) // 抄送人表单配置 const formRef = ref() // 表单 Ref // 表单校验规则 @@ -263,6 +314,7 @@ const formRules = reactive({ userGroups: [{ required: true, message: '用户组不能为空', trigger: 'change' }], postIds: [{ required: true, message: '岗位不能为空', trigger: 'change' }], userFieldOnForm: [{ required: true, message: '表单内用户字段不能为空', trigger: 'change' }], + deptFieldOnForm: [{ required: true, message: '表单内部门字段不能为空', trigger: 'change' }], expression: [{ required: true, message: '流程表达式不能为空', trigger: 'blur' }] }) diff --git a/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue b/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue index 400ead2c..02ec582c 100644 --- a/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue +++ b/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue @@ -56,7 +56,6 @@ - - - - - - + + + + + + + + + + { let label = '部门负责人来源' if (configForm.value.candidateStrategy == CandidateStrategy.MULTI_LEVEL_DEPT_LEADER) { label = label + '(指定部门向上)' + } else if (configForm.value.candidateStrategy == CandidateStrategy.DEPT_LEADER_ON_FORM) { + label = label + '(表单内部门向上)' } else { - label = label + '(发起人部门向上)' + label = label + '(发起人部门向上)' } return label }) @@ -505,6 +521,12 @@ const userFieldOnFormOptions = computed(() => { (item) => item.required && item.type === 'UserSelect' ) }) +// 表单内部门字段选项, 必须是必填和部门选择器 +const deptFieldOnFormOptions = computed(() => { + return formFieldOptions.filter( + (item) => item.required && item.type === 'DeptSelect' + ) +}) // 操作按钮设置 const { buttonsSetting, btnDisplayNameEdit, changeBtnDisplayName, btnDisplayNameBlurEvent } = useButtonsSetting() @@ -519,6 +541,7 @@ const formRules = reactive({ deptIds: [{ required: true, message: '部门不能为空', trigger: 'change' }], userGroups: [{ required: true, message: '用户组不能为空', trigger: 'change' }], userFieldOnForm: [{ required: true, message: '表单内用户字段不能为空', trigger: 'change' }], + deptFieldOnForm: [{ required: true, message: '表单内部门字段不能为空', trigger: 'change' }], postIds: [{ required: true, message: '岗位不能为空', trigger: 'change' }], expression: [{ required: true, message: '流程表达式不能为空', trigger: 'blur' }], approveMethod: [{ required: true, message: '多人审批方式不能为空', trigger: 'change' }], @@ -554,7 +577,8 @@ const changeCandidateStrategy = () => { configForm.value.postIds = [] configForm.value.userGroups = [] configForm.value.deptLevel = 1 - configForm.value.userFieldOnForm = '' + configForm.value.userFieldOnForm = '' + configForm.value.deptFieldOnForm = '' configForm.value.approveMethod = ApproveMethodType.SEQUENTIAL_APPROVE }