Pārlūkot izejas kodu

联锁刷新问题

yuhan 1 mēnesi atpakaļ
vecāks
revīzija
a0b6ca675e

+ 10 - 9
src/views/module_interLock/InterlockSummary/index.vue

@@ -14,6 +14,7 @@
 
 <script>
   import InterlockSummaryList from './InterlockSummaryList.vue';
+  import store from '@/store'
 
   export default({
     components: {
@@ -23,15 +24,15 @@
       return {
       }
     },
-    // beforeRouteEnter(to, from, next) {
-    //   // 除了进入新增编辑页面外,销毁vuex数据 -- 忘记为啥一开始这么做了
-    //   if(from.path !== '/interLock/summary/set' && from.path !== '/interLock/detail'){
-    //     store.commit('SET_CLICKSYSTEMNODE', {});
-    //     store.commit('SET_TREESELECTKEYS', []);
-    //     store.commit('SET_TREEEXPANDEKEYS', []);
-    //   }
-    //   next()
-    // },
+    beforeRouteEnter(to, from, next) {
+      console.log(to, from, next)
+      if(from.path !== '/interLock/summary/set' && from.path !== '/interLock/detail' && from.path !== '/'){
+        store.commit('SET_CLICKSYSTEMNODE', {});
+        store.commit('SET_TREESELECTKEYS', []);
+        store.commit('SET_TREEEXPANDEKEYS', []);
+      }
+      next()
+    },
     created() {
     },
     mounted() {

+ 11 - 0
src/views/module_interLock/interlockHistoryData/index.vue

@@ -30,6 +30,8 @@
 <script>
   import InterlockHistoryList from './InterlockHistoryList.vue'
   import InterlockTimedReport from '../interlockTimedReport/InterlockTimedReportList.vue';
+  import store from '@/store'
+  
   export default {
     name: '',
     components: {
@@ -40,6 +42,15 @@
       return {
       }
     },
+    beforeRouteEnter(to, from, next) {
+      console.log(to, from, next)
+      if(from.path !== '/interLock/history/detail' && from.path !== '/'){
+        store.commit('SET_CLICKSYSTEMNODE', {});
+        store.commit('SET_TREESELECTKEYS', []);
+        store.commit('SET_TREEEXPANDEKEYS', []);
+      }
+      next()
+    },
     created () {
     },
     mounted () {