From cd388c78650efe85fe4dd41cc439208d58ab6c29 Mon Sep 17 00:00:00 2001 From: haoxuan <haoxuan> Date: 星期二, 05 十二月 2023 16:19:55 +0800 Subject: [PATCH] 接口轮训时 设备负荷对比柱状图 动画问题修改 --- src/views/cockpitPage/components/DeviceChart.vue | 4 +++- src/views/cockpitPage/index.vue | 10 +++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/views/cockpitPage/components/DeviceChart.vue b/src/views/cockpitPage/components/DeviceChart.vue index 530e342..1e8f376 100644 --- a/src/views/cockpitPage/components/DeviceChart.vue +++ b/src/views/cockpitPage/components/DeviceChart.vue @@ -46,6 +46,7 @@ // }, startValue: 0, endValue: 5, + chartTimer:null, }; }, watch: { @@ -64,6 +65,7 @@ //鍦ㄨ亴 pieChart(chartName, data) { let that = this; + clearInterval(this.chartTimer); let chartDomTwo = this.$refs[chartName]; let myChartTwo = echarts.init(chartDomTwo) myChartTwo.dispose() @@ -205,7 +207,7 @@ ], }; - setInterval(function () { + this.chartTimer=setInterval(function () { if (option.dataZoom[0].endValue == data.datay.length) { option.dataZoom[0].startValue = that.startValue; option.dataZoom[0].endValue = that.endValue; diff --git a/src/views/cockpitPage/index.vue b/src/views/cockpitPage/index.vue index 286e86a..002bdce 100644 --- a/src/views/cockpitPage/index.vue +++ b/src/views/cockpitPage/index.vue @@ -98,9 +98,9 @@ }, mounted() { this.getDashboard(); - setInterval(() => { - this.getDashboard(); - }, 30000); + // setInterval(() => { + // this.getDashboard(); + // }, 30000); }, watch: {}, methods: { @@ -119,6 +119,10 @@ this.setLeftBlock5(res.data); // 璁惧璐熻嵎瀵规瘮 this.setRightBlock1(res.data); + }).finally(()=>{ + setTimeout(()=>{ + this.getDashboard() + },30000) }); }, // 澶勭悊宸︿笂鏁版嵁 -- Gitblit v1.8.0