|
|
@@ -682,16 +682,30 @@ export default {
|
|
|
},
|
|
|
equipmentKeyword: '',
|
|
|
originalEquipmentOptions: null,
|
|
|
- filteredEquipmentOptions: null
|
|
|
+ filteredEquipmentOptions: null,
|
|
|
+ // 定时器
|
|
|
+ timer: null
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
this.selectPeriod('本月');
|
|
|
- this.loadHomePageData(); // 加载首页统计数据
|
|
|
+ this.loadHomePageData(); // 首次加载首页统计数据
|
|
|
this.loadEquipmentData(); // 加载设备数据
|
|
|
this.applyFilter();
|
|
|
+
|
|
|
+ // 设置定时器,每3秒执行一次loadHomePageData函数
|
|
|
+ this.timer = setInterval(() => {
|
|
|
+ this.loadHomePageData();
|
|
|
+ }, 3000);
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 在组件销毁前清除定时器
|
|
|
+ beforeDestroy() {
|
|
|
+ if (this.timer) {
|
|
|
+ clearInterval(this.timer);
|
|
|
+ this.timer = null;
|
|
|
+ }
|
|
|
+ },
|
|
|
handleCascaderChange(val) {
|
|
|
console.log('选中的节点值:', val);
|
|
|
|