fix: 修复npm overview 折线图数据为空时 No data 占位错误问题

This commit is contained in:
@changcode
2023-01-13 14:34:52 +08:00
parent c83f64706f
commit 089887f05b
4 changed files with 14 additions and 5 deletions

View File

@@ -207,8 +207,9 @@ export default {
{ analysis: {}, name: 'network.inbound', class: 'inbound', show: true, invertTab: true, positioning: 1, data: [], unitType: '' }, { analysis: {}, name: 'network.inbound', class: 'inbound', show: true, invertTab: true, positioning: 1, data: [], unitType: '' },
{ analysis: {}, name: 'network.outbound', class: 'outbound', show: true, invertTab: true, positioning: 2, data: [], unitType: '' } { analysis: {}, name: 'network.outbound', class: 'outbound', show: true, invertTab: true, positioning: 2, data: [], unitType: '' }
] ]
} else {
this.initData(res.data.result, val, active, show)
} }
this.initData(res.data.result, val, active, show)
} else { } else {
this.isNoData = false this.isNoData = false
this.showError = true this.showError = true

View File

@@ -187,8 +187,9 @@ export default {
{ analysis: {}, name: 'linkMonitor.ingress', class: 'ingress', show: true, invertTab: true, positioning: 1, data: [], unitType: '' }, { analysis: {}, name: 'linkMonitor.ingress', class: 'ingress', show: true, invertTab: true, positioning: 1, data: [], unitType: '' },
{ analysis: {}, name: 'linkMonitor.egress', class: 'egress', show: true, invertTab: true, positioning: 2, data: [], unitType: '' } { analysis: {}, name: 'linkMonitor.egress', class: 'egress', show: true, invertTab: true, positioning: 2, data: [], unitType: '' }
] ]
} else {
this.initData(res.data.result, val, active, show)
} }
this.initData(res.data.result, val, active, show)
} else { } else {
this.showError = true this.showError = true
this.errorMsg = res.message this.errorMsg = res.message

View File

@@ -221,8 +221,9 @@ export default {
{ analysis: {}, name: 'network.through', class: 'through', show: true, invertTab: true, positioning: 4, data: [], unitType: '' }, { analysis: {}, name: 'network.through', class: 'through', show: true, invertTab: true, positioning: 4, data: [], unitType: '' },
{ analysis: {}, name: 'network.other', class: 'other', show: true, invertTab: true, positioning: 5, data: [], unitType: '' } { analysis: {}, name: 'network.other', class: 'other', show: true, invertTab: true, positioning: 5, data: [], unitType: '' }
] ]
} else {
this.initData(res.data.result, val, active, show, n)
} }
this.initData(res.data.result, val, active, show, n)
} else { } else {
this.showError = true this.showError = true
this.errorMsg = res.message this.errorMsg = res.message

View File

@@ -215,8 +215,9 @@ export default {
{ name: this.$t('networkAppPerformance.packetLoss'), show: true, positioning: 0, data: [], unitType: unitTypes.percent, index: 3 }, { name: this.$t('networkAppPerformance.packetLoss'), show: true, positioning: 0, data: [], unitType: unitTypes.percent, index: 3 },
{ name: this.$t('overall.packetRetrans'), show: true, positioning: 0, data: [], unitType: unitTypes.percent, index: 4 } { name: this.$t('overall.packetRetrans'), show: true, positioning: 0, data: [], unitType: unitTypes.percent, index: 4 }
] ]
} else {
this.initData(res.data.result, val)
} }
this.initData(res.data.result, val)
} else { } else {
this.isNoData = false this.isNoData = false
this.showError = true this.showError = true
@@ -240,6 +241,10 @@ export default {
res.forEach(item => { res.forEach(item => {
if (item.code === 200) { if (item.code === 200) {
npmLineData.push(...item.data.result) npmLineData.push(...item.data.result)
} else {
this.isNoData = false
this.showError = true
this.errorMsg = res.message
} }
}) })
this.showError = false this.showError = false
@@ -260,8 +265,9 @@ export default {
{ name: this.$t('networkAppPerformance.packetLoss'), show: true, positioning: 0, data: [], unitType: unitTypes.percent, index: 3 }, { name: this.$t('networkAppPerformance.packetLoss'), show: true, positioning: 0, data: [], unitType: unitTypes.percent, index: 3 },
{ name: this.$t('overall.packetRetrans'), show: true, positioning: 0, data: [], unitType: unitTypes.percent, index: 4 } { name: this.$t('overall.packetRetrans'), show: true, positioning: 0, data: [], unitType: unitTypes.percent, index: 4 }
] ]
} else {
this.initData(npmLineData, val)
} }
this.initData(npmLineData, val)
}).catch(e => { }).catch(e => {
this.isNoData = false this.isNoData = false
this.showError = true this.showError = true