From 2ff1bccbaff7be85c11669247073f27f1ebee329 Mon Sep 17 00:00:00 2001 From: Lesan <1960681385@qq.com> Date: Wed, 26 Feb 2025 09:38:10 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BB=A3=E7=A0=81=E8=AF=84=E5=AE=A1?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SimpleProcessDesignerV2/src/consts.ts | 39 ++++++++++-- .../nodes-config/ChildProcessNodeConfig.vue | 62 ++++++++++++------- 2 files changed, 76 insertions(+), 25 deletions(-) diff --git a/src/components/SimpleProcessDesignerV2/src/consts.ts b/src/components/SimpleProcessDesignerV2/src/consts.ts index c7285f93f..b8d08b791 100644 --- a/src/components/SimpleProcessDesignerV2/src/consts.ts +++ b/src/components/SimpleProcessDesignerV2/src/consts.ts @@ -824,17 +824,48 @@ export type ChildProcessSetting = { } export type IOParameter = { source: string - sourceExpression: string target: string - targetExpression: string } export type StartUserSetting = { - type: number + type: ChildProcessStartUserTypeEnum formField?: string - emptyType?: number + emptyType?: ChildProcessStartUserEmptyTypeEnum } export type TimeoutSetting = { enable: boolean, type?: DelayTypeEnum, timeExpression?: string, } +export enum ChildProcessStartUserTypeEnum { + /** + * 同主流程发起人 + */ + MAIN_PROCESS_START_USER = 1, + /** + * 表单 + */ + FROM_FORM = 2, +} +export const CHILD_PROCESS_START_USER_TYPE = [ + { label: '同主流程发起人', value: ChildProcessStartUserTypeEnum.MAIN_PROCESS_START_USER }, + { label: '表单', value: ChildProcessStartUserTypeEnum.FROM_FORM } +] +export enum ChildProcessStartUserEmptyTypeEnum { + /** + * 同主流程发起人 + */ + MAIN_PROCESS_START_USER = 1, + /** + * 子流程管理员 + */ + CHILD_PROCESS_ADMIN = 2, + /** + * 主流程管理员 + */ + MAIN_PROCESS_ADMIN = 3, +} +export const CHILD_PROCESS_START_USER_EMPTY_TYPE = [ + { label: '同主流程发起人', value: ChildProcessStartUserEmptyTypeEnum.MAIN_PROCESS_START_USER }, + { label: '子流程管理员', value: ChildProcessStartUserEmptyTypeEnum.CHILD_PROCESS_ADMIN }, + { label: '主流程管理员', value: ChildProcessStartUserEmptyTypeEnum.MAIN_PROCESS_ADMIN } +] diff --git a/src/components/SimpleProcessDesignerV2/src/nodes-config/ChildProcessNodeConfig.vue b/src/components/SimpleProcessDesignerV2/src/nodes-config/ChildProcessNodeConfig.vue index 9e2ce4a2d..0289151bd 100644 --- a/src/components/SimpleProcessDesignerV2/src/nodes-config/ChildProcessNodeConfig.vue +++ b/src/components/SimpleProcessDesignerV2/src/nodes-config/ChildProcessNodeConfig.vue @@ -95,7 +95,7 @@ @@ -103,7 +103,6 @@ 添加一行 - @@ -160,11 +159,13 @@ 添加一行 - - 同主流程发起人 - 表单 + + {{ item.label }} - 同主流程发起人 - 子流程管理员 - 主流程管理员 + + {{ item.label }} ({ async: false, calledProcessDefinitionKey: '', skipStartUserNode: false, inVariables: [], outVariables: [], - startUserType: 1, - startUserEmptyType: 1, + startUserType: ChildProcessStartUserTypeEnum.MAIN_PROCESS_START_USER, + startUserEmptyType: ChildProcessStartUserEmptyTypeEnum.MAIN_PROCESS_START_USER, startUserFormField: '', timeoutEnable: false, timeoutType: DelayTypeEnum.FIXED_TIME_DURATION, @@ -334,9 +357,8 @@ const saveConfig = async () => { if (!formRef) return false const valid = await formRef.value.validate() if (!valid) return false - // TODO @lesan:这里的 option 黄色告警,也处理下哈 const childInfo = childProcessOptions.value.find( - (option) => option.key === configForm.value.calledProcessDefinitionKey + (option: any) => option.key === configForm.value.calledProcessDefinitionKey ) currentNode.value.name = nodeName.value! if (currentNode.value.childProcessSetting) { @@ -378,7 +400,6 @@ const saveConfig = async () => { return true } // 显示子流程节点配置, 由父组件传过来 -// TODO @lesan:inVariables、outVariables 红色告警 const showChildProcessNodeConfig = (node: SimpleFlowNode) => { nodeName.value = node.name if (node.childProcessSetting) { @@ -421,15 +442,14 @@ const showChildProcessNodeConfig = (node: SimpleFlowNode) => { defineExpose({ openDrawer, showChildProcessNodeConfig }) // 暴露方法给父组件 -// TODO @lesan:这里的 arr 黄色告警,也处理下哈,可以用 cursor quick fix 哈 -const addVariable = (arr) => { - arr.push({ +const addVariable = (arr?: IOParameter[]) => { + arr?.push({ source: '', target: '' }) } -const deleteVariable = (arr, index: number) => { - arr.splice(index, 1) +const deleteVariable = (index: number, arr?: IOParameter[]) => { + arr?.splice(index, 1) } const handleCalledElementChange = () => { configForm.value.inVariables = [] -- Gitee From bad11ff29bb57dd1119a4a16c4c201faa5fd6cea Mon Sep 17 00:00:00 2001 From: Lesan <1960681385@qq.com> Date: Wed, 26 Feb 2025 15:23:51 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=E5=AD=90=E6=B5=81=E7=A8=8B-?= =?UTF-8?q?=E5=A4=9A=E5=AE=9E=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/NodeHandler.vue | 3 + .../SimpleProcessDesignerV2/src/consts.ts | 27 ++++ .../nodes-config/ChildProcessNodeConfig.vue | 125 +++++++++++++++++- 3 files changed, 148 insertions(+), 7 deletions(-) diff --git a/src/components/SimpleProcessDesignerV2/src/NodeHandler.vue b/src/components/SimpleProcessDesignerV2/src/NodeHandler.vue index 255323445..25e4ed74f 100644 --- a/src/components/SimpleProcessDesignerV2/src/NodeHandler.vue +++ b/src/components/SimpleProcessDesignerV2/src/NodeHandler.vue @@ -306,6 +306,9 @@ const addNode = (type: number) => { }, timeoutSetting: { enable: false + }, + multiInstanceSetting: { + enable: false } } } diff --git a/src/components/SimpleProcessDesignerV2/src/consts.ts b/src/components/SimpleProcessDesignerV2/src/consts.ts index b8d08b791..e74ad58a4 100644 --- a/src/components/SimpleProcessDesignerV2/src/consts.ts +++ b/src/components/SimpleProcessDesignerV2/src/consts.ts @@ -821,6 +821,7 @@ export type ChildProcessSetting = { skipStartUserNode: boolean, startUserSetting: StartUserSetting, timeoutSetting: TimeoutSetting, + multiInstanceSetting: MultiInstanceSetting, } export type IOParameter = { source: string @@ -836,6 +837,13 @@ export type TimeoutSetting = { type?: DelayTypeEnum, timeExpression?: string, } +export type MultiInstanceSetting = { + enable: boolean, + sequential?: boolean, + completeRatio?: number, + sourceType?: ChildProcessMultiInstanceSourceTypeEnum, + source?: string, +} export enum ChildProcessStartUserTypeEnum { /** * 同主流程发起人 @@ -869,3 +877,22 @@ export const CHILD_PROCESS_START_USER_EMPTY_TYPE = [ { label: '子流程管理员', value: ChildProcessStartUserEmptyTypeEnum.CHILD_PROCESS_ADMIN }, { label: '主流程管理员', value: ChildProcessStartUserEmptyTypeEnum.MAIN_PROCESS_ADMIN } ] +export enum ChildProcessMultiInstanceSourceTypeEnum { + /** + * 固定数量 + */ + FIXED_QUANTITY = 1, + /** + * 数字表单 + */ + DIGITAL_FORM = 2, + /** + * 多项表单 + */ + MULTI_FORM = 3, +} +export const CHILD_PROCESS_MULTI_INSTANCE_SOURCE_TYPE = [ + { label: '固定数量', value: ChildProcessMultiInstanceSourceTypeEnum.FIXED_QUANTITY }, + { label: '数字表单', value: ChildProcessMultiInstanceSourceTypeEnum.DIGITAL_FORM }, + { label: '多项表单', value: ChildProcessMultiInstanceSourceTypeEnum.MULTI_FORM } +] diff --git a/src/components/SimpleProcessDesignerV2/src/nodes-config/ChildProcessNodeConfig.vue b/src/components/SimpleProcessDesignerV2/src/nodes-config/ChildProcessNodeConfig.vue index 0289151bd..b8f3172ec 100644 --- a/src/components/SimpleProcessDesignerV2/src/nodes-config/ChildProcessNodeConfig.vue +++ b/src/components/SimpleProcessDesignerV2/src/nodes-config/ChildProcessNodeConfig.vue @@ -164,8 +164,10 @@ - {{ item.label }} + :value="item.value" + > + {{ item.label }} - {{ item.label }} + :value="item.value" + > + {{ item.label }} 后进入下一节点 + + 多实例设置 + + + +
+ + + + + 完成比例(%) + + + + 多实例来源 + + + + + + + + + + + + + + + + + +
@@ -276,7 +342,9 @@ import { ChildProcessStartUserTypeEnum, CHILD_PROCESS_START_USER_TYPE, ChildProcessStartUserEmptyTypeEnum, - CHILD_PROCESS_START_USER_EMPTY_TYPE + CHILD_PROCESS_START_USER_EMPTY_TYPE, + CHILD_PROCESS_MULTI_INSTANCE_SOURCE_TYPE, + ChildProcessMultiInstanceSourceTypeEnum } from '../consts' import { useWatchNode, useDrawer, useNodeName, useFormFieldsAndStartUser } from '../node' import { parseFormFields } from '@/components/FormCreate/src/utils' @@ -315,7 +383,8 @@ const formRules = reactive({ timeoutEnable: [{ required: true, message: '超时设置是否开启不能为空', trigger: 'change' }], timeoutType: [{ required: true, message: '超时设置时间不能为空', trigger: 'change' }], timeDuration: [{ required: true, message: '超时设置时间不能为空', trigger: 'change' }], - dateTime: [{ required: true, message: '超时设置时间不能为空', trigger: 'change' }] + dateTime: [{ required: true, message: '超时设置时间不能为空', trigger: 'change' }], + multiInstanceEnable: [{ required: true, message: '多实例设置不能为空', trigger: 'change' }] }) type ChildProcessFormType = { async: boolean @@ -331,6 +400,11 @@ type ChildProcessFormType = { timeDuration: number timeUnit: TimeUnitType dateTime: string + multiInstanceEnable: boolean + sequential: boolean + completeRatio: number + multiInstanceSourceType: ChildProcessMultiInstanceSourceTypeEnum + multiInstanceSource: string } const configForm = ref({ async: false, @@ -345,10 +419,21 @@ const configForm = ref({ timeoutType: DelayTypeEnum.FIXED_TIME_DURATION, timeDuration: 1, timeUnit: TimeUnitType.HOUR, - dateTime: '' + dateTime: '', + multiInstanceEnable: false, + sequential: false, + completeRatio: 100, + multiInstanceSourceType: ChildProcessMultiInstanceSourceTypeEnum.FIXED_QUANTITY, + multiInstanceSource: '' }) const childProcessOptions = ref() const formFieldOptions = useFormFieldsAndStartUser() +const digitalFormFieldOptions = computed(() => { + return formFieldOptions.filter((item) => item.type === 'inputNumber') +}) +const multiFormFieldOptions = computed(() => { + return formFieldOptions.filter((item) => item.type === 'select' || item.type === 'checkbox') +}) const childFormFieldOptions = ref() // 保存配置 @@ -393,6 +478,19 @@ const saveConfig = async () => { configForm.value.dateTime } } + // 8. 多实例设置 + currentNode.value.childProcessSetting.multiInstanceSetting = { + enable: configForm.value.multiInstanceEnable + } + if (configForm.value.multiInstanceEnable) { + currentNode.value.childProcessSetting.multiInstanceSetting.sequential = configForm.value.sequential + currentNode.value.childProcessSetting.multiInstanceSetting.completeRatio = + configForm.value.completeRatio + currentNode.value.childProcessSetting.multiInstanceSetting.sourceType = + configForm.value.multiInstanceSourceType + currentNode.value.childProcessSetting.multiInstanceSetting.source = + configForm.value.multiInstanceSource + } } currentNode.value.showText = `调用子流程:${childInfo.name}` @@ -436,6 +534,16 @@ const showChildProcessNodeConfig = (node: SimpleFlowNode) => { configForm.value.dateTime = node.childProcessSetting.timeoutSetting.timeExpression ?? '' } } + // 8. 多实例设置 + configForm.value.multiInstanceEnable = + node.childProcessSetting.multiInstanceSetting.enable ?? false + if (configForm.value.multiInstanceEnable) { + configForm.value.sequential = node.childProcessSetting.multiInstanceSetting.sequential ?? false + configForm.value.completeRatio = node.childProcessSetting.multiInstanceSetting.completeRatio ?? 100 + configForm.value.multiInstanceSourceType = + node.childProcessSetting.multiInstanceSetting.sourceType ?? ChildProcessMultiInstanceSourceTypeEnum.FIXED_QUANTITY + configForm.value.multiInstanceSource = node.childProcessSetting.multiInstanceSetting.source ?? '' + } } loadFormInfo() } @@ -481,6 +589,9 @@ const getIsoTimeDuration = () => { } return strTimeDuration } +const handleMultiInstanceSourceTypeChange = () => { + configForm.value.multiInstanceSource = '' +} onMounted(async () => { childProcessOptions.value = await getModelList(undefined) -- Gitee