From 5c475d3ac8ee98713e0f0962dd9464daccfb9eb1 Mon Sep 17 00:00:00 2001
From: dengzedong <dengzedong@email>
Date: 星期四, 28 十一月 2024 18:16:07 +0800
Subject: [PATCH] 模型参数改为output

---
 src/views/model/mpk/file/MpkGenerator.vue |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/views/model/mpk/file/MpkGenerator.vue b/src/views/model/mpk/file/MpkGenerator.vue
index 2756e05..47a72ae 100644
--- a/src/views/model/mpk/file/MpkGenerator.vue
+++ b/src/views/model/mpk/file/MpkGenerator.vue
@@ -18,7 +18,7 @@
       </el-form-item>
     </el-form>
     <div style="width: 100%;display: flex;flex-direction: row;justify-content: end;margin-top: 16px">
-      <el-button @click="generatorCode()" type="primary">生成</el-button>
+      <el-button :loading="loading" @click="generatorCode()" type="primary">生成</el-button>
     </div>
   </Dialog>
 </template>
@@ -54,11 +54,19 @@
   }
   defineExpose({ open }) // 提供 open 方法,用于打开弹窗
 
+  // 代码生成loading
+  const loading = ref(false)
   /** 提交表单 */
   const generatorCode = async () => {
-    const data = await MpkApi.generatorCode(formData.value)
-    download.zip(data, formData.value.zipFileName)
-    dialogVisible.value = false
+    try {
+      loading.value = true
+      const data = await MpkApi.generatorCode(formData.value)
+      download.zip(data, formData.value.zipFileName)
+    }finally {
+      loading.value = false
+      dialogVisible.value = false
+    }
+
   }
   /** 重置表单 */
   const resetForm = () => {

--
Gitblit v1.9.3