From 6cd32111579f0de8e3908bc985ee493197dc80cb Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期五, 17 十一月 2023 16:29:48 +0800
Subject: [PATCH] 整合代码

---
 Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue |   53 +++++++++++++++++++++++------------------------------
 1 files changed, 23 insertions(+), 30 deletions(-)

diff --git a/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue b/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue
index 21a9cb1..5854b1a 100644
--- a/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue
+++ b/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue
@@ -1114,6 +1114,7 @@
     },
     //鍒嗙被鏍戞暟鎹鐞�
     getAttr() {
+      this.loading = true;
       return new Promise((resolve, reject) => {
         getAtrrList()
           .then(res => {
@@ -1132,6 +1133,7 @@
               }
               return item;
             });
+            this.loading = false;
             resolve(); // 瀹屾垚璇锋眰锛岃皟鐢╮esolve鏂规硶
           })
           .catch(error => {
@@ -1185,35 +1187,31 @@
       this.$refs.myForm.clearValidate();
     },
     //鏍戣妭鐐规坊鍔犱簨浠�
-    TreeAddHandler() {
+    async TreeAddHandler() {
       if ((!this.TreeAddform.id || !this.TreeAddform.name) || (this.TreeFlagCode && !this.TreeAddform.btmTypeName)) {
         this.$message.warning('璇疯緭鍏ュ唴瀹癸紒');
-      } else {
+        return;
+      }
+      try {
         const data = this.TreeAddform;
         this.$set(data, "parentCodeClassifyOid", this.nodeClickList.oid);
-        TreeSave(data)
-          .then(() => {
-            this.$message({
-              type: "success",
-              message: "娣诲姞鎴愬姛!",
-            });
-            Object.keys(this.TreeAddform).forEach(key => {
-              this.TreeAddform[key] = "";
-              this.TreeAddform.codeKeyAttrValue = true;
-              this.TreeAddform.isParticipateCheck = 1;
-            });
-            this.getAttr();
-            this.TreeAddFormVisible = false;
-            //娣诲姞瀹屾垚鍚庡彸渚ф竻绌�
-            this.ProData = [];
-            this.Formlist = [];
-          })
-          .catch((res) => {
-            this.$message({
-              type: "warning",
-              message: res,
-            });
-          });
+        await TreeSave(data)
+        this.$message.success("娣诲姞鎴愬姛!");
+        Object.keys(this.TreeAddform).forEach(key => {
+          this.TreeAddform[key] = "";
+        });
+        this.TreeAddform.codeKeyAttrValue = true;
+        this.TreeAddform.isParticipateCheck = 1;
+        this.getAttr();
+        this.TreeAddFormVisible = false;
+        //娣诲姞瀹屾垚鍚庡彸渚ф竻绌�
+        this.ProData = [];
+        this.Formlist = [];
+      } catch (res) {
+        this.$message({
+          type: "warning",
+          message: res,
+        });
       }
     },
     //鏍戣妭鐐瑰垹闄ゆ寜閽�
@@ -1285,16 +1283,11 @@
     },
     //鏍戝埛鏂�
     async flushed() {
-      this.loading = true;
-      try {
         await this.getAttr()
         this.$refs.tree.setCurrentKey(null);
         this.nodeClickList = {}
         this.TreeList = []
         this.TreeFlagCode = true;
-      } finally {
-        this.loading = false;
-      }
     },
     //鍚敤鍜屽仠鐢ㄩ兘鍏堝垽鏂姸鎬�
     //鍚敤

--
Gitblit v1.9.3