弹窗数据刷新

This commit is contained in:
ym1026
2025-09-17 15:08:13 +08:00
parent 575dc0478c
commit 740b3d3ad2
2 changed files with 21 additions and 7 deletions

View File

@@ -60,6 +60,8 @@ export default {
},
data() {
return {
refreshInterval:null,
modalInfo: {},
list: [
{
@@ -118,7 +120,22 @@ export default {
return this.list.filter((_, index) => index % 2 !== 0).slice(0, 3) // 右列取前3个奇数索引
}
},
beforeUnmount() {
if(this.refreshInterval){
clearInterval(this.refreshInterval)
this.refreshInterval=null
}
},
async mounted() {
await this.loadAllData()
this.refreshInterval=setInterval(async()=>{
await this.loadAllData()
},30000) //30s刷新一次
},
methods: {
async loadAllData(){
await Promise.all([
this.getStatTotalList(),
this.queryStationInfo(),
@@ -126,8 +143,6 @@ export default {
this.getStatDayList(1)
])
},
methods: {
// 查询系统累计统计信息
async getStatTotalList() {
try {

View File

@@ -111,7 +111,6 @@ export default {
}
},
beforeUnmount() {
console.log('2222')
if(this.refreshInterval){
clearInterval(this.refreshInterval)
this.refreshInterval=null