弹窗数据刷新

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

View File

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