From 506d87ec710e99494f31717f93c2b4fc5fa11a03 Mon Sep 17 00:00:00 2001 From: Lesan <1960681385@qq.com> Date: Sun, 19 Jan 2025 10:15:43 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E5=AE=A1=E6=89=B9=E6=84=8F?= =?UTF-8?q?=E8=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SimpleProcessDesignerV2/src/consts.ts | 2 ++ .../SimpleProcessDesignerV2/src/node.ts | 1 + .../src/nodes-config/UserTaskNodeConfig.vue | 9 +++++++++ .../detail/ProcessInstanceOperationButton.vue | 16 +++++++++++----- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/components/SimpleProcessDesignerV2/src/consts.ts b/src/components/SimpleProcessDesignerV2/src/consts.ts index 8aa3859b..243d0cfe 100644 --- a/src/components/SimpleProcessDesignerV2/src/consts.ts +++ b/src/components/SimpleProcessDesignerV2/src/consts.ts @@ -120,6 +120,8 @@ export interface SimpleFlowNode { defaultFlowId?: string // 签名 signEnable?: boolean + // 审批意见 + reasonRequire?: boolean } // 候选人策略枚举 ( 用于审批节点。抄送节点 ) export enum CandidateStrategy { diff --git a/src/components/SimpleProcessDesignerV2/src/node.ts b/src/components/SimpleProcessDesignerV2/src/node.ts index 79bb5d38..af65bcfc 100644 --- a/src/components/SimpleProcessDesignerV2/src/node.ts +++ b/src/components/SimpleProcessDesignerV2/src/node.ts @@ -149,6 +149,7 @@ export type UserTaskFormType = { taskCompleteListenerHeader?: ListenerParam[] taskCompleteListenerBody?: ListenerParam[] signEnable: boolean + reasonRequire: boolean } export type CopyTaskFormType = { diff --git a/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue b/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue index 8e18b756..6a76beeb 100644 --- a/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue +++ b/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue @@ -361,6 +361,11 @@ + + 审批意见 + + + @@ -698,6 +703,8 @@ const saveConfig = async () => { } // 签名 currentNode.value.signEnable = configForm.value.signEnable + // 审批意见 + currentNode.value.reasonRequire = configForm.value.reasonRequire currentNode.value.showText = showText settingVisible.value = false @@ -767,6 +774,8 @@ const showUserTaskNodeConfig = (node: SimpleFlowNode) => { configForm.value.taskCompleteListenerBody = node.taskCompleteListener?.body ?? [] // 6. 签名 configForm.value.signEnable = node?.signEnable ?? false + // 7. 审批意见 + configForm.value.reasonRequire = node?.reasonRequire ?? false } defineExpose({ openDrawer, showUserTaskNodeConfig }) // 暴露方法给父组件 diff --git a/src/views/bpm/processInstance/detail/ProcessInstanceOperationButton.vue b/src/views/bpm/processInstance/detail/ProcessInstanceOperationButton.vue index 402644e9..84933878 100644 --- a/src/views/bpm/processInstance/detail/ProcessInstanceOperationButton.vue +++ b/src/views/bpm/processInstance/detail/ProcessInstanceOperationButton.vue @@ -548,6 +548,7 @@ const approveForm = ref({}) // 审批通过时,额外的补充信息 const approveFormFApi = ref({}) // approveForms 的 fAPi // 审批通过意见表单 +const reasonRequire = ref() const approveFormRef = ref() const signRef = ref() const approveSignFormRef = ref() @@ -555,17 +556,21 @@ const approveReasonForm = reactive({ reason: '', signPicUrl: '' }) -const approveReasonRule = reactive>({ - reason: [{ required: true, message: '审批意见不能为空', trigger: 'blur' }], - signPicUrl: [{ required: true, message: '签名不能为空', trigger: 'change' }] +const approveReasonRule = computed(() => { + return { + reason: [{ required: reasonRequire.value, message: '审批意见不能为空', trigger: 'blur' }], + signPicUrl: [{ required: true, message: '签名不能为空', trigger: 'change' }] + } }) // 拒绝表单 const rejectFormRef = ref() const rejectReasonForm = reactive({ reason: '' }) -const rejectReasonRule = reactive>({ - reason: [{ required: true, message: '审批意见不能为空', trigger: 'blur' }] +const rejectReasonRule = computed(() => { + return { + reason: [{ required: reasonRequire.value, message: '审批意见不能为空', trigger: 'blur' }] + } }) // 抄送表单 @@ -966,6 +971,7 @@ const loadTodoTask = (task: any) => { approveForm.value = {} approveFormFApi.value = {} runningTask.value = task + reasonRequire.value = task?.reasonRequire ?? false // 处理 approve 表单. if (task && task.formId && task.formConf) { const tempApproveForm = {} -- Gitee From 82ee62cb14a8db8399a50a0b28cab2612f43d1a3 Mon Sep 17 00:00:00 2001 From: Lesan <1960681385@qq.com> Date: Sun, 19 Jan 2025 10:28:54 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=E5=AE=A1=E6=89=B9=E6=84=8F?= =?UTF-8?q?=E8=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../descriptor/flowableDescriptor.json | 14 +++++++++ .../components/UserTaskCustomConfig.vue | 30 ++++++++++++++----- 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/src/components/bpmnProcessDesigner/package/designer/plugins/descriptor/flowableDescriptor.json b/src/components/bpmnProcessDesigner/package/designer/plugins/descriptor/flowableDescriptor.json index 9f3ae16c..130b5941 100644 --- a/src/components/bpmnProcessDesigner/package/designer/plugins/descriptor/flowableDescriptor.json +++ b/src/components/bpmnProcessDesigner/package/designer/plugins/descriptor/flowableDescriptor.json @@ -1463,6 +1463,20 @@ "type": "String" } ] + }, + { + "name": "ReasonRequire", + "superClass": ["Element"], + "meta": { + "allowedIn": ["bpmn:UserTask"] + }, + "properties": [ + { + "name": "value", + "type": "Boolean", + "isBody": true + } + ] } ], "emumerations": [] diff --git a/src/components/bpmnProcessDesigner/package/penal/custom-config/components/UserTaskCustomConfig.vue b/src/components/bpmnProcessDesigner/package/penal/custom-config/components/UserTaskCustomConfig.vue index 206c3889..aab130d0 100644 --- a/src/components/bpmnProcessDesigner/package/penal/custom-config/components/UserTaskCustomConfig.vue +++ b/src/components/bpmnProcessDesigner/package/penal/custom-config/components/UserTaskCustomConfig.vue @@ -167,6 +167,11 @@ + + 审批意见 + + + @@ -227,6 +232,9 @@ const approveType = ref({ value: ApproveType.USER }) // 是否需要签名 const signEnable = ref({ value: false }) +// 审批意见 +const reasonRequire = ref({ value: false }) + const elExtensionElements = ref() const otherExtensions = ref() const bpmnElement = ref() @@ -320,6 +328,16 @@ const resetCustomConfigList = () => { }) } + // 是否需要签名 + signEnable.value = + elExtensionElements.value.values?.filter((ex) => ex.$type === `${prefix}:SignEnable`)?.[0] || + bpmnInstances().moddle.create(`${prefix}:SignEnable`, { value: false }) + + // 审批意见 + reasonRequire.value = + elExtensionElements.value.values?.filter((ex) => ex.$type === `${prefix}:ReasonRequire`)?.[0] || + bpmnInstances().moddle.create(`${prefix}:ReasonRequire`, { value: false }) + // 保留剩余扩展元素,便于后面更新该元素对应属性 otherExtensions.value = elExtensionElements.value.values?.filter( @@ -331,14 +349,11 @@ const resetCustomConfigList = () => { ex.$type !== `${prefix}:AssignEmptyUserIds` && ex.$type !== `${prefix}:ButtonsSetting` && ex.$type !== `${prefix}:FieldsPermission` && - ex.$type !== `${prefix}:ApproveType` + ex.$type !== `${prefix}:ApproveType` && + ex.$type !== `${prefix}:SignEnable` && + ex.$type !== `${prefix}:ReasonRequire` ) ?? [] - // 是否需要签名 - signEnable.value = - elExtensionElements.value.values?.filter((ex) => ex.$type === `${prefix}:SignEnable`)?.[0] || - bpmnInstances().moddle.create(`${prefix}:SignEnable`, { value: false }) - // 更新元素扩展属性,避免后续报错 updateElementExtensions() } @@ -388,7 +403,8 @@ const updateElementExtensions = () => { approveType.value, ...buttonsSettingEl.value, ...fieldsPermissionEl.value, - signEnable.value + signEnable.value, + reasonRequire.value ] }) bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), { -- Gitee