fix: 修复有时控制台报undefined的问题

This commit is contained in:
chenjinsong
2021-09-28 19:02:29 +08:00
parent 934b9b8e1f
commit be53a6897b

View File

@@ -613,7 +613,7 @@ export default {
const gotData = new Promise(resolve => { const gotData = new Promise(resolve => {
let result = '' let result = ''
if (chartParams.dataKey) { if (chartParams.dataKey) {
if (this.parentData && this.parentData[chartParams.dataKey]) { if (this.parentData && (this.parentData[chartParams.dataKey] || this.parentData[chartParams.dataKey] === 0)) {
result = this.parentData[chartParams.dataKey] result = this.parentData[chartParams.dataKey]
} else { } else {
this.noData = true this.noData = true
@@ -696,19 +696,21 @@ export default {
this.activeTab = `${this.chartInfo.children[0].id}` this.activeTab = `${this.chartInfo.children[0].id}`
} }
} else if (this.isGroup) { } else if (this.isGroup) {
const queryParams = { startTime: parseInt(this.timeFilter.startTime / 1000), endTime: parseInt(this.timeFilter.endTime / 1000), ...this.entity } if (chartParams && chartParams.url) {
get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => { const queryParams = { startTime: parseInt(this.timeFilter.startTime / 1000), endTime: parseInt(this.timeFilter.endTime / 1000), ...this.entity }
if (response.code === 200) { get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => {
this.groupData = response.data.result if (response.code === 200) {
} else { this.groupData = response.data.result
} else {
this.isError = true
this.noData = true
this.errorInfo = response.msg || response.message || 'Unknown'
}
}).catch(e => {
this.isError = true this.isError = true
this.noData = true this.errorInfo = e
this.errorInfo = response.msg || response.message || 'Unknown' })
} }
}).catch(e => {
this.isError = true
this.errorInfo = e
})
} else if (this.isDomainWhois || this.isDomainDnsRecord) { } else if (this.isDomainWhois || this.isDomainDnsRecord) {
const queryParams = { domain: this.entity.domain } const queryParams = { domain: this.entity.domain }
get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => { get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => {