From 3b8ecadc78d6a247c1bd736fe37dfb7ff53badd4 Mon Sep 17 00:00:00 2001 From: dap <dap@qq.com> Date: 星期三, 15 五月 2024 11:34:58 +0800 Subject: [PATCH] refactor: 流程定义-流程图片改为bpmn组件预览 --- src/components/BpmnView/index.vue | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 51 insertions(+), 9 deletions(-) diff --git a/src/components/BpmnView/index.vue b/src/components/BpmnView/index.vue index 08ce1c5..4ea890d 100644 --- a/src/components/BpmnView/index.vue +++ b/src/components/BpmnView/index.vue @@ -76,6 +76,28 @@ }); }; +const initXml = (xmlStr: string) => { + loading.value = true; + bpmnVisible.value = true; + nextTick(async () => { + if (modeler.value) modeler.value.destroy(); + modeler.value = new BpmnViewer({ + container: canvas.value, + additionalModules: [ + { + //绂佹婊氳疆婊氬姩 + zoomScroll: ['value', ''] + }, + ZoomScrollModule, + MoveCanvasModule + ] as ModuleDeclaration[] + }); + xml.value = xmlStr; + await createDiagram(xml.value); + loading.value = false; + }); +}; + const createDiagram = async (data) => { try { await modeler.value.importXML(data); @@ -238,7 +260,8 @@ } }; defineExpose({ - init + init, + initXml }); </script> @@ -338,16 +361,35 @@ :deep(.highlight.djs-connection > .djs-visual > path) { stroke: green !important; } - :deep(.highlight-todo.djs-connection > .djs-visual > path) { - stroke: orange !important; - stroke-dasharray: 4px !important; - fill-opacity: 0.2 !important; - marker-end: url(#sequenceflow-end-_E7DFDF-_E7DFDF-803g1kf6zwzmcig1y2ulm5egr); + + // 杈规婊氬姩鍔ㄧ敾 + @keyframes path-animation { + from { + stroke-dashoffset: 100%; + } + + to { + stroke-dashoffset: 0%; + } } - :deep(.highlight-todo.djs-shape .djs-visual > :nth-child(1)) { - fill: orange !important; - stroke: orange !important; + + :deep(.highlight-todo.djs-connection > .djs-visual > path) { + animation: path-animation 60s; + animation-timing-function: linear; + animation-iteration-count: infinite; stroke-dasharray: 4px !important; + stroke: orange !important; + fill-opacity: 0.2 !important; + marker-end: url('#sequenceflow-end-_E7DFDF-_E7DFDF-803g1kf6zwzmcig1y2ulm5egr'); + } + + :deep(.highlight-todo.djs-shape .djs-visual > :nth-child(1)) { + animation: path-animation 60s; + animation-timing-function: linear; + animation-iteration-count: infinite; + stroke-dasharray: 4px !important; + stroke: orange !important; + fill: orange !important; fill-opacity: 0.2 !important; } } -- Gitblit v1.9.3