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 |   91 +++++++++++++++++++++------------------------
 1 files changed, 42 insertions(+), 49 deletions(-)

diff --git a/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue b/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue
index 32f60ef..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,
+        });
       }
     },
     //鏍戣妭鐐瑰垹闄ゆ寜閽�
@@ -1284,20 +1282,12 @@
       }
     },
     //鏍戝埛鏂�
-    flushed() {
-      this.loading = true;
-      this.getAttr()
-        .then(() => {
-          this.loading = false;
-          this.$refs.tree.setCurrentKey(null);
-          this.nodeClickList = {}
-          this.TreeList = []
-          this.TreeFlagCode = true;
-        })
-        .catch(error => {
-          this.loading = false;
-          console.error(error);
-        });
+    async flushed() {
+        await this.getAttr()
+        this.$refs.tree.setCurrentKey(null);
+        this.nodeClickList = {}
+        this.TreeList = []
+        this.TreeFlagCode = true;
     },
     //鍚敤鍜屽仠鐢ㄩ兘鍏堝垽鏂姸鎬�
     //鍚敤
@@ -1321,12 +1311,14 @@
           type: 'warning'
         });
         if (confirmResult) {
-          await TreeEnable(this.nodeClickList);
-          this.$message({
-            type: 'success',
-            message: '鍚敤鎴愬姛!'
-          });
+          await TreeEnable(this.nodeClickList).then(res => {
+            this.$message({
+              type: 'success',
+              message: '鍚敤鎴愬姛!'
+            });
+          })
           await this.getAttr();
+
         } else {
           this.$message({
             type: 'info',
@@ -1362,11 +1354,12 @@
           type: 'warning'
         });
         if (confirmResult) {
-          await TreeDeactivate(this.nodeClickList);
-          this.$message({
-            type: 'success',
-            message: '鍋滅敤鎴愬姛!'
-          });
+          await TreeDeactivate(this.nodeClickList).then(res => {
+            this.$message({
+              type: 'success',
+              message: '鍋滅敤鎴愬姛!'
+            });
+          })
           this.nodeClickList['flag'] = true;
           await this.getAttr();
         } else {

--
Gitblit v1.9.3