From 42de3d91275cc1b3db029d3443bb888d0d034499 Mon Sep 17 00:00:00 2001 From: jason <2667446@qq.com> Date: Sun, 19 Jan 2025 18:40:18 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=8A=9F=E8=83=BD=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E3=80=91=E6=9D=A1=E4=BB=B6=E8=8A=82=E7=82=B9=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/NodeHandler.vue | 20 +++++--- .../SimpleProcessDesignerV2/src/consts.ts | 24 ++++++--- .../SimpleProcessDesignerV2/src/node.ts | 2 - .../src/nodes-config/ConditionNodeConfig.vue | 50 +++++++++++-------- .../src/nodes/InclusiveNode.vue | 2 +- 5 files changed, 59 insertions(+), 39 deletions(-) diff --git a/src/components/SimpleProcessDesignerV2/src/NodeHandler.vue b/src/components/SimpleProcessDesignerV2/src/NodeHandler.vue index 25e54f6b..c94998d5 100644 --- a/src/components/SimpleProcessDesignerV2/src/NodeHandler.vue +++ b/src/components/SimpleProcessDesignerV2/src/NodeHandler.vue @@ -163,8 +163,10 @@ const addNode = (type: number) => { showText: '', type: NodeType.CONDITION_NODE, childNode: undefined, - conditionType: 1, - defaultFlow: false + conditionSetting: { + defaultFlow: false + }, + }, { id: 'Flow_' + generateUUID(), @@ -172,8 +174,9 @@ const addNode = (type: number) => { showText: '未满足其它条件时,将进入此分支', type: NodeType.CONDITION_NODE, childNode: undefined, - conditionType: undefined, - defaultFlow: true + conditionSetting: { + defaultFlow: true + } } ] } @@ -217,7 +220,10 @@ const addNode = (type: number) => { showText: '', type: NodeType.CONDITION_NODE, childNode: undefined, - defaultFlow: false + conditionSetting: { + defaultFlow: false + } + }, { id: 'Flow_' + generateUUID(), @@ -225,7 +231,9 @@ const addNode = (type: number) => { showText: '未满足其它条件时,将进入此分支', type: NodeType.CONDITION_NODE, childNode: undefined, - defaultFlow: true + conditionSetting: { + defaultFlow: true + } } ] } diff --git a/src/components/SimpleProcessDesignerV2/src/consts.ts b/src/components/SimpleProcessDesignerV2/src/consts.ts index 55808c96..ffc37b80 100644 --- a/src/components/SimpleProcessDesignerV2/src/consts.ts +++ b/src/components/SimpleProcessDesignerV2/src/consts.ts @@ -103,14 +103,8 @@ export interface SimpleFlowNode { taskAssignListener?: ListenerHandler // 创建任务监听器 taskCompleteListener?: ListenerHandler - // 条件类型 - conditionType?: ConditionType - // 条件表达式 - conditionExpression?: string - // 条件组 - conditionGroups?: ConditionGroup - // 是否默认的条件 - defaultFlow?: boolean + // 条件设置 + conditionSetting?: ConditionSetting // 活动的状态,用于前端节点状态展示 activityStatus?: TaskStatusEnum // 延迟设置 @@ -365,6 +359,20 @@ export enum TimeUnitType { DAY = 3 } +/** + * 条件节点设置结构定义,用于条件节点 + */ +export type ConditionSetting = { + // 条件类型 + conditionType?: ConditionType, + // 条件表达式 + conditionExpression?: string, + // 条件组 + conditionGroups?: ConditionGroup, + // 是否默认的条件 + defaultFlow?: boolean +} + // 条件配置类型 ( 用于条件节点配置 ) export enum ConditionType { /** diff --git a/src/components/SimpleProcessDesignerV2/src/node.ts b/src/components/SimpleProcessDesignerV2/src/node.ts index 79bb5d38..ea983ce9 100644 --- a/src/components/SimpleProcessDesignerV2/src/node.ts +++ b/src/components/SimpleProcessDesignerV2/src/node.ts @@ -113,7 +113,6 @@ export function useFormFields() { } export type UserTaskFormType = { - //candidateParamArray: any[] candidateStrategy: CandidateStrategy approveMethod: ApproveMethodType roleIds?: number[] // 角色 @@ -152,7 +151,6 @@ export type UserTaskFormType = { } export type CopyTaskFormType = { - // candidateParamArray: any[] candidateStrategy: CandidateStrategy roleIds?: number[] // 角色 deptIds?: number[] // 部门 diff --git a/src/components/SimpleProcessDesignerV2/src/nodes-config/ConditionNodeConfig.vue b/src/components/SimpleProcessDesignerV2/src/nodes-config/ConditionNodeConfig.vue index ae931724..7c45e1bf 100644 --- a/src/components/SimpleProcessDesignerV2/src/nodes-config/ConditionNodeConfig.vue +++ b/src/components/SimpleProcessDesignerV2/src/nodes-config/ConditionNodeConfig.vue @@ -26,13 +26,16 @@
-
未满足其它条件时,将进入此分支(该分支不可编辑和删除)
+
+ 未满足其它条件时,将进入此分支(该分支不可编辑和删除) +
- + - + - +
条件组关系
@@ -194,9 +200,9 @@ const props = defineProps({ }) const settingVisible = ref(false) const open = () => { - if (currentNode.value.conditionType === ConditionType.RULE) { - if (currentNode.value.conditionGroups) { - conditionGroups.value = currentNode.value.conditionGroups + if (currentNode.value.conditionSetting?.conditionType === ConditionType.RULE) { + if (currentNode.value.conditionSetting?.conditionGroups) { + conditionGroups.value = currentNode.value.conditionSetting.conditionGroups } } settingVisible.value = true @@ -219,7 +225,7 @@ const blurEvent = () => { showInput.value = false currentNode.value.name = currentNode.value.name || - getDefaultConditionNodeName(props.nodeIndex, currentNode.value?.defaultFlow) + getDefaultConditionNodeName(props.nodeIndex, currentNode.value?.conditionSetting?.defaultFlow) } const currentNode = ref(props.conditionNode) @@ -248,7 +254,7 @@ const formRef = ref() // 表单 Ref // 保存配置 const saveConfig = async () => { - if (!currentNode.value.defaultFlow) { + if (!currentNode.value.conditionSetting?.defaultFlow) { // 校验表单 if (!formRef) return false const valid = await formRef.value.validate() @@ -258,12 +264,12 @@ const saveConfig = async () => { return false } currentNode.value.showText = showText - if (currentNode.value.conditionType === ConditionType.EXPRESSION) { - currentNode.value.conditionGroups = undefined + if (currentNode.value.conditionSetting?.conditionType === ConditionType.EXPRESSION) { + currentNode.value.conditionSetting.conditionGroups = undefined } - if (currentNode.value.conditionType === ConditionType.RULE) { - currentNode.value.conditionExpression = undefined - currentNode.value.conditionGroups = conditionGroups.value + if (currentNode.value.conditionSetting?.conditionType === ConditionType.RULE) { + currentNode.value.conditionSetting.conditionExpression = undefined + currentNode.value.conditionSetting.conditionGroups = conditionGroups.value } } settingVisible.value = false @@ -271,12 +277,12 @@ const saveConfig = async () => { } const getShowText = (): string => { let showText = '' - if (currentNode.value.conditionType === ConditionType.EXPRESSION) { - if (currentNode.value.conditionExpression) { - showText = `表达式:${currentNode.value.conditionExpression}` + if (currentNode.value.conditionSetting?.conditionType === ConditionType.EXPRESSION) { + if (currentNode.value.conditionSetting.conditionExpression) { + showText = `表达式:${currentNode.value.conditionSetting.conditionExpression}` } } - if (currentNode.value.conditionType === ConditionType.RULE) { + if (currentNode.value.conditionSetting?.conditionType === ConditionType.RULE) { // 条件组是否为与关系 const groupAnd = conditionGroups.value.and let warningMesg: undefined | string = undefined diff --git a/src/components/SimpleProcessDesignerV2/src/nodes/InclusiveNode.vue b/src/components/SimpleProcessDesignerV2/src/nodes/InclusiveNode.vue index f1445d83..fb512913 100644 --- a/src/components/SimpleProcessDesignerV2/src/nodes/InclusiveNode.vue +++ b/src/components/SimpleProcessDesignerV2/src/nodes/InclusiveNode.vue @@ -34,7 +34,7 @@ ]" >
-
+