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/views/workflow/processDefinition/components/processPreview.vue |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/views/workflow/processDefinition/components/processPreview.vue b/src/views/workflow/processDefinition/components/processPreview.vue
index 817552a..3159b32 100644
--- a/src/views/workflow/processDefinition/components/processPreview.vue
+++ b/src/views/workflow/processDefinition/components/processPreview.vue
@@ -1,9 +1,7 @@
 <template>
   <el-dialog v-model="data.visible" title="棰勮" width="70%" append-to-body>
-    <div v-if="data.type === 'png'" style="align: center">
-      <el-image v-if="data.type === 'png'" :src="data.url[0]">
-        <div>娴佺▼鍥惧姞杞戒腑 <i class="el-icon-loading"></i></div>
-      </el-image>
+    <div v-if="data.type === 'png' && data.xmlStr" style="align: center">
+      <BpmnViewer ref="bpmnViewerRef"></BpmnViewer>
     </div>
     <div v-if="data.type === 'xml'" class="xml-data">
       <div v-for="(xml, index) in data.url" :key="index">
@@ -17,16 +15,29 @@
 </template>
 
 <script setup lang="ts">
+import BpmnViewer from '@/components/BpmnView/index.vue';
+
 const data = reactive({
   visible: false,
   url: new Array<string>(),
-  type: ''
+  type: '',
+  xmlStr: ''
 });
+
+const bpmnViewerRef = ref<InstanceType<typeof BpmnViewer>>();
 //鎵撳紑
 const openDialog = (url: string[], type: string) => {
   data.visible = true;
   data.url = url;
   data.type = type;
+  /** 娴佺▼鍥� */
+  if (type === 'png') {
+    data.xmlStr = url.join('\n');
+    /** 蹇呴』鏀惧湪nextTick 鍚﹀垯绗竴娆℃墦寮�涓虹┖ */
+    nextTick(() => {
+      bpmnViewerRef.value?.initXml(data.xmlStr);
+    });
+  }
 };
 /**
  * 瀵瑰鏆撮湶瀛愮粍浠舵柟娉�

--
Gitblit v1.9.3