fix: 隐藏框选工具栏

This commit is contained in:
刘洪洪
2022-11-09 17:41:19 +08:00
parent 39edceb0dd
commit aa6d5f1598
2 changed files with 15 additions and 13 deletions

View File

@@ -149,7 +149,7 @@ export default {
overwriteUrl(newUrl) overwriteUrl(newUrl)
}, },
timeFilter: { timeFilter: {
handler (n) { handler () {
if (this.lineTab) { if (this.lineTab) {
this.init(this.metric, this.showMarkLine, 'active') this.init(this.metric, this.showMarkLine, 'active')
} else { } else {
@@ -160,7 +160,7 @@ export default {
metric (n) { metric (n) {
this.handleActiveBar() this.handleActiveBar()
this.showMarkLine = !this.showMarkLine this.showMarkLine = !this.showMarkLine
this.mpackets.forEach((e, i) => { this.mpackets.forEach((e) => {
if (!e.invertTab) { if (!e.invertTab) {
e.invertTab = true e.invertTab = true
} }
@@ -196,7 +196,7 @@ export default {
{ analysis: {}, name: 'network.other', class: 'other', show: true, invertTab: true, positioning: 5, data: [], unitType: '' } { analysis: {}, name: 'network.other', class: 'other', show: true, invertTab: true, positioning: 5, data: [], unitType: '' }
] ]
} }
res.data.result.forEach((t, i) => { res.data.result.forEach((t) => {
if (t.type === 'bytes' && val === 'Bits/s') { if (t.type === 'bytes' && val === 'Bits/s') {
const mpackets = _.cloneDeep(this.mpackets) const mpackets = _.cloneDeep(this.mpackets)
mpackets[0].analysis = t.totalBitsRate.analysis mpackets[0].analysis = t.totalBitsRate.analysis
@@ -214,7 +214,7 @@ export default {
let num = 0 let num = 0
mpackets.forEach(e => { mpackets.forEach(e => {
e.unitType = 'bps' e.unitType = 'bps'
if (e.name !== 'network.total' && e.analysis.avg == 0) { if (e.name !== 'network.total' && e.analysis.avg === 0) {
e.show = false e.show = false
num += 1 num += 1
} else { } else {
@@ -262,7 +262,7 @@ export default {
let num = 0 let num = 0
mpackets.forEach(e => { mpackets.forEach(e => {
e.unitType = 'packets/s' e.unitType = 'packets/s'
if (e.name !== 'network.total' && e.analysis.avg == 0) { if (e.name !== 'network.total' && e.analysis.avg === 0) {
e.show = false e.show = false
num += 1 num += 1
} else { } else {
@@ -367,7 +367,7 @@ export default {
width: 1 width: 1
}, },
stack: t.name !== 'network.total' ? 'network.total' : '', stack: t.name !== 'network.total' ? 'network.total' : '',
symbolSize: function (value, params) { symbolSize: function (value) {
return _this.symbolSizeSortChange(i, value[0]) return _this.symbolSizeSortChange(i, value[0])
}, },
itemStyle: { itemStyle: {
@@ -411,7 +411,7 @@ export default {
} }
}) })
if (!show) { if (!show) {
this.chartOption.series.forEach((t, i) => { this.chartOption.series.forEach((t) => {
t.markLine.label.show = false t.markLine.label.show = false
t.markLine = [] t.markLine = []
}) })
@@ -464,7 +464,7 @@ export default {
brushOption: { brushOption: {
// 参见 brush 组件的 brushType。如果设置为 false 则关闭“可刷选状态”。 // 参见 brush 组件的 brushType。如果设置为 false 则关闭“可刷选状态”。
brushType: 'lineX', brushType: 'lineX',
xAxisIndex: 0, xAxisIndex: 'all',
// 单击清除选框 // 单击清除选框
brushMode: 'single', brushMode: 'single',
// 选择完毕再返回所选数据 // 选择完毕再返回所选数据
@@ -482,7 +482,6 @@ export default {
if (!self.mouseDownFlag) { if (!self.mouseDownFlag) {
// 避免点击空白区域报错 // 避免点击空白区域报错
if (params.areas !== undefined && params.areas.length > 0) { if (params.areas !== undefined && params.areas.length > 0) {
// 因为人工选择不可能出现框选范围和x轴重合的情况
self.brushHistory.unshift({ self.brushHistory.unshift({
startTime: _.cloneDeep(self.timeFilter.startTime) * 1000, startTime: _.cloneDeep(self.timeFilter.startTime) * 1000,
endTime: _.cloneDeep(self.timeFilter.endTime) * 1000 endTime: _.cloneDeep(self.timeFilter.endTime) * 1000
@@ -558,7 +557,7 @@ export default {
}) })
} }
}, },
handleActiveBar (value) { handleActiveBar () {
if (document.querySelector('.network .line-value-mpackets.is-active')) { if (document.querySelector('.network .line-value-mpackets.is-active')) {
const { offsetLeft, clientWidth, clientLeft } = document.querySelector('.network .line-value-mpackets.is-active') const { offsetLeft, clientWidth, clientLeft } = document.querySelector('.network .line-value-mpackets.is-active')
const activeBar = document.querySelector('.network .line-value-active') const activeBar = document.querySelector('.network .line-value-active')

View File

@@ -44,7 +44,7 @@ export const pieChartOption1 = {
const data = pieChartOption1.series[0].data const data = pieChartOption1.series[0].data
let value let value
data.forEach(t => { data.forEach(t => {
if (t.name == name) { if (t.name === name) {
value = t.value value = t.value
} }
}) })
@@ -103,7 +103,7 @@ export const pieChartOption2 = {
const data = pieChartOption2.series[0].data const data = pieChartOption2.series[0].data
let value let value
data.forEach(t => { data.forEach(t => {
if (t.name == name) { if (t.name === name) {
value = t.value value = t.value
} }
}) })
@@ -164,9 +164,12 @@ export const stackedLineChartOption = {
trigger: 'axis', trigger: 'axis',
className: 'echarts-tooltip echarts-tooltip-dark' className: 'echarts-tooltip echarts-tooltip-dark'
}, },
toolbox: {
show: false
},
brush: { brush: {
toolbox: ['lineX'], toolbox: ['lineX'],
xAxisIndex: 0, xAxisIndex: 'all',
throttleType: 'debounce', throttleType: 'debounce',
transformable: false transformable: false
}, },