From 6b988bd582bfcd17fee48c476a5a6e5cc172b0d5 Mon Sep 17 00:00:00 2001
From: baoshiwei <baoshiwei@shlanbao.cn>
Date: 星期三, 12 三月 2025 10:08:33 +0800
Subject: [PATCH] dev-2

---
 src/views/workflow/processDefinition/components/processPreview.vue |   54 +++++++++++++++++++++---------------------------------
 1 files changed, 21 insertions(+), 33 deletions(-)

diff --git a/src/views/workflow/processDefinition/components/processPreview.vue b/src/views/workflow/processDefinition/components/processPreview.vue
index 817552a..19a95df 100644
--- a/src/views/workflow/processDefinition/components/processPreview.vue
+++ b/src/views/workflow/processDefinition/components/processPreview.vue
@@ -1,14 +1,10 @@
 <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>
+  <el-dialog v-model="data.visible" title="棰勮" width="70%" append-to-body destroy-on-close>
+    <div v-if="data.type === 'bpmn' && data.xmlStr">
+      <BpmnViewer ref="bpmnViewerRef"></BpmnViewer>
     </div>
-    <div v-if="data.type === 'xml'" class="xml-data">
-      <div v-for="(xml, index) in data.url" :key="index">
-        <pre class="font">{{ xml }}</pre>
-      </div>
+    <div v-if="data.type === 'xml' && data.xmlStr">
+      <highlightjs language="xml" :code="data.xmlStr" />
     </div>
     <template #footer>
       <span v-if="data.type === 'xml'" class="dialog-footer"> </span>
@@ -17,16 +13,28 @@
 </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>>();
+type PreviewType = 'xml' | 'bpmn';
 //鎵撳紑
-const openDialog = (url: string[], type: string) => {
+const openDialog = (xmlStr: string, type: PreviewType) => {
   data.visible = true;
-  data.url = url;
+  data.xmlStr = xmlStr;
   data.type = type;
+  /** 娴佺▼鍥� */
+  if (type === 'bpmn') {
+    /** 蹇呴』鏀惧湪nextTick 鍚﹀垯绗竴娆℃墦寮�涓虹┖ */
+    nextTick(() => {
+      bpmnViewerRef.value?.initXml(data.xmlStr);
+    });
+  }
 };
 /**
  * 瀵瑰鏆撮湶瀛愮粍浠舵柟娉�
@@ -35,23 +43,3 @@
   openDialog
 });
 </script>
-<style>
-.xml-data {
-  background-color: #2b2b2b;
-  border-radius: 5px;
-  color: #c6c6c6;
-  word-break: break-all;
-  overflow-y: scroll;
-  overflow-x: hidden;
-  box-sizing: border-box;
-  padding: 8px 0px;
-  height: 500px;
-  width: inherit;
-  line-height: 1px;
-  overflow: auto;
-}
-.font {
-  font-family: '骞煎渾';
-  font-weight: 500;
-}
-</style>

--
Gitblit v1.9.3