From 49df64db13d04b89953c1cc4b7a9136d6d51ea4c Mon Sep 17 00:00:00 2001 From: zhangyu Date: Wed, 20 Jul 2022 14:21:40 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9Achart=20=E7=BC=96=E8=BE=91=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=20=E6=94=B9=E4=B8=BA=20=E5=8F=AA=E6=9C=89=20=20type?= =?UTF-8?q?=20=3D=20group=20=E6=98=BE=E7=A4=BA=20=20show/hidden=20?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/chart/chartList.vue | 29 ++++++++++++++++++- .../common/rightBox/chart/chartConfig.vue | 2 +- .../common/rightBox/chart/chartRightBox.vue | 6 ++++ 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/nezha-fronted/src/components/chart/chartList.vue b/nezha-fronted/src/components/chart/chartList.vue index 9ea56f579..b1d9b1b4a 100644 --- a/nezha-fronted/src/components/chart/chartList.vue +++ b/nezha-fronted/src/components/chart/chartList.vue @@ -176,7 +176,8 @@ export default { scrollTop: 0, scrollTopTimer: null, // 变量比较结果 图表是否显示/隐藏 - showHidden: {} + showHidden: {}, + tempList: [] } }, methods: { @@ -440,6 +441,7 @@ export default { }, // 比较变量 图表是否显示/隐藏 compareVariables () { + console.log(123123123123) if (!this.panelLock) { return false } @@ -507,6 +509,24 @@ export default { }) } }) + // this.copyDataList.forEach((item, index) => { + // if (!this.showHidden[item.id] && item.id !== -2) { + // delete this.copyDataList[index] + // } + // }) + for (let i = 0; i < this.copyDataList.length; i++) { + const item = this.copyDataList[i] + if ((this.showHidden[item.id] && this.showHidden[item.id] === 'hidden') && item.id !== -2) { + this.copyDataList.splice(i, 1) + i-- + } + } + this.tempList.forEach(item => { + if ((!this.showHidden[item.id] || this.showHidden[item.id] === 'show') && item.id !== -2 && !this.copyDataList.find(chart => chart.id === item.id)) { + this.copyDataList.push(item) + } + }) + this.onScroll(this.scrollTop) } }, created () { @@ -549,6 +569,12 @@ export default { handler (flag) { if (!flag) { this.showHidden = {} + this.tempList.forEach(item => { + if (!this.copyDataList.find(chart => chart.id === item.id)) { + this.copyDataList.push(item) + } + }) + this.onScroll(this.scrollTop) } else { // 比较变量 图表是否显示/隐藏 this.compareVariables() @@ -618,6 +644,7 @@ export default { }) } this.$nextTick(() => { + this.tempList = JSON.parse(JSON.stringify(tempList)) this.copyDataList = JSON.parse(JSON.stringify(tempList)) // 比较变量 图表是否显示/隐藏 this.compareVariables() diff --git a/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue b/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue index 7697c9cb6..f85919f78 100644 --- a/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue +++ b/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue @@ -726,7 +726,7 @@ -
+
{{$t('dashboard.panel.showHidden')}}