CN-1483 network overview单位统一
This commit is contained in:
@@ -62,7 +62,7 @@
|
||||
import * as echarts from 'echarts'
|
||||
import { stackedLineChartOption } from '@/views/charts2/charts/options/echartOption'
|
||||
import { valueToRangeValue } from '@/utils/unit-convert'
|
||||
import { unitTypes, chartColor3, chartColor4 } from '@/utils/constants.js'
|
||||
import { unitTypes, chartColor3, chartColor4, metricType, metricOptions } from '@/utils/constants.js'
|
||||
import { ref, shallowRef } from 'vue'
|
||||
import { stackedLineTooltipFormatter } from '@/views/charts/charts/tools'
|
||||
import _ from 'lodash'
|
||||
@@ -509,7 +509,7 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
if (val === 'Sessions/s') {
|
||||
if (val === metricType.Sessions) {
|
||||
const tabs = _.cloneDeep(this.tabsTemplate)
|
||||
lineData.forEach((d, i) => {
|
||||
tabs[i].data = d.values
|
||||
@@ -519,7 +519,8 @@ export default {
|
||||
if (i !== 0) {
|
||||
e.show = false
|
||||
}
|
||||
e.unitType = 'sessions/s'
|
||||
const metric = metricOptions.find(item => item.value === metricType.Sessions)
|
||||
e.unitType = metric ? this.$t(metric.label) : ''
|
||||
e.invertTab = false
|
||||
this.lineTab = 'total'
|
||||
this.legendSelectChange(e, 0)
|
||||
@@ -530,7 +531,12 @@ export default {
|
||||
this.echartsInit(this.tabs, true)
|
||||
})
|
||||
} else {
|
||||
const unit = val === 'Bits/s' ? 'bps' : 'packets/s'
|
||||
let metric = metricOptions.find(item => item.value === val)
|
||||
if (!metric) {
|
||||
metric = metricOptions.find(item => item.value === metricType.Packets)
|
||||
}
|
||||
const unit = metric ? this.$t(metric.label) : ''
|
||||
|
||||
this.legendInit(lineData, active, show, unit, n)
|
||||
}
|
||||
},
|
||||
@@ -623,7 +629,7 @@ export default {
|
||||
this.chartOption = null
|
||||
const self = this
|
||||
self.timer = setTimeout(() => {
|
||||
if (self.lineTab && self.metric !== 'Sessions/s') {
|
||||
if (self.lineTab && self.metric !== metricType.Sessions) {
|
||||
const data = self.tabsTemplate.find(t => t.class === self.lineTab)
|
||||
self.activeChange(data, data.positioning)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user