From d3d9d3d964bd676c560eaeef2fe0217314d6bcda Mon Sep 17 00:00:00 2001 From: ZhaoYandong00 Date: Thu, 1 Aug 2024 20:22:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A0=E6=B3=95=E5=8D=95?= =?UTF-8?q?=E7=8B=AC=E9=80=89=E6=8B=A9=E6=98=BE=E7=A4=BA=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=BD=91=E7=BB=9C=E9=80=9F=E7=8E=87=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复单独选择一项时,会自动回到全选择的问题 修复单独选择一项时查看指定时间速率提示报错的问题 --- web_src/src/components/console/ConsoleNet.vue | 46 ++++++++++++++++++- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/web_src/src/components/console/ConsoleNet.vue b/web_src/src/components/console/ConsoleNet.vue index 22d4f343..e0136807 100755 --- a/web_src/src/components/console/ConsoleNet.vue +++ b/web_src/src/components/console/ConsoleNet.vue @@ -1,6 +1,6 @@ @@ -59,12 +59,54 @@ export default { tooltip: { trigger: 'axis', formatter: (data)=>{ - return data[1].marker + "下载:" + parseFloat(data[1].data[1]).toFixed(2) + "Mbps" + "
"+ data[0].marker +" 上传:" + parseFloat(data[0].data[1]).toFixed(2) + "Mbps"; + let in_sel = true; + let out_sel = true; + for (let key in this.extend.legend.selected) { + if (key == "上传") { + out_sel = this.extend.legend.selected[key]; + } + if (key == "下载") { + in_sel = this.extend.legend.selected[key]; + } + } + if (out_sel && in_sel) { + return ( + data[1].marker + + "下载:" + + parseFloat(data[1].data[1]).toFixed(2) + + "Mbps" + + "
" + + data[0].marker + + "上传:" + + parseFloat(data[0].data[1]).toFixed(2) + + "Mbps" + ); + } else if (out_sel) + return ( + data[0].marker + + "上传:" + + parseFloat(data[0].data[1]).toFixed(2) + + "Mbps" + ); + else if (in_sel) + return ( + data[0].marker + + "下载:" + + parseFloat(data[0].data[1]).toFixed(2) + + "Mbps" + ); + return ""; } }, legend: { left: "center", bottom: "15px", + selected: {}, + } + } + chartEvents: { + legendselectchanged: (item) => { + this.extend.legend.selected = item.selected; } } };