From 6ffd3dbd67fb25f22cb3f27b2da4a8ee116c7519 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Sun, 14 Sep 2025 18:20:11 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E9=87=8D=E6=9E=84=20bpmnProcessDes?= =?UTF-8?q?igner=20=E7=BB=84=E4=BB=B6=20ele=20=3D>=20antd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../package/penal/PropertiesPanel.vue | 517 +++++++++++++----- .../package/penal/base/ElementBaseInfo.vue | 2 - .../custom-config/ElementCustomConfig.vue | 8 +- .../components/BoundaryEventTimer.vue | 4 +- .../penal/flow-condition/FlowCondition.vue | 3 +- .../package/penal/form/ElementForm.vue | 6 +- .../penal/listeners/ElementListeners.vue | 7 +- .../penal/listeners/ProcessListenerDialog.vue | 10 +- .../package/penal/task/ElementTask.vue | 64 +-- 9 files changed, 418 insertions(+), 203 deletions(-) diff --git a/apps/web-antd/src/components/bpmnProcessDesigner/package/penal/PropertiesPanel.vue b/apps/web-antd/src/components/bpmnProcessDesigner/package/penal/PropertiesPanel.vue index 092e3130..c006e202 100644 --- a/apps/web-antd/src/components/bpmnProcessDesigner/package/penal/PropertiesPanel.vue +++ b/apps/web-antd/src/components/bpmnProcessDesigner/package/penal/PropertiesPanel.vue @@ -1,150 +1,22 @@ - +.includes('StartEvent') + ); + formVisible.value = + elementType.value === 'UserTask' || elementType.value === 'StartEvent'; + } catch (error) { + console.error('初始化表单数据失败:', error); + } +}; + +onBeforeUnmount(() => { + const w = window as any; + w.bpmnInstances = null; + isReady.value = false; +}); + +watch( + () => elementId.value, + () => { + activeTab.value = 'base'; + }, +); + +function updateNode() { + const moddle = window.bpmnInstances?.moddle; + const modeling = window.bpmnInstances?.modeling; + const elementRegistry = window.bpmnInstances?.elementRegistry; + if (!moddle || !modeling || !elementRegistry) return; + + const element = elementRegistry.get(props.businessObject.id); + if (!element) return; + + const timerDef = moddle.create('bpmn:TimerEventDefinition', {}); + switch (type.value) { + case 'time': { + timerDef.timeDate = moddle.create('bpmn:FormalExpression', { + body: condition.value, + }); + + break; + } + case 'duration': { + timerDef.timeDuration = moddle.create('bpmn:FormalExpression', { + body: condition.value, + }); + + break; + } + case 'cycle': { + timerDef.timeCycle = moddle.create('bpmn:FormalExpression', { + body: condition.value, + }); + + break; + } + // No default + } + + modeling.updateModdleProperties(element, element.businessObject, { + eventDefinitions: [timerDef], + }); +} + +// 初始化和监听 +function syncFromBusinessObject() { + if (props.businessObject) { + const timerDef = (props.businessObject.eventDefinitions || [])[0]; + if (timerDef) { + if (timerDef.timeDate) { + type.value = 'time'; + condition.value = timerDef.timeDate.body; + } else if (timerDef.timeDuration) { + type.value = 'duration'; + condition.value = timerDef.timeDuration.body; + } else if (timerDef.timeCycle) { + type.value = 'cycle'; + condition.value = timerDef.timeCycle.body; + } + } + } +} +onMounted(syncFromBusinessObject); +watch(() => props.businessObject, syncFromBusinessObject, { deep: true }); + + diff --git a/apps/web-antd/src/components/bpmnProcessDesigner/package/penal/base/ElementBaseInfo.vue b/apps/web-antd/src/components/bpmnProcessDesigner/package/penal/base/ElementBaseInfo.vue index 45589e51..ad9ece8f 100644 --- a/apps/web-antd/src/components/bpmnProcessDesigner/package/penal/base/ElementBaseInfo.vue +++ b/apps/web-antd/src/components/bpmnProcessDesigner/package/penal/base/ElementBaseInfo.vue @@ -2,7 +2,6 @@ import { onBeforeUnmount, reactive, ref, toRaw, watch } from 'vue'; import { Form, FormItem, Input } from 'ant-design-vue'; -import type { FormInstance, Rule } from 'ant-design-vue'; defineOptions({ name: 'ElementBaseInfo' }); @@ -24,7 +23,6 @@ interface Model { [key: string]: any; } -const formRef = ref(); const needProps = ref>({}); const bpmnElement = ref(); const elementBaseInfo = ref({} as any); diff --git a/apps/web-antd/src/components/bpmnProcessDesigner/package/penal/custom-config/ElementCustomConfig.vue b/apps/web-antd/src/components/bpmnProcessDesigner/package/penal/custom-config/ElementCustomConfig.vue index ce49ca1f..e8b307ce 100644 --- a/apps/web-antd/src/components/bpmnProcessDesigner/package/penal/custom-config/ElementCustomConfig.vue +++ b/apps/web-antd/src/components/bpmnProcessDesigner/package/penal/custom-config/ElementCustomConfig.vue @@ -1,7 +1,8 @@ + +