dedsudiyu před 4 dny
rodič
revize
2ff1ca7790
1 změnil soubory, kde provedl 9 přidání a 12 odebrání
  1. 9 12
      src/components/SecurityMonitor.vue

+ 9 - 12
src/components/SecurityMonitor.vue

@@ -259,6 +259,8 @@ export default {
       checkButton:2,
       effective:false,
       modList:[],
+      //定时器
+      pollTimer: null
     }
   },
   created() {
@@ -266,22 +268,14 @@ export default {
   },
   mounted() {
     this.laboratoryLabScreenScreenConfigGet();
-    if(this.checkButton == 1){
-      this.demo()
-    }else if(this.checkButton == 2){
-      this.getMonitorTree();
-      this.getDeptDropList();
-    }
+    this.pollTimer = setInterval(this.laboratoryLabScreenScreenConfigGet, 5 * 60 * 1000)
+  },
+  beforeDestroy() {
+    if (this.pollTimer) clearInterval(this.pollTimer)
   },
   methods: {
     buttonClick(val){
       this.$set(this,'checkButton',val);
-      if(val == 1){
-        this.demo()
-      }else if(val == 2){
-        this.getMonitorTree();
-        this.getDeptDropList();
-      }
     },
     handleEnter(){
       this.getMonitorTree();
@@ -541,6 +535,9 @@ export default {
           this.$set(this,'modList',res.data.items);
           if(res.data.effective){
             this.$set(this,'checkButton',1);
+          }else{
+            this.getMonitorTree();
+            this.getDeptDropList();
           }
         }
       } catch (e) {