From 6b34293730c9bb95eec5f3b460cc113301e3168a Mon Sep 17 00:00:00 2001 From: z_yu <1534695664@qq.com> Date: Fri, 16 Sep 2022 15:26:11 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=A8=E7=A6=81=E8=AE=B0=E5=BD=95=E5=92=8C?= =?UTF-8?q?=E6=8A=A5=E8=AD=A6=E8=AE=B0=E5=BD=95=E6=BB=9A=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/components/SecurityDoor.vue | 17 ++++------------- src/views/components/WarehouseWarning.vue | 20 +++++--------------- 2 files changed, 9 insertions(+), 28 deletions(-) diff --git a/src/views/components/SecurityDoor.vue b/src/views/components/SecurityDoor.vue index 5b1c1a3..c52a9fe 100644 --- a/src/views/components/SecurityDoor.vue +++ b/src/views/components/SecurityDoor.vue @@ -40,7 +40,6 @@ export default { return { tableData: [], // 正在展示的数据 scrollTimer: null, - showComplete: false, // 是否滚动显示完所有数据 getDataTimer: null } }, @@ -52,19 +51,10 @@ export default { }, created() { this.getSecuritydoor() - this.getDataTimer = setInterval(() => { - console.log('SecurityDoor', this.showComplete) - if (this.showComplete) { - this.getSecuritydoor() - this.showComplete = false - } - }, 1000 * 30) }, destroyed() { clearInterval(this.scrollTimer) this.scrollTimer = null - clearInterval(this.getDataTimer) - this.getDataTimer = null }, methods: { // 表格隔行变色 @@ -94,7 +84,9 @@ export default { this.addTableRefScroll(bodyWrapper) } } else { - this.showComplete = true + this.scrollTimer = setInterval(() => { + this.getSecuritydoor() + }, 1000 * 3 * this.tableData.length) } }, addTableRefScroll(bodyWrapper) { @@ -103,8 +95,7 @@ export default { this.scrollTimer = setInterval(() => { // scrollTop = bodyWrapper.scrollTop if (bodyWrapper.scrollTop + this.wrapperHeight >= this.tableData.length * 40) { - bodyWrapper.scrollTop = 0 - this.showComplete = true + this.getSecuritydoor() } else { bodyWrapper.scrollTop += this.displayNum * 40 } diff --git a/src/views/components/WarehouseWarning.vue b/src/views/components/WarehouseWarning.vue index 04a274f..b4b08b0 100644 --- a/src/views/components/WarehouseWarning.vue +++ b/src/views/components/WarehouseWarning.vue @@ -36,9 +36,7 @@ export default { data() { return { tableData: [], // 正在展示的警情数据 - scrollTimer: null, - showComplete: false, // 是否滚动显示完所有数据 - getDataTimer: null + scrollTimer: null } }, watch: { @@ -49,19 +47,10 @@ export default { }, created() { this.getAlarmInfo() - this.getDataTimer = setInterval(() => { - console.log('WarehouseWarning', this.showComplete) - if (this.showComplete) { - this.getAlarmInfo() - this.showComplete = false - } - }, 1000 * 30) }, destroyed() { clearInterval(this.scrollTimer) this.scrollTimer = null - clearInterval(this.getDataTimer) - this.getDataTimer = null }, methods: { // 表格隔行变色 @@ -91,7 +80,9 @@ export default { this.addTableRefScroll(bodyWrapper) } } else { - this.showComplete = true + this.scrollTimer = setInterval(() => { + this.getAlarmInfo() + }, 1000 * 3 * this.tableData.length) } }, addTableRefScroll(bodyWrapper) { @@ -100,8 +91,7 @@ export default { this.scrollTimer = setInterval(() => { // scrollTop = bodyWrapper.scrollTop if (bodyWrapper.scrollTop + this.wrapperHeight >= this.tableData.length * 40) { - bodyWrapper.scrollTop = 0 - this.showComplete = true + this.getAlarmInfo() } else { bodyWrapper.scrollTop += this.displayNum * 40 }