fix:chart 编辑页面 改为 只有 type = group 显示 show/hidden 配置项

This commit is contained in:
zhangyu
2022-07-20 14:21:40 +08:00
parent b0e0ac6921
commit 49df64db13
3 changed files with 35 additions and 2 deletions

View File

@@ -176,7 +176,8 @@ export default {
scrollTop: 0, scrollTop: 0,
scrollTopTimer: null, scrollTopTimer: null,
// 变量比较结果 图表是否显示/隐藏 // 变量比较结果 图表是否显示/隐藏
showHidden: {} showHidden: {},
tempList: []
} }
}, },
methods: { methods: {
@@ -440,6 +441,7 @@ export default {
}, },
// 比较变量 图表是否显示/隐藏 // 比较变量 图表是否显示/隐藏
compareVariables () { compareVariables () {
console.log(123123123123)
if (!this.panelLock) { if (!this.panelLock) {
return false 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 () { created () {
@@ -549,6 +569,12 @@ export default {
handler (flag) { handler (flag) {
if (!flag) { if (!flag) {
this.showHidden = {} this.showHidden = {}
this.tempList.forEach(item => {
if (!this.copyDataList.find(chart => chart.id === item.id)) {
this.copyDataList.push(item)
}
})
this.onScroll(this.scrollTop)
} else { } else {
// 比较变量 图表是否显示/隐藏 // 比较变量 图表是否显示/隐藏
this.compareVariables() this.compareVariables()
@@ -618,6 +644,7 @@ export default {
}) })
} }
this.$nextTick(() => { this.$nextTick(() => {
this.tempList = JSON.parse(JSON.stringify(tempList))
this.copyDataList = JSON.parse(JSON.stringify(tempList)) this.copyDataList = JSON.parse(JSON.stringify(tempList))
// 比较变量 图表是否显示/隐藏 // 比较变量 图表是否显示/隐藏
this.compareVariables() this.compareVariables()

View File

@@ -726,7 +726,7 @@
</div> </div>
<!-- visibility --> <!-- visibility -->
<div> <div v-if="params.type === 'group'">
<div class="form__sub-title"> <div class="form__sub-title">
<span>{{$t('dashboard.panel.showHidden')}}</span> <span>{{$t('dashboard.panel.showHidden')}}</span>
<el-switch <el-switch

View File

@@ -600,6 +600,12 @@ export default {
handler (n) { handler (n) {
if (n === 'group') { if (n === 'group') {
this.editChart.groupId = '' this.editChart.groupId = ''
} else {
this.editChart.param.enable.visibility = false
this.editChart.param.visibility.varName = ''
this.editChart.param.visibility.operator = ''
this.editChart.param.visibility.varValue = ''
this.editChart.param.visibility.result = ''
} }
} }
}, },