diff --git a/src/components/BpmnDesign/PropertyPanel.vue b/src/components/BpmnDesign/PropertyPanel.vue index 9f89384..ad5d58c 100644 --- a/src/components/BpmnDesign/PropertyPanel.vue +++ b/src/components/BpmnDesign/PropertyPanel.vue @@ -20,6 +20,7 @@ interface propsType { const props = withDefaults(defineProps(), {}); const element = ref(); +const processElement = ref(); const startEndType = ['bpmn:IntermediateThrowEvent', 'bpmn:StartEvent', 'bpmn:EndEvent']; const taskType = [ @@ -36,6 +37,7 @@ const sequenceType = ['bpmn:SequenceFlow']; const gatewayType = ['bpmn:InclusiveGateway', 'bpmn:ExclusiveGateway', 'bpmn:ParallelGateway', 'bpmn:EventBasedGateway']; const processType = ['bpmn:Process']; +// 组件计算 const component = computed(() => { if (!element.value) return null; const type = element.value.type; @@ -57,20 +59,20 @@ const nodeName = computed(() => { const handleModeler = () => { props.modeler.on('root.added', (e: any) => { + element.value = null; if (e.element.type === 'bpmn:Process') { - element.value = null; nextTick(() => { element.value = e.element; - // const modeling = props.modeler.get('modeling'); - // modeling.setColor(e.element.children, { - // fill: 'green' - // }); + processElement.value = e.element; }); } }); props.modeler.on('element.click', (e: any) => { if (e.element.type === 'bpmn:Process') { - element.value = e.element; + nextTick(() => { + element.value = e.element; + processElement.value = e.element; + }); } }); props.modeler.on('selection.changed', (e: any) => { @@ -81,6 +83,10 @@ const handleModeler = () => { nextTick(() => { element.value = newElement; }); + } else { + nextTick(() => { + element.value = processElement.value; + }); } }); };