切换页面是,关闭定时器接口

如果接口报错,尝试季测若不成功,载关闭
This commit is contained in:
任珮宇 2023-10-28 11:58:59 +08:00
parent 062b80ea16
commit d439734ebd

View File

@ -228,6 +228,7 @@ export default {
timer: null, timer: null,
updataFilterType: [], updataFilterType: [],
updataFilterDataQuality: [], updataFilterDataQuality: [],
httpNum: 0,
} }
}, },
created() { created() {
@ -268,6 +269,7 @@ export default {
// //
async getDataProvisionEfficiency(arr, str) { async getDataProvisionEfficiency(arr, str) {
this.httpNum++
if (str && this.$route.path == '/station-operation') { if (str && this.$route.path == '/station-operation') {
this.$message.loading({ content: 'Loading station data, please wait...', key, duration: 0 }) this.$message.loading({ content: 'Loading station data, please wait...', key, duration: 0 })
} }
@ -325,10 +327,15 @@ export default {
} else if (arrA.length == 0 || arrB.length == 0 || arrC.length == 0) { } else if (arrA.length == 0 || arrB.length == 0 || arrC.length == 0) {
this.upDateStationList = [] this.upDateStationList = []
} }
setTimeout(() => { this.timer = setTimeout(() => {
this.getDataProvisionEfficiency(this.markerList_clone) this.getDataProvisionEfficiency(this.markerList_clone)
}, 10000) }, 10000)
} else { } else {
if (this.httpNum <= 5) {
setTimeout(() => {
this.getDataProvisionEfficiency(this.markerList_clone)
}, 5000)
}
this.$message.warning('This operation fails. Contact your system administrator') this.$message.warning('This operation fails. Contact your system administrator')
} }
}) })