From c1c282010d550ff7cad00c6ce021cb63cca65dd7 Mon Sep 17 00:00:00 2001
From: pjq <759645275@qq.com>
Date: Mon, 27 Dec 2021 15:12:07 +0800
Subject: [PATCH] FunctionBtn的跳转

---
 src/components/FunctionBtn.vue |  1 +
 src/mixin/commonFuncs.js       | 25 +++++++++++++++++--------
 src/store/Status.js            |  6 +++++-
 src/views/TaskList/index.vue   | 37 ++++++++++++++++++++++---------------
 4 files changed, 45 insertions(+), 24 deletions(-)

diff --git a/src/components/FunctionBtn.vue b/src/components/FunctionBtn.vue
index b8de804..1fc9ecb 100644
--- a/src/components/FunctionBtn.vue
+++ b/src/components/FunctionBtn.vue
@@ -98,6 +98,7 @@ export default {
       })
         .then(res => {
           // this.$router.back();
+          this.$store.dispatch("TagsView/delView", this.$route)
           this.handleExit && this.handleExit()
           if (this.$route.query && this.$route.query.routeParams) {
             setTimeout(() => {
diff --git a/src/mixin/commonFuncs.js b/src/mixin/commonFuncs.js
index 861cf81..c6f0008 100644
--- a/src/mixin/commonFuncs.js
+++ b/src/mixin/commonFuncs.js
@@ -11,7 +11,10 @@ export default {
           message: "保存成功",
           type: "success",
         });
-        this.$router.history.push("/business/trnrel");
+        this.$store.dispatch("TagsView/delView", this.$route)
+        this.$router.history.push("/taskList", () => {
+          this.$store.commit("setTaskListTabVal", 'trnrel')
+        });
       } else{
         this.$notify({
           title: "失败",
@@ -32,7 +35,10 @@ export default {
           message: "暂存成功",
           type: "success",
         });
-        this.$router.history.push("/business/sptsel");
+        this.$store.dispatch("TagsView/delView", this.$route)
+        this.$router.history.push("/taskList", () => {
+          this.$store.commit("setTaskListTabVal", 'sptbrk')
+        });
       } else {
         this.$notify({
           title: "失败",
@@ -44,7 +50,15 @@ export default {
 		// 表单校验
     async handleCheck() {
       let result = await this.checkAll();
-      if (result.respCode == SUCCESS && Object.keys(result.fieldErrors).length == 0) {
+      if (result.respCode == SUCCESS) {
+        if (Object.keys(result.fieldErrors).length == 0) {
+          this.$notify({
+            title: "成功",
+            message: "校核成功",
+            type: "success",
+          });
+          return;
+        }
         // 清除之前的校验状态
         this.$refs.modelForm.clearValidate();
         const fields = this.$refs.modelForm.fields;
@@ -56,11 +70,6 @@ export default {
           // tab切换之后,需出发tab-click的事件
           this.tabClick(tab);
         }
-        this.$notify({
-          title: "成功",
-          message: "校核成功",
-          type: "success",
-        });
       } else {
         this.$notify.error({ title: "错误", message: result.respMsg });
       }
diff --git a/src/store/Status.js b/src/store/Status.js
index e483b22..8dc1f4d 100644
--- a/src/store/Status.js
+++ b/src/store/Status.js
@@ -21,7 +21,8 @@ const Status = {
 			check: false,
 			// 暂存
 			stash: false
-		}
+		},
+		taskListTabVal: ''
 	},
 	mutations: {
 		setMode(state, value) {
@@ -78,6 +79,9 @@ const Status = {
 		},
 		setLoadingStash(state, value) {
 			state.loading.stash = value;
+		},
+		setTaskListTabVal(state, value) {
+			state.taskListTabVal = value;
 		}
 	}
 }
diff --git a/src/views/TaskList/index.vue b/src/views/TaskList/index.vue
index 713d1ac..5958f39 100644
--- a/src/views/TaskList/index.vue
+++ b/src/views/TaskList/index.vue
@@ -37,26 +37,33 @@ import Bopsel from "~/views/Business/Bopsel";
 export default {
   data(){
     return{
-      tabVal:"sptsel",
+    }
+  },
+  computed: {
+    tabVal: {
+      get() {
+        return this.$store.state.Status.taskListTabVal || "sptsel"
+      },
+      set(val) {
+        this.$store.commit("setTaskListTabVal", val)
+      }
     }
   },
   name: "TaskList",
-
-  methods: {
-    tabClick() {},
+  created() {
   },
-    components:{
-        "t-sptsel" : Sptsel,
-        "t-sptbrk" : Sptbrk,
-        "t-trnrel" : Trnrel,
-        "t-trnfnd" : Trnfnd,
-        "t-diasel" : Diasel,
-        "t-bopsel" : Bopsel,
+  methods: {
+    tabClick(tab) {
     },
-
-   
-  
-    
+  },
+  components:{
+      "t-sptsel" : Sptsel,
+      "t-sptbrk" : Sptbrk,
+      "t-trnrel" : Trnrel,
+      "t-trnfnd" : Trnfnd,
+      "t-diasel" : Diasel,
+      "t-bopsel" : Bopsel,
+  },
 };
 </script>
 
--
libgit2 0.26.0