fix: tab选项卡折线图,数据为空时去除移入点击效果

This commit is contained in:
@changcode
2022-11-22 17:58:15 +08:00
parent bf008fe944
commit ae4ce44eff
3 changed files with 9 additions and 0 deletions

View File

@@ -197,6 +197,7 @@ export default {
if (res.code === 200) { if (res.code === 200) {
this.isNoData = res.data.result.length === 0 this.isNoData = res.data.result.length === 0
if (this.isNoData) { if (this.isNoData) {
this.lineTab = ''
this.mpackets = [ this.mpackets = [
{ analysis: {}, name: 'network.total', class: 'total', show: true, invertTab: true, positioning: 0, data: [], unitType: '' }, { analysis: {}, name: 'network.total', class: 'total', show: true, invertTab: true, positioning: 0, data: [], unitType: '' },
{ analysis: {}, name: 'network.inbound', class: 'inbound', show: true, invertTab: true, positioning: 1, data: [], unitType: '' }, { analysis: {}, name: 'network.inbound', class: 'inbound', show: true, invertTab: true, positioning: 1, data: [], unitType: '' },
@@ -383,12 +384,14 @@ export default {
this.myChart.setOption(this.chartOption) this.myChart.setOption(this.chartOption)
}, },
activeChange (item, index) { activeChange (item, index) {
if (this.isNoData) return
this.lineTab = item.class this.lineTab = item.class
this.legendSelectChange(item, index, 'active') this.legendSelectChange(item, index, 'active')
this.showMarkLine = !item.invertTab this.showMarkLine = !item.invertTab
this.init(this.lineMetric, this.showMarkLine, 'active') this.init(this.lineMetric, this.showMarkLine, 'active')
}, },
mouseenter (item) { mouseenter (item) {
if (this.isNoData) return
this.mousemoveCursor = item.class this.mousemoveCursor = item.class
this.handleActiveBar(item.class) this.handleActiveBar(item.class)
}, },

View File

@@ -181,6 +181,7 @@ export default {
this.showError = false this.showError = false
this.isNoData = res.data.result.length === 0 this.isNoData = res.data.result.length === 0
if (this.isNoData) { if (this.isNoData) {
this.lineTab = ''
this.mpackets = [ this.mpackets = [
{ analysis: {}, name: 'network.total', class: 'total', show: true, invertTab: true, positioning: 0, data: [], unitType: '' }, { analysis: {}, name: 'network.total', class: 'total', show: true, invertTab: true, positioning: 0, data: [], unitType: '' },
{ analysis: {}, name: 'linkMonitor.ingress', class: 'ingress', show: true, invertTab: true, positioning: 1, data: [], unitType: '' }, { analysis: {}, name: 'linkMonitor.ingress', class: 'ingress', show: true, invertTab: true, positioning: 1, data: [], unitType: '' },
@@ -353,12 +354,14 @@ export default {
this.myChart.setOption(this.chartOption) this.myChart.setOption(this.chartOption)
}, },
activeChange (item, index) { activeChange (item, index) {
if (this.isNoData) return
this.lineTab = item.class this.lineTab = item.class
this.legendSelectChange(item, index, 'active') this.legendSelectChange(item, index, 'active')
this.showMarkLine = !item.invertTab this.showMarkLine = !item.invertTab
this.init(this.lineMetric, this.showMarkLine, 'active') this.init(this.lineMetric, this.showMarkLine, 'active')
}, },
mouseenter (item) { mouseenter (item) {
if (this.isNoData) return
this.mousemoveCursor = item.class this.mousemoveCursor = item.class
this.handleActiveBar(item.class) this.handleActiveBar(item.class)
}, },

View File

@@ -197,6 +197,7 @@ export default {
this.showError = false this.showError = false
if (this.isNoData) { if (this.isNoData) {
this.lineTab = ''
this.mpackets = [ this.mpackets = [
{ analysis: {}, name: 'network.total', class: 'total', show: true, invertTab: true, positioning: 0, data: [], unitType: '' }, { analysis: {}, name: 'network.total', class: 'total', show: true, invertTab: true, positioning: 0, data: [], unitType: '' },
{ analysis: {}, name: 'network.inbound', class: 'inbound', show: true, invertTab: true, positioning: 1, data: [], unitType: '' }, { analysis: {}, name: 'network.inbound', class: 'inbound', show: true, invertTab: true, positioning: 1, data: [], unitType: '' },
@@ -519,12 +520,14 @@ export default {
}) })
}, },
activeChange (item, index) { activeChange (item, index) {
if (this.isNoData) return
this.lineTab = item.class this.lineTab = item.class
this.legendSelectChange(item, index, 'active') this.legendSelectChange(item, index, 'active')
this.showMarkLine = !item.invertTab this.showMarkLine = !item.invertTab
this.init(this.metric, this.showMarkLine, 'active') this.init(this.metric, this.showMarkLine, 'active')
}, },
mouseenter (item) { mouseenter (item) {
if (this.isNoData) return
this.mousemoveCursor = item.class this.mousemoveCursor = item.class
this.handleActiveBar(item.class) this.handleActiveBar(item.class)
}, },