From 19160c0da14a7c9c02aec60e1a23aa2137dbd092 Mon Sep 17 00:00:00 2001 From: hyx Date: Wed, 20 Dec 2023 10:41:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20CN-1518=20DNS=E6=B5=81=E9=87=8F=E6=9B=B2?= =?UTF-8?q?=E7=BA=BF=E5=9B=BE=E7=9A=84=E4=BA=A4=E4=BA=92=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=88=E5=87=8F=E5=B0=91=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E6=AC=A1=E6=95=B0=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../charts/dnsInsight/DnsTrafficLine.vue | 43 +++++++++++++++++-- .../networkOverview/NetworkOverviewLine.vue | 6 ++- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/src/views/charts2/charts/dnsInsight/DnsTrafficLine.vue b/src/views/charts2/charts/dnsInsight/DnsTrafficLine.vue index fe6da368..785703c3 100644 --- a/src/views/charts2/charts/dnsInsight/DnsTrafficLine.vue +++ b/src/views/charts2/charts/dnsInsight/DnsTrafficLine.vue @@ -12,7 +12,7 @@ :key="index" @mouseenter="mouseenter(item)" @mouseleave="mouseleave(item)" - @click="activeChange(item, index)"> + @click="activeChange(item, index,true)">
{{$t(item.name)}}
@@ -175,6 +175,7 @@ export default { const url = this.lineQueryCondition ? api.dnsInsight.drilldownTrafficAnalysis : api.dnsInsight.totalTrafficAnalysis axios.get(url, { params }).then(res => { + this.chartDateObject = res if (res.status === 200) { this.showError = false this.isNoData = res.data.data.result.length === 0 @@ -201,6 +202,38 @@ export default { this.toggleLoading(false) }) }, + initTabData (val, show, active) { + if (!val) { + val = this.lineMetric + } + this.toggleLoading(true) + try { + const res = this.chartDateObject.data + if (this.chartDateObject.status === 200) { + this.isNoData = res.data.result.length === 0 + if (!active) { + this.tabs = _.cloneDeep(dataForDnsTrafficLine.tabs) + } + if (this.isNoData) { + this.lineTab = '' + this.tabs = _.cloneDeep(dataForDnsTrafficLine.tabs) + } else { + this.initData(res.data.result, val, active, show) + } + } else { + this.isNoData = false + this.showError = true + this.errorMsg = this.errorMsgHandler(res) + } + } catch (e) { + console.error(e) + this.isNoData = false + this.showError = true + this.errorMsg = this.errorMsgHandler(e) + } finally { + this.toggleLoading(false) + } + }, echartsInit (echartsData, show) { this.$nextTick(() => { if (this.lineTab) { @@ -325,12 +358,16 @@ export default { } }) }, - activeChange (item, index) { + activeChange (item, index, isClick) { if (this.isNoData) return this.lineTab = item.class this.legendSelectChange(item, index, 'active') this.showMarkLine = !item.invertTab - this.init(this.lineMetric, this.showMarkLine, 'active') + if (isClick) { + this.initTabData(this.lineMetric, this.showMarkLine, 'active') + } else { + this.init(this.lineMetric, this.showMarkLine, 'active') + } }, mouseenter (item) { if (this.isNoData) return diff --git a/src/views/charts2/charts/networkOverview/NetworkOverviewLine.vue b/src/views/charts2/charts/networkOverview/NetworkOverviewLine.vue index 7fe35230..4ff7e9b8 100644 --- a/src/views/charts2/charts/networkOverview/NetworkOverviewLine.vue +++ b/src/views/charts2/charts/networkOverview/NetworkOverviewLine.vue @@ -387,7 +387,11 @@ export default { this.legendSelectChange(item, index, 'active') this.showMarkLine = !item.invertTab } - this.initTabData(this.metric, this.showMarkLine, 'active') + if (isClick) { + this.initTabData(this.metric, this.showMarkLine, 'active') + } else { + this.init(this.metric, this.showMarkLine, 'active') + } }, mouseenter (item) { if (this.isNoData) return