From 632bcb9944c4b51cb5f379313c549616566cab52 Mon Sep 17 00:00:00 2001 From: jason <2667446@qq.com> Date: Thu, 6 Jun 2024 10:05:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=BF=E9=92=89=E9=92=89=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8-=20=E9=80=9A=E8=BF=87=E5=8F=AA?= =?UTF-8?q?=E9=9C=80=E4=B8=80=E4=BA=BA,=E6=8B=92=E7=BB=9D=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E5=85=A8=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/NodeHandler.vue | 2 +- .../SimpleProcessDesignerV2/src/consts.ts | 44 +++++++++--- .../src/nodes-config/UserTaskNodeConfig.vue | 71 +++++++++++++------ 3 files changed, 85 insertions(+), 32 deletions(-) diff --git a/src/components/SimpleProcessDesignerV2/src/NodeHandler.vue b/src/components/SimpleProcessDesignerV2/src/NodeHandler.vue index 40b7a02f..5e1db576 100644 --- a/src/components/SimpleProcessDesignerV2/src/NodeHandler.vue +++ b/src/components/SimpleProcessDesignerV2/src/NodeHandler.vue @@ -84,7 +84,7 @@ const addNode = (type: number) => { enable: false }, rejectHandler: { - type: RejectHandlerType.TERMINATION + type: RejectHandlerType.FINISH_PROCESS } }, childNode: props.childNode diff --git a/src/components/SimpleProcessDesignerV2/src/consts.ts b/src/components/SimpleProcessDesignerV2/src/consts.ts index 70b201f0..a3638415 100644 --- a/src/components/SimpleProcessDesignerV2/src/consts.ts +++ b/src/components/SimpleProcessDesignerV2/src/consts.ts @@ -66,11 +66,20 @@ export enum RejectHandlerType { /** * 结束流程 */ - TERMINATION = 1, + FINISH_PROCESS = 1, /** * 驳回到指定节点 */ - RETURN_PRE_USER_TASK = 2 + RETURN_PRE_USER_TASK = 2, + /** + * 按拒绝人数比例终止流程 + */ + FINISH_PROCESS_BY_REJECT_RATIO = 3, + /** + * 结束任务 + */ + FINISH_TASK = 4 + } // 条件配置类型 ( 用于条件节点配置 ) @@ -99,13 +108,22 @@ export enum ApproveMethodType { */ ALL_APPROVE = 2, /** - * 多人或签(一名审批人同意即可) + * 多人会签(按比例投票) */ - ANY_OF_APPROVE = 3, + APPROVE_BY_RATIO = 3, + /** + * 多人会签(通过只需一人,拒绝需要全员) + */ + ANY_APPROVE_ALL_REJECT = 4, + + /** + * 多人或签(一名审批人通过即可) + */ + ANY_APPROVE = 5, /** * 多人依次审批 */ - SEQUENTIAL_APPROVE = 4 + SEQUENTIAL_APPROVE = 6 } @@ -198,10 +216,12 @@ NODE_DEFAULT_NAME.set(NodeType.COPY_TASK_NODE, '抄送人') NODE_DEFAULT_NAME.set(NodeType.CONDITION_NODE, '条件') export const APPROVE_METHODS: DictDataVO [] = [ - { label: '单人审批', value: 1 }, - { label: '多人会签(需所有审批人同意)', value: 2 }, - { label: '多人或签(一名审批人同意即可)', value: 3 }, - { label: '依次审批(按顺序依次审批)', value: 4 } + { label: '单人审批', value: ApproveMethodType.SINGLE_PERSON_APPROVE }, + { label: '多人会签(需所有审批人同意)', value: ApproveMethodType.ALL_APPROVE }, + // { label: '多人会签(按比例投票)', value: ApproveMethodType.APPROVE_BY_RATIO }, + { label: '多人会签(通过只需一人,拒绝需要全员)', value: ApproveMethodType.ANY_APPROVE_ALL_REJECT }, + { label: '多人或签(一名审批人通过即可)', value: ApproveMethodType.ANY_APPROVE }, + { label: '依次审批(按顺序依次审批)', value: ApproveMethodType.SEQUENTIAL_APPROVE } ] export const CONDITION_CONFIG_TYPES: DictDataVO [] = [ @@ -222,8 +242,10 @@ export const TIMEOUT_HANDLER_ACTION_TYPES: DictDataVO [] = [ { label: '自动拒绝', value: 3 }, ] export const REJECT_HANDLER_TYPES: DictDataVO [] = [ - { label: '结束流程', value: RejectHandlerType.TERMINATION }, - { label: '驳回到指定节点', value: RejectHandlerType.RETURN_PRE_USER_TASK } + { label: '终止流程', value: RejectHandlerType.FINISH_PROCESS }, + { label: '驳回到指定节点', value: RejectHandlerType.RETURN_PRE_USER_TASK }, + { label: '按拒绝人数终止流程(用于会签)', value: RejectHandlerType.FINISH_PROCESS_BY_REJECT_RATIO } + // { label: '结束任务', value: RejectHandlerType.FINISH_TASK } ] // 比较运算符 diff --git a/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue b/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue index 5815d176..71fb5411 100644 --- a/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue +++ b/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue @@ -144,7 +144,10 @@ /> - +
审批人拒绝时 - - - + + +
+
+ +
+
- + - + { timeUnit.value = convertTimeUnit(parseTimeUnit) } // 查找可以驳回的用户节点 - const matchNodeList = []; - emits('find:returnTaskNodes', matchNodeList); - returnTaskList.value = matchNodeList; + const matchNodeList = [] + emits('find:returnTaskNodes', matchNodeList) + returnTaskList.value = matchNodeList } defineExpose({ open, setCurrentNode }) // 暴露方法给父组件 @@ -517,12 +529,30 @@ const blurEvent = () => { currentNode.value.name = currentNode.value.name || (NODE_DEFAULT_NAME.get(NodeType.USER_TASK_NODE) as string) } -const rejectHandlerTypeChange = () => { - if (currentNode.value.attributes?.rejectHandler.type === RejectHandlerType.RETURN_PRE_USER_TASK) { - - console.log('nodeList is {}', returnTaskList.value); +const approveMethodChanged = () => { + const approveMethod = currentNode.value.attributes?.approveMethod + if (approveMethod === ApproveMethodType.ANY_APPROVE_ALL_REJECT || approveMethod === ApproveMethodType.APPROVE_BY_RATIO) { + currentNode.value.attributes.rejectHandler.type =RejectHandlerType.FINISH_PROCESS_BY_REJECT_RATIO + } else { + currentNode.value.attributes.rejectHandler.type = RejectHandlerType.FINISH_PROCESS } } +const rejectHandlerOptionDisabled = computed(() => { + return (val: number) => { + const approveMethod = currentNode.value.attributes?.approveMethod + if (val === RejectHandlerType.FINISH_PROCESS_BY_REJECT_RATIO && approveMethod !== ApproveMethodType.APPROVE_BY_RATIO + && approveMethod !== ApproveMethodType.ANY_APPROVE_ALL_REJECT) { + return true + } + if ( approveMethod === ApproveMethodType.ANY_APPROVE_ALL_REJECT && + val === RejectHandlerType.FINISH_PROCESS + ) { + return true + } + + return false + } +}) // 默认 6小时 const timeDuration = ref(6) const timeUnit = ref(TimeUnitType.HOUR) @@ -540,6 +570,7 @@ const isoTimeDuration = computed(() => { } return strTimeDuration }) + // 超时开关改变 const timeoutHandlerChange = () => { if (currentNode.value.attributes.timeoutHandler.enable) {