From be53a6897b3fcec2fb7817d7e10030930fcf309c Mon Sep 17 00:00:00 2001 From: chenjinsong <523037378@qq.com> Date: Tue, 28 Sep 2021 19:02:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=9C=89=E6=97=B6?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E5=8F=B0=E6=8A=A5undefined=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/charts/Chart.vue | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/views/charts/Chart.vue b/src/views/charts/Chart.vue index bc2bc027..b245377e 100644 --- a/src/views/charts/Chart.vue +++ b/src/views/charts/Chart.vue @@ -613,7 +613,7 @@ export default { const gotData = new Promise(resolve => { let result = '' 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] } else { this.noData = true @@ -696,19 +696,21 @@ export default { this.activeTab = `${this.chartInfo.children[0].id}` } } else if (this.isGroup) { - const queryParams = { startTime: parseInt(this.timeFilter.startTime / 1000), endTime: parseInt(this.timeFilter.endTime / 1000), ...this.entity } - get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => { - if (response.code === 200) { - this.groupData = response.data.result - } else { + if (chartParams && chartParams.url) { + const queryParams = { startTime: parseInt(this.timeFilter.startTime / 1000), endTime: parseInt(this.timeFilter.endTime / 1000), ...this.entity } + get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => { + if (response.code === 200) { + 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.noData = true - this.errorInfo = response.msg || response.message || 'Unknown' - } - }).catch(e => { - this.isError = true - this.errorInfo = e - }) + this.errorInfo = e + }) + } } else if (this.isDomainWhois || this.isDomainDnsRecord) { const queryParams = { domain: this.entity.domain } get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => {