From d87726d60385c1f3c635d93d43340fa83cb55f27 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期六, 05 八月 2023 21:20:15 +0800
Subject: [PATCH] 模板流程表单保存失败关闭禁用功能重新提交

---
 Source/UBCS-WEB/src/components/template/FlowPath.vue        |   29 ++++++++------
 Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue |   56 +++++++++++++++------------
 2 files changed, 48 insertions(+), 37 deletions(-)

diff --git a/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue b/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue
index 581c486..2868e1a 100644
--- a/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue
+++ b/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue
@@ -26,7 +26,7 @@
         <!--        鏍戣妭鐐规坊鍔犲璇濇-->
         <el-dialog :title="this.TreeFlag ? '娣诲姞鍒嗙被' :'娣诲姞涓婚搴�'" :before-close="TreeEscHandler" :visible.sync="TreeAddFormVisible"  v-loading="AddLoading" append-to-body
                    style="width: 1700px;margin: auto">
-          <el-form :model="TreeAddform" :rules="rules">
+          <el-form ref="myForm" :model="TreeAddform" :rules="rules">
             <el-form-item :label="this.TreeFlag ? '鍒嗙被缂栧彿锛�' :'涓婚搴撶紪鍙凤細'" label-width="150px" style="display: inline-block" prop="id">
               <el-input v-model="TreeAddform.id" autocomplete="off" style="width: 170px"></el-input>
             </el-form-item>
@@ -1041,34 +1041,40 @@
     //鏍戣妭鐐瑰彇娑堜簨浠�
     TreeEscHandler(){
       this.TreeAddform={};
-      this.TreeAddFormVisible=false
+      this.TreeAddFormVisible=false;
+      // 鍏抽棴寮圭獥娓呯┖鏍¢獙
+      this.$refs.myForm.clearValidate();
     },
     //鏍戣妭鐐规坊鍔犱簨浠�
     TreeAddHandler() {
-      const data = this.TreeAddform;
-      // data.btmtypename= this.TreeList.btmtypename
-      this.$set(data, "parentCodeClassifyOid", this.nodeClickList.oid);
-      TreeSave(data)
-        .then(() => {
-          this.$message({
-            type: "success",
-            message: "娣诲姞鎴愬姛!",
+      if ((!this.TreeAddform.id || !this.TreeAddform.name) || (this.TreeFlagCode && !this.TreeAddform.btmTypeName)) {
+        this.$message.warning('璇疯緭鍏ュ唴瀹癸紒');
+      }else {
+        const data = this.TreeAddform;
+        // data.btmtypename= this.TreeList.btmtypename
+        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.getAttr();
+            this.TreeAddFormVisible = false;
+            //娣诲姞瀹屾垚鍚庡彸渚ф竻绌�
+            this.ProData=[];
+            this.Formlist=[];
+          })
+          .catch((res) => {
+            this.$message({
+              type: "warning",
+              message: res,
+            });
           });
-          Object.keys(this.TreeAddform).forEach(key => {
-            this.TreeAddform[key] = "";
-          });
-          this.getAttr();
-          this.TreeAddFormVisible = false;
-          //娣诲姞瀹屾垚鍚庡彸渚ф竻绌�
-          this.ProData=[];
-          this.Formlist=[];
-        })
-        .catch((res) => {
-          this.$message({
-            type: "warning",
-            message: res,
-          });
-        });
+      }
     },
     //鏍戣妭鐐瑰垹闄ゆ寜閽�
     TreeDel() {
diff --git a/Source/UBCS-WEB/src/components/template/FlowPath.vue b/Source/UBCS-WEB/src/components/template/FlowPath.vue
index f3d30c7..72d9567 100644
--- a/Source/UBCS-WEB/src/components/template/FlowPath.vue
+++ b/Source/UBCS-WEB/src/components/template/FlowPath.vue
@@ -171,17 +171,19 @@
         // 鏂板
         async handleSave(row, done, loading) {
             console.log(row)
-            const response = await flowpathSave({ ...row, ...{ templateId: this.code } })
-            if (response.status === 200) {
-                loading()
+            await flowpathSave({ ...row, ...{ templateId: this.code } }).then(response=>{
+              if (response.status === 200) {
                 console.log(response)
                 this.$message({
-                    type: 'success',
-                    message: '鏂板鏁版嵁鎴愬姛锛�'
+                  type: 'success',
+                  message: '鏂板鏁版嵁鎴愬姛锛�'
                 })
                 done()
                 this.getDataList()
-            }
+              }
+            }).catch(res=>{
+              loading()
+            })
 
         },
         // 缂栬緫
@@ -189,16 +191,19 @@
             console.log(row)
             const { modelName, modelKey, buttonTypeKey, id ,description} = row
             let param = { modelName, modelKey, buttonTypeKey, id,description }
-            const response = await flowpathSave({ ...param, ...{ templateId: this.code } })
-            if (response.status === 200) {
-                loading()
+            await flowpathSave({ ...param, ...{ templateId: this.code } }).then(response=>{
+              if (response.status === 200) {
                 this.$message({
-                    type: 'success',
-                    message: '淇敼鏁版嵁鎴愬姛锛�'
+                  type: 'success',
+                  message: '淇敼鏁版嵁鎴愬姛锛�'
                 })
                 done()
                 this.getDataList()
-            }
+              }
+            }).catch(()=>{
+              //loading鎺у埗绂佺敤 榛樿鏄紑鍚�
+              loading()
+            })
 
         },
         // 鍒犻櫎鍗曟潯

--
Gitblit v1.9.3