From 7666f724dfb0e4fb0804f91c7f1f89b9904d6909 Mon Sep 17 00:00:00 2001
From: 愿丶 <1319542051@qq.com>
Date: 星期二, 12 三月 2024 23:48:42 +0800
Subject: [PATCH] update 调整导入模型选择流程类别方式(改为表单内下拉框)

---
 src/views/workflow/processDefinition/index.vue |   51 +++++++++++++++++++++++++++++++++------------------
 1 files changed, 33 insertions(+), 18 deletions(-)

diff --git a/src/views/workflow/processDefinition/index.vue b/src/views/workflow/processDefinition/index.vue
index 3843573..6a04f8a 100644
--- a/src/views/workflow/processDefinition/index.vue
+++ b/src/views/workflow/processDefinition/index.vue
@@ -125,12 +125,25 @@
     <!-- 閮ㄧ讲鏂囦欢 -->
     <el-dialog v-if="uploadDialog.visible" v-model="uploadDialog.visible" :title="uploadDialog.title" width="30%">
       <div v-loading="uploadDialogLoading">
+        <div class="mb5">
+          <el-text class="mx-1" size="large"><span class="text-danger">*</span>璇烽�夋嫨閮ㄧ讲娴佺▼鍒嗙被锛�</el-text>
+          <el-tree-select
+            v-model="selectCategory"
+            :data="categoryOptions"
+            :props="{ value: 'categoryCode', label: 'categoryName', children: 'children' }"
+            filterable
+            value-key="categoryCode"
+            :render-after-expand="false"
+            check-strictly
+            style="width: 240px"
+          />
+        </div>
         <el-upload class="upload-demo" drag accept="application/zip,application/xml,.bpmn" :http-request="handerDeployProcessFile">
-          <el-icon class="UploadFilled"><upload-filled /></el-icon>
-          <div class="el-upload__text"><em>鐐瑰嚮涓婁紶锛岄�夋嫨BPMN娴佺▼鏂囦欢</em></div>
-          <div class="el-upload__text">浠呮敮鎸� .zip銆�.bpmn20.xml銆乥pmn 鏍煎紡鏂囦欢</div>
-          <div class="el-upload__text">PS:濡傝嫢閮ㄧ讲璇烽儴缃蹭粠鏈」鐩ā鍨嬬鐞嗗鍑虹殑鏁版嵁</div>
-      </el-upload>
+            <el-icon class="UploadFilled"><upload-filled /></el-icon>
+            <div class="el-upload__text"><em>鐐瑰嚮涓婁紶锛岄�夋嫨BPMN娴佺▼鏂囦欢</em></div>
+            <div class="el-upload__text">浠呮敮鎸� .zip銆�.bpmn20.xml銆乥pmn 鏍煎紡鏂囦欢</div>
+            <div class="el-upload__text">PS:濡傝嫢閮ㄧ讲璇烽儴缃蹭粠鏈」鐩ā鍨嬬鐞嗗鍑虹殑鏁版嵁</div>
+        </el-upload>
       </div>
     </el-dialog>
 
@@ -194,13 +207,13 @@
 <script lang="ts" setup name="processDefinition">
 import {
   listProcessDefinition,
-  processDefinitionImage,
-  processDefinitionXml,
+  definitionImage,
+  definitionXml,
   deleteProcessDefinition,
-  updateProcessDefState,
+  updateDefinitionState,
   convertToModel,
   deployProcessFile,
-  getProcessDefinitionListByKey
+  getListByKey
 } from '@/api/workflow/processDefinition';
 import ProcessPreview from './components/processPreview.vue';
 import { listCategory } from '@/api/workflow/category';
@@ -232,6 +245,8 @@
 const url = ref<string[]>([]);
 const categoryOptions = ref<CategoryOption[]>([]);
 const categoryName = ref('');
+/** 閮ㄧ讲鏂囦欢鍒嗙被閫夋嫨 */
+const selectCategory = ref();
 
 const uploadDialog = reactive<DialogOption>({
   visible: false,
@@ -320,7 +335,7 @@
 const getProcessDefinitionHitoryList = async (id: string, key: string) => {
   processDefinitionDialog.visible = true;
   loading.value = true;
-  const resp = await getProcessDefinitionListByKey(key);
+  const resp = await getListByKey(key);
   if (resp.data && resp.data.length > 0) {
     processDefinitionHistoryList.value = resp.data.filter((item: any) => item.id !== id);
   }
@@ -330,7 +345,7 @@
 //棰勮鍥剧墖
 const clickPreviewImg = async (id: string) => {
   loading.value = true;
-  const resp = await processDefinitionImage(id);
+  const resp = await definitionImage(id);
   if (previewRef.value) {
     url.value = [];
     url.value.push('data:image/png;base64,' + resp.data);
@@ -341,7 +356,7 @@
 //棰勮xml
 const clickPreviewXML = async (id: string) => {
   loading.value = true;
-  const resp = await processDefinitionXml(id);
+  const resp = await definitionXml(id);
   if (previewRef.value) {
     url.value = [];
     url.value = resp.data.xml;
@@ -367,7 +382,7 @@
   }
   await proxy?.$modal.confirm(msg);
   loading.value = true;
-  await updateProcessDefState(row.id).finally(() => (loading.value = false));
+  await updateDefinitionState(row.id).finally(() => (loading.value = false));
   await getList();
   proxy?.$modal.msgSuccess('鎿嶄綔鎴愬姛');
 };
@@ -382,21 +397,21 @@
 //閮ㄧ讲鏂囦欢
 const handerDeployProcessFile = (data: UploadRequestOptions): XMLHttpRequest => {
   let formData = new FormData();
-  if (queryParams.value.categoryCode === 'ALL') {
+  if (selectCategory.value === 'ALL') {
     proxy?.$modal.msgError('椤剁骇鑺傜偣涓嶅彲浣滀负鍒嗙被锛�');
     return;
   }
-  if (!queryParams.value.categoryCode) {
+  if (!selectCategory.value) {
     proxy?.$modal.msgError('璇烽�夋嫨宸︿晶瑕佷笂浼犵殑鍒嗙被锛�');
     return;
   }
-  uploadDialogLoading.value = true
+  uploadDialogLoading.value = true;
   formData.append('file', data.file);
-  formData.append('categoryCode', queryParams.value.categoryCode);
+  formData.append('categoryCode', selectCategory.value);
   deployProcessFile(formData).then(() => {
     uploadDialog.visible = false;
     proxy?.$modal.msgSuccess('閮ㄧ讲鎴愬姛');
-    uploadDialogLoading.value = false
+    uploadDialogLoading.value = false;
     handleQuery();
   });
 };

--
Gitblit v1.9.3