From f3425493ed4e77ea683930e314e46cb51f5151a2 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子Li <15040126243@163.com>
Date: 星期二, 26 十一月 2024 15:29:22 +0800
Subject: [PATCH] update 优化 全代码规范化处理

---
 src/views/workflow/processDefinition/index.vue |   29 +++++++++--------------------
 1 files changed, 9 insertions(+), 20 deletions(-)

diff --git a/src/views/workflow/processDefinition/index.vue b/src/views/workflow/processDefinition/index.vue
index 6f13d32..6c686bf 100644
--- a/src/views/workflow/processDefinition/index.vue
+++ b/src/views/workflow/processDefinition/index.vue
@@ -47,7 +47,7 @@
               <el-col :span="1.5">
                 <el-button type="primary" icon="UploadFilled" @click="uploadDialog.visible = true">閮ㄧ讲娴佺▼鏂囦欢</el-button>
               </el-col>
-              <right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>
+              <right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
             </el-row>
           </template>
 
@@ -61,12 +61,12 @@
             </el-table-column>
             <el-table-column align="center" prop="resourceName" label="娴佺▼XML" width="100" :show-overflow-tooltip="true">
               <template #default="scope">
-                <el-link type="primary" @click="clickPreviewXML(scope.row.id)">{{ scope.row.resourceName }}</el-link>
+                <el-link type="primary" @click="clickPreview(scope.row.id, 'xml')">{{ scope.row.resourceName }}</el-link>
               </template>
             </el-table-column>
             <el-table-column align="center" prop="diagramResourceName" label="娴佺▼鍥剧墖" width="100" :show-overflow-tooltip="true">
               <template #default="scope">
-                <el-link type="primary" @click="clickPreviewImg(scope.row.id)">{{ scope.row.diagramResourceName }}</el-link>
+                <el-link type="primary" @click="clickPreview(scope.row.id, 'bpmn')">{{ scope.row.diagramResourceName }}</el-link>
               </template>
             </el-table-column>
             <el-table-column align="center" prop="suspensionState" label="鐘舵��" width="80">
@@ -293,7 +293,6 @@
 const uploadDialogLoading = ref(false);
 const processDefinitionList = ref<ProcessDefinitionVO[]>([]);
 const processDefinitionHistoryList = ref<ProcessDefinitionVO[]>([]);
-const url = ref<string[]>([]);
 const categoryOptions = ref<CategoryOption[]>([]);
 const categoryName = ref('');
 /** 閮ㄧ讲鏂囦欢鍒嗙被閫夋嫨 */
@@ -400,28 +399,18 @@
   loading.value = false;
 };
 
-//棰勮鍥剧墖
-const clickPreviewImg = async (id: string) => {
+type PreviewType = 'xml' | 'bpmn';
+//棰勮 鍏叡鏂规硶
+const clickPreview = async (id: string, type: PreviewType) => {
   loading.value = true;
   const resp = await definitionXml(id);
   if (previewRef.value) {
-    url.value = [];
-    url.value = resp.data.xml;
+    const xmlStr = resp.data.xmlStr;
     loading.value = false;
-    previewRef.value.openDialog(url.value, 'png');
+    previewRef.value.openDialog(xmlStr, type);
   }
 };
-//棰勮xml
-const clickPreviewXML = async (id: string) => {
-  loading.value = true;
-  const resp = await definitionXml(id);
-  if (previewRef.value) {
-    url.value = [];
-    url.value = resp.data.xml;
-    loading.value = false;
-    previewRef.value.openDialog(url.value, 'xml');
-  }
-};
+
 /** 鍒犻櫎鎸夐挳鎿嶄綔 */
 const handleDelete = async (row?: ProcessDefinitionVO) => {
   const id = row?.id || ids.value;

--
Gitblit v1.9.3