From da327aebecb89925e1ccd3cef41dce51a150cb7f Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期二, 01 八月 2023 16:45:02 +0800
Subject: [PATCH] 主题库分类添加和修改-父节点操作存储业务类型

---
 Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue |  140 +++++++++++++++++++++++++---------------------
 1 files changed, 75 insertions(+), 65 deletions(-)

diff --git a/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue b/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue
index ae5f62e..f0d7364 100644
--- a/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue
+++ b/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue
@@ -24,7 +24,7 @@
           </div>
         </div>
         <!--        鏍戣妭鐐规坊鍔犲璇濇-->
-        <el-dialog :title="this.TreeFlag ? '娣诲姞鍒嗙被' :'娣诲姞涓婚搴�'" :visible.sync="TreeAddFormVisible" append-to-body
+        <el-dialog :title="this.TreeFlag ? '娣诲姞鍒嗙被' :'娣诲姞涓婚搴�'" :visible.sync="TreeAddFormVisible"  v-loading="AddLoading" append-to-body
                    style="width: 1700px;margin: auto">
           <el-form :model="TreeAddform" :rules="rules">
             <el-form-item :label="this.TreeFlag ? '鍒嗙被缂栧彿锛�' :'涓婚搴撶紪鍙凤細'" label-width="150px" style="display: inline-block" prop="id">
@@ -33,7 +33,7 @@
             <el-form-item :label="this.TreeFlag ? '鍒嗙被鍚嶇О锛�' :'涓婚搴撳悕绉帮細'" label-width="110px" style="display: inline-block" prop="name">
               <el-input v-model="TreeAddform.name" autocomplete="off" style="width: 170px"></el-input>
             </el-form-item>
-            <el-form-item label="瀛樺偍鐨勪笟鍔$被鍨嬶細" label-width="150px" v-if="TreeFlagCode==false" prop="btmTypeName">
+            <el-form-item label="瀛樺偍鐨勪笟鍔$被鍨嬶細" label-width="150px" v-if="TreeFlagCode" prop="btmTypeName">
               <el-input v-model="TreeAddform.btmTypeName" autocomplete="off" style="width: 585px" @focus="btmFoucus"></el-input>
             </el-form-item>
             <el-form-item label="鎻忚堪锛�" label-width="150px">
@@ -350,6 +350,9 @@
   inject: ["crudTreeData"],
   data() {
     return {
+      AddLoading:false,
+      // 瀹氫箟涓�涓彉閲忔潵淇濆瓨鏍戣姹傜殑鏁伴噺
+      requestCount:0,
       //瀵煎叆鐘舵�佹
       ThemeImportVisible:false,
       selectRow:'',
@@ -656,6 +659,13 @@
       showEditBtn:false,
     }
   },
+  watch:{
+    TreeFlagCode:{
+      handler(newval,oldval){
+        console.log('TreeFlagCode',newval)
+      }
+    }
+  },
   //tab鏍忛粯璁ゆ槸琛ㄦ牸
   mounted() {
     this.type = this.tabOption.column[0];
@@ -728,9 +738,6 @@
     }
   },
   created() {
-
-  },
-  watch:{
 
   },
   methods: {
@@ -996,11 +1003,23 @@
       }
     },
     //鏍戣妭鐐规坊鍔犳寜閽�
-    TreeAdd() {
-      this.TreeAddFormVisible = true;
-      // 鍒ゆ柇褰撳墠鏄惁鏈夌偣鍑诲瓙椤�
-      if (this.nodeClickList !== "") {
-        this.TreeFlag = true
+    async TreeAdd() {
+      const loading = this.$loading({
+        lock: true,
+        text: 'Loading',
+        spinner: 'el-icon-loading',
+        background: 'rgba(0, 0, 0, 0.3)'
+      });
+      try {
+        if (this.nodeClickList !== "") {
+          this.TreeFlag = true;
+        }
+        await new Promise(resolve => setTimeout(resolve, 500));
+        this.TreeAddFormVisible = true;
+        loading.close();
+      } catch (error) {
+        this.$message.error(error);
+        loading.close();
       }
     },
     //鏍戣妭鐐规坊鍔犱簨浠�
@@ -1173,72 +1192,61 @@
     },
     //鏍戠偣鍑讳簨浠�
     async nodeClick(data) {
-      //瀹氫箟涓�涓ā鏉垮睘鎬d锛屾暟鎹槸妯℃澘绠$悊琛ㄦ牸閲岄潰鐨刼id
-      if(data.parentId == ""){
-        this.TreeFlagCode=true;
-
+      console.log(data);
+      if (data.parentId === "") {
+        this.TreeFlagCode = true;
+      }else {
+        this.TreeFlagCode =false;
       }
-      this.nodeClickList = data
-      this.selectRow=0;
+      this.nodeClickList = data;
+      this.selectRow = 0;
       try {
-        await TreeObjcet(data.oid).then(res => {
-          this.FlagObj = res.data.data
-        }).catch(res => {
-          this.$message.error(res)
-        })
-        //妯℃澘绠$悊琛ㄦ牸鏁版嵁
-        await gridCodeClassifyTemplate({'conditionMap[codeclassifyoid]': data.oid}).then(res => {
-          this.Formlist = res.data.data.filter(item => {
-            if (item.codeclassifyoid != "") {
-              this.codeClassifyOid = item.codeclassifyoid
-              return item.codeclassifyoid == this.nodeClickList.oid
-            }
-          })
-          if(this.Formlist.length >= 1){
-            this.crudLCStatus=this.Formlist[this.selectRow].lcStatus;
-            this.crudArray.push(this.Formlist[this.selectRow]);
-            this.crudOid=this.Formlist[this.selectRow].oid;
-            this.gridCode()
-          }else {
-              this.ProData = [];
+        this.requestCount += 1;
+        const [res1, res2, res3] = await Promise.all([
+          TreeObjcet(data.oid),
+          gridCodeClassifyTemplate({ 'conditionMap[codeclassifyoid]': data.oid }),
+          getObjectByOid(data.oid)
+        ]);
+        this.FlagObj = res1.data.data;
+        this.Formlist = res2.data.data.filter(item => {
+          if (item.codeclassifyoid != "") {
+            this.codeClassifyOid = item.codeclassifyoid;
+            return item.codeclassifyoid == this.nodeClickList.oid;
           }
-        }).catch(res => {
-          this.$message.error(res)
-        })
-        //  鍩烘湰淇℃伅琛ㄥ崟鏁版嵁
-          await getObjectByOid(this.nodeClickList.oid).then(res => {
-            this.TreeList = res.data.data;
-          }).catch(res => {
-            this.$message.error(res)
-          })
+        });
+        if (this.Formlist.length >= 1) {
+          this.crudLCStatus = this.Formlist[this.selectRow].lcStatus;
+          this.crudArray.push(this.Formlist[this.selectRow]);
+          this.crudOid = this.Formlist[this.selectRow].oid;
+          await this.gridCode();
+        } else {
+          this.ProData = [];
+        }
+        this.TreeList = res3.data.data;
       } catch (error) {
-        this.$message.error(error)
+        this.$message.error(error);
       }
     },
-    gridCode(){
-      gridCodeClassifyTemplateAttr({'conditionMap[classifyTemplateOid]': this.Formlist[this.selectRow].oid,limit:-1}).then(res => {
-        this.ProData = res.data.data;
-        //鍒嗙被娉ㄥ叆鏁版嵁鏍煎紡
-        this.ProData =  res.data.data.map((item) => {
-          //濡傛灉鍒嗙被娉ㄥ叆classifyInvokeAttr涓虹┖璇存槑鏄垵濮嬬姸鎬�
-          if(item.classifyInvokeAttr !== ''){
-            if (!item.hasOwnProperty('classifyInvokeText')) { // 妫�鏌lassifyInvokeText灞炴�ф槸鍚﹀瓨鍦�
-              item = {
-                ...item,
-                classifyInvokeText: {
-                  "娉ㄥ叆绫诲瀷": item.classifyInvokeAttr,
-                  "娉ㄥ叆绫诲瀷鍚嶇О": item.classifyInvokeAttrName,
-                  "灞傜骇璁剧疆": item.classifyInvokeLevel,
-                  "鏄惁鍙慨鏀�": item.classifyInvokeEditFlag
-                }
+
+    async gridCode() {
+      try {
+        const res = await gridCodeClassifyTemplateAttr({ 'conditionMap[classifyTemplateOid]': this.Formlist[this.selectRow].oid, limit: -1 });
+        this.ProData = res.data.data.map(item => {
+          if (item.classifyInvokeAttr !== '') {
+            if (!item.hasOwnProperty('classifyInvokeText')) {
+              item.classifyInvokeText = {
+                '娉ㄥ叆绫诲瀷': item.classifyInvokeAttr,
+                '娉ㄥ叆绫诲瀷鍚嶇О': item.classifyInvokeAttrName,
+                '灞傜骇璁剧疆': item.classifyInvokeLevel,
+                '鏄惁鍙慨鏀�': item.classifyInvokeEditFlag
               };
             }
           }
           return item;
         });
-      }).catch(res => {
-        this.$message.error(res)
-      })
+      } catch (error) {
+        this.$message.error(error);
+      }
     },
     treeClick(e) {
       console.log(e);
@@ -1423,6 +1431,8 @@
           this.Formlist = res.data.data.filter(item => {
             return item.codeclassifyoid == this.nodeClickList.oid
           })
+          this.crudLCStatus=this.Formlist[this.selectRow].lcStatus;
+          this.crudArray.push(this.Formlist[this.selectRow]);
           gridCodeClassifyTemplateAttr({'conditionMap[classifyTemplateOid]':  res.data.data[this.selectRow].oid,limit:-1}).then(res => {
             this.ProData = res.data.data;
             //鍒嗙被娉ㄥ叆鏁版嵁鏍煎紡

--
Gitblit v1.9.3