NEZ-2727 fix:Chart Metric 复制&预览异常

This commit is contained in:
zhangyu
2023-03-24 14:06:08 +08:00
parent 374bc8a73b
commit cdaa47e84c
2 changed files with 12 additions and 26 deletions

View File

@@ -33,7 +33,7 @@
class="element-item form-row-item thresholds-from-item" class="element-item form-row-item thresholds-from-item"
style="margin-bottom: 10px !important" style="margin-bottom: 10px !important"
v-for="index of chartConfig.elements.length" v-for="index of chartConfig.elements.length"
:key="index" :key="expressionName[index-1] + index"
> >
<div class="chart-title chart-title-config"> <div class="chart-title chart-title-config">
<span class="chart-title-content el-form-item" :class="{ <span class="chart-title-content el-form-item" :class="{

View File

@@ -386,15 +386,17 @@ export default {
if (this.expressions.length) { if (this.expressions.length) {
this.chartConfig.elements = [] this.chartConfig.elements = []
this.expressions.forEach((expr, i) => { this.expressions.forEach((expr, i) => {
this.chartConfig.elements.push({ if (this.expressionsShow[i]) {
id: this.expressionsShow[i].elementId, this.chartConfig.elements.push({
expression: expr, id: this.expressionsShow[i].elementId,
type: 'expert', expression: expr,
legend: this.expressionsShow[i].legend, type: 'expert',
name: this.expressionName[i], legend: this.expressionsShow[i].legend,
state: this.expressionsShow[i].state, name: this.expressionName[i],
orderNum: i state: this.expressionsShow[i].state,
}) orderNum: i
})
}
}) })
} else { } else {
this.chartConfig.elements = [] this.chartConfig.elements = []
@@ -500,14 +502,6 @@ export default {
elementId: '' elementId: ''
} }
) )
this.$nextTick(() => {
this.expressions.forEach((ex, index) => {
if (ex) {
this.$refs[`promql-${index}`][0].metricChange(ex)
this.$refs[`promql-${index}`][0].promqlInputChange(ex)
}
})
})
this.expressionChange() this.expressionChange()
}, },
removeExpression (index) { removeExpression (index) {
@@ -518,14 +512,6 @@ export default {
this.chartConfig.elements.forEach((item, index) => { this.chartConfig.elements.forEach((item, index) => {
this.$refs.chartForm.validateField('elements.' + index + '.expression') this.$refs.chartForm.validateField('elements.' + index + '.expression')
}) })
this.$nextTick(() => {
this.expressions.forEach((ex, index) => {
if (ex) {
this.$refs[`promql-${index}`][0].metricChange(ex)
this.$refs[`promql-${index}`][0].promqlInputChange(ex)
}
})
})
this.expressionChange() this.expressionChange()
} }
}, },