diff --git a/src/components/SimpleProcessDesignerV2/src/NodeHandler.vue b/src/components/SimpleProcessDesignerV2/src/NodeHandler.vue index 81b78852..629031b8 100644 --- a/src/components/SimpleProcessDesignerV2/src/NodeHandler.vue +++ b/src/components/SimpleProcessDesignerV2/src/NodeHandler.vue @@ -120,10 +120,9 @@ const addNode = (type: number) => { showText: '', type: NodeType.CONDITION_NODE, childNode: undefined, - attributes: { - conditionType: 1, - defaultFlow: false - } + conditionType: 1, + defaultFlow: false + }, { id: 'Flow_' + generateUUID(), @@ -131,10 +130,8 @@ const addNode = (type: number) => { showText: '其它情况进入此流程', type: NodeType.CONDITION_NODE, childNode: undefined, - attributes: { - conditionType: undefined, - defaultFlow: true - } + conditionType: undefined, + defaultFlow: true } ] } diff --git a/src/components/SimpleProcessDesignerV2/src/consts.ts b/src/components/SimpleProcessDesignerV2/src/consts.ts index d0e59558..0364c5e6 100644 --- a/src/components/SimpleProcessDesignerV2/src/consts.ts +++ b/src/components/SimpleProcessDesignerV2/src/consts.ts @@ -62,7 +62,6 @@ export interface SimpleFlowNode { type: NodeType name: string showText?: string - attributes?: any // 孩子节点 childNode?: SimpleFlowNode // 条件节点 @@ -89,6 +88,15 @@ export interface SimpleFlowNode { assignEmptyHandler?: AssignEmptyHandler // 审批节点的审批人与发起人相同时,对应的处理类型 assignStartUserHandlerType?: number + // 条件类型 + conditionType?: ConditionType + // 条件表达式 + conditionExpression?: string + // 条件组 + conditionGroups?: ConditionGroup + // 是否默认的条件 + defaultFlow?: boolean + } // 候选人策略枚举 ( 用于审批节点。抄送节点 ) export enum CandidateStrategy { @@ -292,7 +300,7 @@ export enum TimeUnitType { } // 条件配置类型 ( 用于条件节点配置 ) -export enum ConditionConfigType { +export enum ConditionType { /** * 条件表达式 */ @@ -428,8 +436,8 @@ export const APPROVE_METHODS: DictDataVO[] = [ ] export const CONDITION_CONFIG_TYPES: DictDataVO[] = [ - { label: '条件表达式', value: 1 }, - { label: '条件规则', value: 2 } + { label: '条件表达式', value: ConditionType.EXPRESSION }, + { label: '条件规则', value: ConditionType.RULE } ] // 时间单位类型 diff --git a/src/components/SimpleProcessDesignerV2/src/nodes-config/ConditionNodeConfig.vue b/src/components/SimpleProcessDesignerV2/src/nodes-config/ConditionNodeConfig.vue index 4ffcd4c5..3a193d0f 100644 --- a/src/components/SimpleProcessDesignerV2/src/nodes-config/ConditionNodeConfig.vue +++ b/src/components/SimpleProcessDesignerV2/src/nodes-config/ConditionNodeConfig.vue @@ -26,19 +26,17 @@
-
其它条件不满足进入此分支(该分支不可编辑和删除)
+
其它条件不满足进入此分支(该分支不可编辑和删除)
- +
条件组关系
@@ -75,9 +73,6 @@ inactive-text="或" />
-
{ return CONDITION_CONFIG_TYPES.filter((item) => { // 业务表单暂时去掉条件规则选项 if (formType?.value !== 10) { - return item.value === 1 + return item.value === ConditionType.RULE } else { return true } @@ -202,9 +197,9 @@ const props = defineProps({ }) const settingVisible = ref(false) const open = () => { - if (currentNode.value.attributes.conditionType === ConditionConfigType.RULE) { - if (currentNode.value.attributes.conditionGroups) { - conditionGroups.value = currentNode.value.attributes.conditionGroups + if (currentNode.value.conditionType === ConditionType.RULE) { + if (currentNode.value.conditionGroups) { + conditionGroups.value = currentNode.value.conditionGroups } } settingVisible.value = true @@ -227,7 +222,7 @@ const blurEvent = () => { showInput.value = false currentNode.value.name = currentNode.value.name || - getDefaultConditionNodeName(props.nodeIndex, currentNode.value.attributes?.defaultFlow) + getDefaultConditionNodeName(props.nodeIndex, currentNode.value?.defaultFlow) } const currentNode = ref(props.conditionNode) @@ -256,7 +251,7 @@ const formRef = ref() // 表单 Ref // 保存配置 const saveConfig = async () => { - if (!currentNode.value.attributes.defaultFlow) { + if (!currentNode.value.defaultFlow) { // 校验表单 if (!formRef) return false const valid = await formRef.value.validate() @@ -266,12 +261,12 @@ const saveConfig = async () => { return false } currentNode.value.showText = showText - if (currentNode.value.attributes.conditionType === ConditionConfigType.EXPRESSION) { - currentNode.value.attributes.conditionGroups = undefined + if (currentNode.value.conditionType === ConditionType.EXPRESSION) { + currentNode.value.conditionGroups = undefined } - if (currentNode.value.attributes.conditionType === ConditionConfigType.RULE) { - currentNode.value.attributes.conditionExpression = undefined - currentNode.value.attributes.conditionGroups = conditionGroups.value + if (currentNode.value.conditionType === ConditionType.RULE) { + currentNode.value.conditionExpression = undefined + currentNode.value.conditionGroups = conditionGroups.value } } settingVisible.value = false @@ -279,12 +274,12 @@ const saveConfig = async () => { } const getShowText = (): string => { let showText = '' - if (currentNode.value.attributes.conditionType === ConditionConfigType.EXPRESSION) { - if (currentNode.value.attributes.conditionExpression) { - showText = `表达式:${currentNode.value.attributes.conditionExpression}` + if (currentNode.value.conditionType === ConditionType.EXPRESSION) { + if (currentNode.value.conditionExpression) { + showText = `表达式:${currentNode.value.conditionExpression}` } } - if (currentNode.value.attributes.conditionType === ConditionConfigType.RULE) { + if (currentNode.value.conditionType === ConditionType.RULE) { // 条件组是否为与关系 const groupAnd = conditionGroups.value.and let warningMesg: undefined | string = undefined @@ -298,7 +293,7 @@ const getShowText = (): string => { getFieldTitle(rule.leftSide) + ' ' + getOpName(rule.opCode) + ' ' + rule.rightSide ) } else { - // 又一条规则不完善。提示错误 + // 有一条规则不完善。提示错误 warningMesg = '请完善条件规则' return '' } diff --git a/src/components/SimpleProcessDesignerV2/src/nodes/ExclusiveNode.vue b/src/components/SimpleProcessDesignerV2/src/nodes/ExclusiveNode.vue index 568afa28..385a81ff 100644 --- a/src/components/SimpleProcessDesignerV2/src/nodes/ExclusiveNode.vue +++ b/src/components/SimpleProcessDesignerV2/src/nodes/ExclusiveNode.vue @@ -130,7 +130,7 @@ const blurEvent = (index: number) => { showInputs.value[index] = false const conditionNode = currentNode.value.conditionNodes?.at(index) as SimpleFlowNode conditionNode.name = - conditionNode.name || getDefaultConditionNodeName(index, conditionNode.attributes?.defaultFlow) + conditionNode.name || getDefaultConditionNodeName(index, conditionNode.defaultFlow) } // 点击条件名称 @@ -156,10 +156,8 @@ const addCondition = () => { type: NodeType.CONDITION_NODE, childNode: undefined, conditionNodes: [], - attributes: { - conditionType: 1, - defaultFlow: false - } + conditionType: 1, + defaultFlow: false } conditionNodes.splice(lastIndex, 0, conditionData) } diff --git a/src/components/SimpleProcessDesignerV2/src/utils.ts b/src/components/SimpleProcessDesignerV2/src/utils.ts index e71f74dc..854d7032 100644 --- a/src/components/SimpleProcessDesignerV2/src/utils.ts +++ b/src/components/SimpleProcessDesignerV2/src/utils.ts @@ -1,7 +1,7 @@ import { TimeUnitType, ApproveType, APPROVE_TYPE } from './consts' // 获取条件节点默认的名称 -export const getDefaultConditionNodeName = (index: number, defaultFlow: boolean): string => { +export const getDefaultConditionNodeName = (index: number, defaultFlow: boolean | undefined): string => { if (defaultFlow) { return '其它情况' }