Преглед изворни кода

工作台定时刷新数据

ysc пре 1 година
родитељ
комит
4376a4011d
1 измењених фајлова са 11 додато и 3 уклоњено
  1. 11 3
      src/views/dashboard/index.vue

+ 11 - 3
src/views/dashboard/index.vue

@@ -173,7 +173,11 @@ export default {
       }
       }
     }
     }
   },
   },
+  beforeDestroy() {
+    clearInterval(this.timer)
+  },
   mounted() {
   mounted() {
+    this.timer = setInterval(this.queryData, 5000)
     this.getTodoTask();
     this.getTodoTask();
     this.getAssetReceive();
     this.getAssetReceive();
     this.getTaskList();
     this.getTaskList();
@@ -181,6 +185,13 @@ export default {
     this.getEnforceRemindCounts()
     this.getEnforceRemindCounts()
   },
   },
   methods: {
   methods: {
+    queryData() {
+      this.getTodoTask();
+      this.getAssetReceive();
+      this.getTaskList();
+      this.getTodoMeetinStatisticss()
+      this.getEnforceRemindCounts()
+    },
     getTodoTask() {
     getTodoTask() {
       toDoTaskList().then(res => {
       toDoTaskList().then(res => {
         this.newTasks = res.data.newTasks
         this.newTasks = res.data.newTasks
@@ -231,9 +242,6 @@ export default {
       })
       })
     },
     },
     toTaskView() {
     toTaskView() {
-      if (this.newTaskNum === 0) {
-        return
-      }
       this.$router.push(`/task/view`)
       this.$router.push(`/task/view`)
     },
     },
     toMyReceive() {
     toMyReceive() {