diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue b/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue index 3b7a19a08..d8a17da33 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue @@ -228,7 +228,7 @@ export default { thresholdShow: true, thresholds: [{ value: undefined, color: randomcolor() }] }, - elements: [{ expression: '', legend: '', type: 'expert', id: '', name: 'A' }], + elements: [{ expression: '', legend: '', type: 'expert', id: '', name: 'A', state: 1 }], panel: '', sync: 0, remark: '', diff --git a/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue b/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue index 1a8133afc..6783540b5 100644 --- a/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue +++ b/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue @@ -52,7 +52,14 @@
{{expressionsShow[index-1].error}}
- + + + + + + + + diff --git a/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue b/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue index b3e72839f..a86f6a43b 100644 --- a/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue +++ b/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue @@ -362,7 +362,7 @@ export default { type: 'line', min: 0, max: 100, - elements: [{ expression: '', legend: '', type: 'expert', id: '', name: 'A' }], + elements: [{ expression: '', legend: '', type: 'expert', id: '', name: 'A', state: 1 }], param: { stack: 0, nullType: 'null', @@ -389,7 +389,7 @@ export default { legend: true, valueMapping: false }, - elements: [{ expression: '', legend: '', type: 'expert', id: '', name: 'A' }], + elements: [{ expression: '', legend: '', type: 'expert', id: '', name: 'A', state: 1 }], param: { limit: 100, showHeader: this.editChart.param.showHeader diff --git a/nezha-fronted/src/components/common/rightBox/chart/publicConfig.js b/nezha-fronted/src/components/common/rightBox/chart/publicConfig.js index 6d2b9667b..7bf8a6917 100644 --- a/nezha-fronted/src/components/common/rightBox/chart/publicConfig.js +++ b/nezha-fronted/src/components/common/rightBox/chart/publicConfig.js @@ -329,13 +329,21 @@ export default { if (this.expressions.length) { this.chartConfig.elements = [] this.expressions.forEach((expr, i) => { - this.chartConfig.elements.push({ id: this.expressionsShow[i].elementId, expression: expr, type: 'expert', legend: this.expressionsShow[i].legend, name: this.expressionName[i] }) + this.chartConfig.elements.push({ id: this.expressionsShow[i].elementId, expression: expr, type: 'expert', legend: this.expressionsShow[i].legend, name: this.expressionName[i], state: this.expressionsShow[i].state }) }) } else { this.chartConfig.elements = [] } this.change() }, + switchExpression (index, flag) { + if (flag === 1) { + this.$set(this.expressionsShow[index], 'state', 0) + } else { + this.$set(this.expressionsShow[index], 'state', 1) + } + this.expressionChange() + }, expressionNameChange (index) { if (this.expressionsShow[index].error) { this.expressionName[index] = this.expressionsShow[index].oldName @@ -383,7 +391,8 @@ export default { oldName: expressionName, error: '', legend: '', - elementId: '' + elementId: '', + state: 1 }) this.expressionChange() } else { @@ -396,7 +405,8 @@ export default { oldName: item.name, error: '', elementId: item.id, - legend: item.legend + legend: item.legend, + state: item.state } ) } diff --git a/nezha-fronted/src/components/page/config/template/chartTemp.vue b/nezha-fronted/src/components/page/config/template/chartTemp.vue index 7e01a95f4..fa531356a 100644 --- a/nezha-fronted/src/components/page/config/template/chartTemp.vue +++ b/nezha-fronted/src/components/page/config/template/chartTemp.vue @@ -182,7 +182,7 @@ export default { thresholdShow: true, thresholds: [{ value: undefined, color: randomcolor() }] }, - elements: [{ expression: '', legend: '', type: 'expert', id: '', name: 'A' }], + elements: [{ expression: '', legend: '', type: 'expert', id: '', name: 'A', state: 1 }], panel: '', sync: 0, remark: '', diff --git a/nezha-fronted/src/components/page/dashboard/explore/exploreItem.vue b/nezha-fronted/src/components/page/dashboard/explore/exploreItem.vue index 14333f5ad..fba1e53b6 100644 --- a/nezha-fronted/src/components/page/dashboard/explore/exploreItem.vue +++ b/nezha-fronted/src/components/page/dashboard/explore/exploreItem.vue @@ -989,7 +989,7 @@ export default { groupId: -1 } this.expressions.forEach((exp, index) => { - chart.elements.push({ expression: exp, legend: '', type: 'expert', id: '', name: 'A' }) + chart.elements.push({ expression: exp, legend: '', type: 'expert', id: '', name: 'A', state: 1 }) }) this.chartData = chart this.rightBox.show = true @@ -1026,7 +1026,7 @@ export default { remark: '' } this.expressions.forEach((exp, index) => { - chart.elements.push({ expression: exp, legend: '', type: 'expert', id: '', name: 'A' }) + chart.elements.push({ expression: exp, legend: '', type: 'expert', id: '', name: 'A', state: 1 }) }) this.chartData = chart this.rightBox.show = true diff --git a/nezha-fronted/src/components/page/dashboard/panel.vue b/nezha-fronted/src/components/page/dashboard/panel.vue index 0e36736cc..6eed7f54a 100644 --- a/nezha-fronted/src/components/page/dashboard/panel.vue +++ b/nezha-fronted/src/components/page/dashboard/panel.vue @@ -231,7 +231,7 @@ export default { thresholds: [{ value: undefined, color: randomcolor() }], showHeader: 1 }, - elements: [{ expression: '', legend: '', type: 'expert', id: '', name: 'A' }], + elements: [{ expression: '', legend: '', type: 'expert', id: '', name: 'A', state: 1 }], panel: '', sync: 0, remark: '',