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