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 }