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"
style="margin-bottom: 10px !important"
v-for="index of chartConfig.elements.length"
:key="index"
:key="expressionName[index-1] + index"
>
<div class="chart-title chart-title-config">
<span class="chart-title-content el-form-item" :class="{

View File

@@ -386,15 +386,17 @@ 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],
state: this.expressionsShow[i].state,
orderNum: i
})
if (this.expressionsShow[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,
orderNum: i
})
}
})
} else {
this.chartConfig.elements = []
@@ -500,14 +502,6 @@ export default {
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()
},
removeExpression (index) {
@@ -518,14 +512,6 @@ export default {
this.chartConfig.elements.forEach((item, index) => {
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()
}
},