deepsea 1 year ago
parent
commit
2fb9e23822

+ 3 - 0
src/store/modules/case/actions.js

@@ -109,5 +109,8 @@ export default {
   },
   setCurrentPlanId({commit}, planId) {
     commit('setCurrentPlanId', planId)
+  },
+  clearAutoCaseList({commit}) {
+    commit('clearAutoCaseList')
   }
 };

+ 15 - 2
src/store/modules/case/mutations.js

@@ -9,14 +9,21 @@ export default {
   setAutoCaseList(state, data) {
     let autoCaseList = data.autoCaseList;
     let planId = data.planId;
-    while(state.autoCaseListMap[planId].length) {
+    while(state.autoCaseListMap[planId] && state.autoCaseListMap[planId].length) {
       state.autoCaseListMap[planId].pop()
     }
+    debugger
     autoCaseList.forEach((caseA) => {
+      if (!state.autoCaseListMap[planId]) {
+        state.autoCaseListMap[planId] = []
+      }
       if(!state.autoCaseListMap[planId].some(p => p.id == caseA.id)) {
         state.autoCaseListMap[planId].push(caseA)
       }
     });
+    if (state.autoCaseListMap && state.autoCaseListMap[planId]) {
+      state.autoCaseList = state.autoCaseListMap[planId]
+    }
   },
   setAutoPlanStatus(state, rows) {
     let map = JSON.parse(localStorage.getItem("autoCurrentTaskData"))
@@ -61,7 +68,10 @@ export default {
     })
   },
   setCurrentTask(state, id) {
-    state.currentTaskIndex = id
+    state.currentTaskIndex = id;
+    if (state.autoCaseListMap && state.autoCaseListMap[id]) {
+      state.autoCaseList = state.autoCaseListMap[id]
+    }
   },
   cancelPlan(state, res) {
     state.autoTaskStatus = "ready";
@@ -128,5 +138,8 @@ export default {
   },
   setCurrentPlanId(state, planId) {
     state.currentPlanId = planId;
+  },
+  clearAutoCaseList(state) {
+    state.autoCaseList = []
   }
 };

+ 2 - 1
src/views/ordinaryPage/index.vue

@@ -1111,6 +1111,7 @@ export default {
     },
     selectRowPlan(id, auto, name) {
       console.log(id, "selectrowdata");
+      debugger
       if (!auto || auto == "undefined" || auto == "false") {
         this.currentPlanId = id;
         this.$store.dispatch("caseList/fetchCaseList", {
@@ -1194,7 +1195,7 @@ export default {
     clickBackToAutoPlanList() {
       this.isShowPlanList = true;
       this.isShowAutoCaseList = false;
-      this.autoCaseList = [];
+      this.$store.dispatch('caseList/clearAutoCaseList');
     },
     bmMapItemUnSelect() {
       let items = document.getElementsByClassName("item-box");