fix: 修复网络概况 =》 折线图表刷新后基准线重复,tab切换报错

This commit is contained in:
@changcode
2022-09-14 14:29:19 +08:00
parent 79b4868600
commit 867adb4914
3 changed files with 37 additions and 18 deletions

View File

@@ -46,6 +46,9 @@
} }
} }
} }
.link-traffic-select.line-select-metric {
margin-right: 20px;
}
.line-select-metric,.line-select-reference-line { .line-select-metric,.line-select-reference-line {
display: flex; display: flex;
align-items: center; align-items: center;
@@ -126,7 +129,7 @@
flex: 1; flex: 1;
padding-left: 19px; padding-left: 19px;
} }
.total,.inbound,.outbound,.internal,.through,.other { .total,.inbound,.outbound,.internal,.through,.other,.ingress,.egress {
width: 14px; width: 14px;
height: 14px; height: 14px;
border-radius: 50%; border-radius: 50%;
@@ -137,10 +140,10 @@
.total { .total {
background: #00A7AB; background: #00A7AB;
} }
.inbound { .inbound,.ingress {
background: #7FA054; background: #7FA054;
} }
.outbound { .outbound,.egress {
background: #35ADDA; background: #35ADDA;
} }
.internal { .internal {

View File

@@ -23,10 +23,10 @@ export const typeMapping = {
linkMonitor: { linkMonitor: {
linkBlock: 707, linkBlock: 707,
linkTrafficSankey: 708, linkTrafficSankey: 708,
linkTrafficLine: 710 linkTrafficLine: 105
}, },
dnsInsight: { dnsInsight: {
dnsTrafficLine: 704, dnsTrafficLine: 106,
dnsEventChart: 711, dnsEventChart: 711,
dnsRecentEvents: 605, dnsRecentEvents: 605,
dnsActiveMaliciousDomain: 604 dnsActiveMaliciousDomain: 604

View File

@@ -172,7 +172,11 @@ export default {
timeFilter: { timeFilter: {
deep: true, deep: true,
handler (n) { handler (n) {
this.init(this.lineMetric, this.showMarkLine, 'active') if (this.lineTab) {
this.init(this.lineMetric, this.showMarkLine, 'active')
} else {
this.init()
}
} }
} }
}, },
@@ -466,33 +470,45 @@ export default {
const dataIntegrationArray = [] const dataIntegrationArray = []
if (stackedLineChartOption.series[0]) { if (stackedLineChartOption.series[0]) {
const totalData = stackedLineChartOption.series[0].data.find(t => t[0] === time) // [time, value] const totalData = stackedLineChartOption.series[0].data.find(t => t[0] === time) // [time, value]
dataIntegrationArray.push(totalData) if (totalData) {
totalData[2] = 0 dataIntegrationArray.push(totalData)
totalData[2] = 0
}
} }
if (stackedLineChartOption.series[1]) { if (stackedLineChartOption.series[1]) {
const inboundData = stackedLineChartOption.series[1].data.find(t => t[0] === time) const inboundData = stackedLineChartOption.series[1].data.find(t => t[0] === time)
dataIntegrationArray.push(inboundData) if (inboundData) {
inboundData[2] = 1 dataIntegrationArray.push(inboundData)
inboundData[2] = 1
}
} }
if (stackedLineChartOption.series[2]) { if (stackedLineChartOption.series[2]) {
const outboundData = stackedLineChartOption.series[2].data.find(t => t[0] === time) const outboundData = stackedLineChartOption.series[2].data.find(t => t[0] === time)
dataIntegrationArray.push(outboundData) if (outboundData) {
outboundData[2] = 2 dataIntegrationArray.push(outboundData)
outboundData[2] = 2
}
} }
if (stackedLineChartOption.series[3]) { if (stackedLineChartOption.series[3]) {
const internalData = stackedLineChartOption.series[3].data.find(t => t[0] === time) const internalData = stackedLineChartOption.series[3].data.find(t => t[0] === time)
dataIntegrationArray.push(internalData) if (internalData) {
internalData[2] = 3 dataIntegrationArray.push(internalData)
internalData[2] = 3
}
} }
if (stackedLineChartOption.series[4]) { if (stackedLineChartOption.series[4]) {
const throughData = stackedLineChartOption.series[4].data.find(t => t[0] === time) const throughData = stackedLineChartOption.series[4].data.find(t => t[0] === time)
dataIntegrationArray.push(throughData) if (throughData) {
throughData[2] = 4 dataIntegrationArray.push(throughData)
throughData[2] = 4
}
} }
if (stackedLineChartOption.series[5]) { if (stackedLineChartOption.series[5]) {
const otherData = stackedLineChartOption.series[5].data.find(t => t[0] === time) const otherData = stackedLineChartOption.series[5].data.find(t => t[0] === time)
dataIntegrationArray.push(otherData) if (otherData) {
otherData[2] = 5 dataIntegrationArray.push(otherData)
otherData[2] = 5
}
} }
dataIntegrationArray.sort((a, b) => { return a[1] - b[1] }) dataIntegrationArray.sort((a, b) => { return a[1] - b[1] })
const sortIndex = dataIntegrationArray.findIndex(a => a[2] === index) const sortIndex = dataIntegrationArray.findIndex(a => a[2] === index)