fix: 修复曲线图在数据所有tab的max都为0的情况下会重复请求的问题

This commit is contained in:
刘洪洪
2023-10-11 18:40:29 +08:00
parent 5fbab86a80
commit 11540d3c34
5 changed files with 43 additions and 7 deletions

View File

@@ -192,6 +192,9 @@ export default {
if (response.status === 200) {
this.isNoData = res.data.result.length === 0
this.showError = false
if (!active) {
this.tabs = _.cloneDeep(this.tabsTemplate)
}
if (this.isNoData) {
this.lineTab = ''
this.tabs = _.cloneDeep(this.tabsTemplate)
@@ -512,6 +515,7 @@ export default {
})
this.tabs = tabs
this.$nextTick(() => {
this.lineRefer = 'Average'
this.echartsInit(this.tabs, true)
})
} else {
@@ -542,10 +546,15 @@ export default {
if (parseFloat(e.analysis.max) <= 0) {
self.lineTab = ''
self.lineRefer = ''
self.init()
// self.init()
}
}
})
const emptyData = tabs.filter(d => parseFloat(d.analysis.max) === 0)
this.isNoData = emptyData.length === tabs.length
if (this.isNoData) {
return true
}
this.tabs = tabs
if (num === 5) {
tabs[0].invertTab = false