Ver código fonte

fix: 数据分析增加自动更新

zh 2 anos atrás
pai
commit
afd76322c5
1 arquivos alterados com 34 adições e 2 exclusões
  1. 34 2
      src/views/dataAnalysis/dataAnalysisList.vue

+ 34 - 2
src/views/dataAnalysis/dataAnalysisList.vue

@@ -26,7 +26,33 @@ export default {
     return {
       visible: false,
       // 事件组合
-      optionsEvensGroup: [],
+      optionsEvensGroup: [
+        [
+          [
+            {
+              name: '是否更新',
+              click: () => {
+                this.$alert(!this.valve ? '是否开启更新?' : '是否关闭更新?', '提示', {
+                  confirmButtonText: '确定',
+                  callback: (e) => {
+                    if (e === 'confirm') {
+                      this.valve = !this.valve
+                      if (this.valve) {
+                        this.timer = setInterval(() => {
+                          this.$refs.pageRef.refreshList()
+                        }, 5000)
+                      } else {
+                        clearInterval(this.timer)
+                        this.timer = null
+                      }
+                    }
+                  }
+                })
+              }
+            }
+          ]
+        ]
+      ],
       // 表格属性
       tableAttributes: {
         // 启用勾选列
@@ -39,9 +65,15 @@ export default {
       },
       recordSelected: [],
 
-      detailsId: ''
+      detailsId: '',
+      valve: false,
+      timer: null
     }
   },
+  deactivated() {
+    clearInterval(this.timer)
+    this.timer = null
+  },
   methods: {
     // 列表请求函数
     getList(...p) {