From bfafe15df79718c389698f939e9097263685fc56 Mon Sep 17 00:00:00 2001 From: cxc Date: Thu, 5 Jan 2023 11:08:01 +0800 Subject: [PATCH] no start event node warning --- src/components/ProcessDesigner/index.vue | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/components/ProcessDesigner/index.vue b/src/components/ProcessDesigner/index.vue index 8abacaf..f8ac74d 100644 --- a/src/components/ProcessDesigner/index.vue +++ b/src/components/ProcessDesigner/index.vue @@ -35,7 +35,7 @@ import "@/plugins/package/theme/index.scss"; import CustomContentPadProvider from "@/plugins/package/designer/plugins/content-pad"; import CustomPaletteProvider from "@/plugins/package/designer/plugins/palette"; import { ref, nextTick, reactive, toRefs } from "vue"; -import { ElMessageBox } from "element-plus"; +import { ElMessage, ElMessageBox } from "element-plus"; const props = defineProps({ bpmnXml: { @@ -49,7 +49,6 @@ const props = defineProps({ }); const { bpmnXml, designerForm } = toRefs(props); let element; -let msgInstance; const modeler = ref(null); const height = ref(document.documentElement.clientHeight - 94.5 + "px;"); const xmlString = ref(bpmnXml.value); @@ -88,6 +87,14 @@ function handlerEvent(eventName) { function goToFormSelect() { if (!window.bpmnInstances) return; + const startEle = window.bpmnInstances.elementRegistry.find( + (el) => el.type == "bpmn:StartEvent" + ); + if (!startEle) { + ElMessage.warning("请添加开始节点"); + return; + } + const formKeyExist = !!window.bpmnInstances.elementRegistry.find( (el) => el.type == "bpmn:StartEvent" @@ -99,9 +106,6 @@ function goToFormSelect() { icon: "warning", }) .then(() => { - const startEle = window.bpmnInstances.elementRegistry.find( - (el) => el.type == "bpmn:StartEvent" - ); const EventBus = window.bpmnInstances.eventBus; startEle && EventBus.fire("element.click", { element: startEle }); nextTick(() => {