deepsea 1 год назад
Родитель
Сommit
a001dbb5c5
2 измененных файлов с 47 добавлено и 4 удалено
  1. 2 1
      src/store/modules/plan/index.js
  2. 45 3
      src/store/modules/plan/mutations.js

+ 2 - 1
src/store/modules/plan/index.js

@@ -6,7 +6,8 @@ export default {
   state() {
     return {
       planList: [],
-      autoPlanList: []
+      autoPlanList: [],
+      tempPlanList: []
     };
   },
   mutations,

+ 45 - 3
src/store/modules/plan/mutations.js

@@ -1,5 +1,11 @@
 export default {
   setPlanList(state, planList) {
+    while(state.planList.length) {
+      state.planList.pop()
+    }
+    while(state.tempPlanList.length) {
+      state.tempPlanList.pop()
+    }
     planList.forEach((planId) => {
       if(!state.planList.some(p => p.id == planId)) {
         let plan = {};
@@ -25,9 +31,35 @@ export default {
         state.planList.push(plan)
       }
     });
+    planList.forEach((planId) => {
+      if(!state.tempPlanList.some(p => p.id == planId)) {
+        let plan = {};
+        plan.id = planId;
+        plan.checked = false;
+        plan.carline = [];
+        plan.case_list = [109, 110, 111, 112, 113]
+        plan.cluster = 1
+        plan.create_time = ""
+        plan.creator = ""
+        plan.delete_flag = 0
+        plan.description = ""
+        plan.function = [1, 2]
+        plan.language = [1, 2]
+        plan.level = [1, 2]
+        plan.market = [1, 2]
+        plan.name = ""
+        plan.platform = [1, 2]
+        plan.project = [1, 2]
+        plan.sub_function = [1, 2]
+        plan.update_time = ""
+        plan.uuid = ""
+        state.tempPlanList.push(plan)
+      }
+    });
   },
   setMaualPlanList(state, planList) {
     let maualPlanList = state.planList;
+    console.log('=======1111111')
     maualPlanList.forEach(p => {
       let plan = planList.find(s => s.id == p.id);
       if (plan) {
@@ -39,6 +71,9 @@ export default {
     })
   },
   setAutoPlanList(state, planList) {
+    while(state.autoPlanList.length) {
+      state.autoPlanList.pop()
+    }
     planList.forEach((planId) => {
       if(!state.autoPlanList.some(p => p.id == planId)) {
         let plan = {}
@@ -90,11 +125,18 @@ export default {
     });
   },
   clearPlanList(state) {
-    while(state.autoPlanList.length) {
-      state.autoPlanList.pop()
-    }
+    console.log('=======2222222')
     while(state.planList.length) {
       state.planList.pop()
     }
+    let len = state.tempPlanList.length;
+    for(let i = 0; i < len; i++) {
+      let plan = state.tempPlanList[i];
+      let t = {}
+      for(let key in plan) {
+        t[key] = plan[key]
+      }
+      state.planList.push(t)
+    }
   }
 };