From cbd05fbc897b14977d40346d57831cd7520a2780 Mon Sep 17 00:00:00 2001
From: LiuHao <liuhaoai545@gmail.com>
Date: 星期五, 19 五月 2023 01:34:06 +0800
Subject: [PATCH] fix issues #I7657W

---
 ruoyi-modules/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm |   41 +++++++++++------------------------------
 1 files changed, 11 insertions(+), 30 deletions(-)

diff --git a/ruoyi-modules/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm b/ruoyi-modules/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm
index 32f7c57..f35415b 100644
--- a/ruoyi-modules/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm
+++ b/ruoyi-modules/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm
@@ -15,12 +15,7 @@
 #end
 #if($column.htmlType == "input" || $column.htmlType == "textarea")
           <el-form-item label="${comment}" prop="${column.javaField}">
-            <el-input
-                v-model="queryParams.${column.javaField}"
-                placeholder="璇疯緭鍏�${comment}"
-                clearable
-                @keyup.enter="handleQuery"
-            />
+            <el-input v-model="queryParams.${column.javaField}" placeholder="璇疯緭鍏�${comment}" clearable @keyup.enter="handleQuery" />
           </el-form-item>
 #elseif(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType)
           <el-form-item label="${comment}" prop="${column.javaField}">
@@ -71,26 +66,14 @@
       </div>
     </transition>
 
-
     <el-card shadow="never">
       <template #header>
         <el-row :gutter="10" class="mb8">
           <el-col :span="1.5">
-            <el-button
-                type="primary"
-                plain
-                icon="Plus"
-                @click="handleAdd()"
-                v-hasPermi="['${moduleName}:${businessName}:add']
-            >鏂板</el-button>
+            <el-button type="primary" plain icon="Plus" @click="handleAdd()" v-hasPermi="['${moduleName}:${businessName}:add']">鏂板</el-button>
           </el-col>
           <el-col :span="1.5">
-            <el-button
-                type="info"
-                plain
-                icon="Sort"
-                @click="handleToggleExpandAll"
-            >灞曞紑/鎶樺彔</el-button>
+            <el-button type="info" plain icon="Sort" @click="handleToggleExpandAll">灞曞紑/鎶樺彔</el-button>
           </el-col>
           <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
         </el-row>
@@ -274,7 +257,7 @@
       </el-form>
       <template #footer>
         <div class="dialog-footer">
-          <el-button type="primary" @click="submitForm">纭� 瀹�</el-button>
+          <el-button :loading="buttonLoading" type="primary" @click="submitForm">纭� 瀹�</el-button>
           <el-button @click="cancel">鍙� 娑�</el-button>
         </div>
       </template>
@@ -307,7 +290,6 @@
 const buttonLoading = ref(false);
 const showSearch = ref(true);
 const isExpandAll = ref(true);
-const refreshTable = ref(true);
 const loading = ref(false);
 
 const queryFormRef = ref(ElForm);
@@ -472,21 +454,20 @@
     if (row != null) {
       form.value.${treeParentCode} = row.${treeCode};
     }
-    get${BusinessName}(row.${pkColumn.javaField}).then(response => {
-      loading.value = false;
-      form.value = response.data;
+    const res = await get${BusinessName}(row.${treeCode});
+    loading.value = false;
+    Object.assign(form.value, res.data);
 #foreach ($column in $columns)
 #if($column.htmlType == "checkbox")
-      form.value.$column.javaField = form.value.${column.javaField}.split(",");
+    form.value.$column.javaField = form.value.${column.javaField}.split(",");
 #end
 #end
-    });
   });
 }
 
 /** 鎻愪氦鎸夐挳 */
 const submitForm = () => {
-  ${businessName}FormRef.value.validate((valid: boolean) => {
+  ${businessName}FormRef.value.validate(async (valid: boolean) => {
     if (valid) {
       buttonLoading.value = true;
 #foreach ($column in $columns)
@@ -495,9 +476,9 @@
 #end
 #end
       if (form.value.${pkColumn.javaField}) {
-        update${BusinessName}(form.value).finally(() => buttonLoading.value = false);
+        await update${BusinessName}(form.value).finally(() => buttonLoading.value = false);
       } else {
-        add${BusinessName}(form.value).finally(() => buttonLoading.value = false);
+        await add${BusinessName}(form.value).finally(() => buttonLoading.value = false);
       }
       proxy?.#[[$modal]]#.msgSuccess("鎿嶄綔鎴愬姛");
       dialog.visible = false;

--
Gitblit v1.9.3