From 66a22b9e10080b6c15c6444ad6aee1fb0316e582 Mon Sep 17 00:00:00 2001 From: xiangxy Date: Fri, 29 Jul 2022 17:28:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E5=B1=8F2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/DeviceScreen.vue | 56 +++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/src/pages/DeviceScreen.vue b/src/pages/DeviceScreen.vue index 9573655..f85a9c4 100644 --- a/src/pages/DeviceScreen.vue +++ b/src/pages/DeviceScreen.vue @@ -236,6 +236,11 @@ export default { name: 'MonitoringScreen2', data () { return { + interTime: this.$store.getters.setTime, + timer2: null, + timer3: null, + timeOut1: null, + timeOut2: null, totalNum: '', // arrR01: [ // { @@ -388,35 +393,42 @@ export default { } } }, + // created () { + // this.updateTime() + // this.timer = window.setInterval(this.updateTime, 1000) + // } + // beforeDestroy () { + // this.$once('hook:beforeDestroy', () => { + // clearInterval(this.timer) + // }) + // } created () { - this.updateTime() - this.timer = window.setInterval(this.updateTime, 1000) + this.refresh() }, beforeDestroy () { this.$once('hook:beforeDestroy', () => { - clearInterval(this.timer) + clearInterval(this.timer2) }) }, - mounted () { - this._deviceStatus() - this._deviceManage() - this._deviceUseRate() - this._oeeAndTeep() - this._queryDeviceByWork() // gun - this._deviceCensus() - this._deviceStatusList() // 中grid - this._deviceErrorNum() - this._deviceErrorInfo() // 右grid - this._errCensus() - // this.setEchart01() // 左1 - // this.setEchart02() // 左3 - // this.setEchart03() // 中1 - // this.setEchart04() // 中2 - // this.setEchart05() // 中3 - // this.setEchart08() // 右1 - // this.setEchart10() // 右3 - }, methods: { + initData () { + this._deviceStatus() + this._deviceManage() + this._deviceUseRate() + this._oeeAndTeep() + this._queryDeviceByWork() // gun + this._deviceCensus() + this._deviceStatusList() // 中grid + this._deviceErrorNum() + this._deviceErrorInfo() // 右grid + this._errCensus() + }, + refresh () { + this.initData() + this.timer2 = setInterval(() => { + this.initData() + }, this.interTime) + }, fontSize (res) { const clientWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth if (!clientWidth) return