NEZ-1991 feat : chart 编辑页面 metric/log 表示式 支持 修改表达式是否启用

This commit is contained in:
likexuan
2022-07-01 16:42:38 +08:00
parent c1e3957f08
commit 7e21a04763
7 changed files with 28 additions and 11 deletions

View File

@@ -228,7 +228,7 @@ export default {
thresholdShow: true, thresholdShow: true,
thresholds: [{ value: undefined, color: randomcolor() }] thresholds: [{ value: undefined, color: randomcolor() }]
}, },
elements: [{ expression: '', legend: '', type: 'expert', id: '', name: 'A' }], elements: [{ expression: '', legend: '', type: 'expert', id: '', name: 'A', state: 1 }],
panel: '', panel: '',
sync: 0, sync: 0,
remark: '', remark: '',

View File

@@ -52,7 +52,14 @@
<div v-if="expressionsShow[index-1].error" class="el-form-item__error" style="top: 10px;left: 164px"> {{expressionsShow[index-1].error}}</div> <div v-if="expressionsShow[index-1].error" class="el-form-item__error" style="top: 10px;left: 164px"> {{expressionsShow[index-1].error}}</div>
</span> </span>
<span> <span>
<span @click="()=>{addExpression()}" style="margin-right: 5px;padding-left: 10px" :title="$t('tip.add')"> <!-- 显示隐藏 -->
<span v-if="expressionsShow[index-1].state === 1" @click="()=>{switchExpression(index - 1,1)}" :title="$t('overall.visible')" style="margin-right: 5px;padding-left: 10px">
<i class="nz-icon nz-icon-mimakejian"></i>
</span>
<span v-else @click="()=>{switchExpression(index - 1,0)}" :title="$t('overall.invisible')" style="margin-right: 5px;padding-left: 10px">
<i class="nz-icon nz-icon-mimabukejian"></i>
</span>
<span @click="()=>{addExpression()}" style="margin-right: 5px" :title="$t('tip.add')">
<i class="nz-icon nz-icon-create-square" style="font-weight: normal; font-size: 17px; cursor: pointer;"></i> <i class="nz-icon nz-icon-create-square" style="font-weight: normal; font-size: 17px; cursor: pointer;"></i>
</span> </span>
<span @click="copyExpression(index - 1)" style="margin-right: 5px" :title="$t('overall.duplicate')"> <span @click="copyExpression(index - 1)" style="margin-right: 5px" :title="$t('overall.duplicate')">

View File

@@ -362,7 +362,7 @@ export default {
type: 'line', type: 'line',
min: 0, min: 0,
max: 100, max: 100,
elements: [{ expression: '', legend: '', type: 'expert', id: '', name: 'A' }], elements: [{ expression: '', legend: '', type: 'expert', id: '', name: 'A', state: 1 }],
param: { param: {
stack: 0, stack: 0,
nullType: 'null', nullType: 'null',
@@ -389,7 +389,7 @@ export default {
legend: true, legend: true,
valueMapping: false valueMapping: false
}, },
elements: [{ expression: '', legend: '', type: 'expert', id: '', name: 'A' }], elements: [{ expression: '', legend: '', type: 'expert', id: '', name: 'A', state: 1 }],
param: { param: {
limit: 100, limit: 100,
showHeader: this.editChart.param.showHeader showHeader: this.editChart.param.showHeader

View File

@@ -329,13 +329,21 @@ 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({ 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 { } else {
this.chartConfig.elements = [] this.chartConfig.elements = []
} }
this.change() 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) { expressionNameChange (index) {
if (this.expressionsShow[index].error) { if (this.expressionsShow[index].error) {
this.expressionName[index] = this.expressionsShow[index].oldName this.expressionName[index] = this.expressionsShow[index].oldName
@@ -383,7 +391,8 @@ export default {
oldName: expressionName, oldName: expressionName,
error: '', error: '',
legend: '', legend: '',
elementId: '' elementId: '',
state: 1
}) })
this.expressionChange() this.expressionChange()
} else { } else {
@@ -396,7 +405,8 @@ export default {
oldName: item.name, oldName: item.name,
error: '', error: '',
elementId: item.id, elementId: item.id,
legend: item.legend legend: item.legend,
state: item.state
} }
) )
} }

View File

@@ -182,7 +182,7 @@ export default {
thresholdShow: true, thresholdShow: true,
thresholds: [{ value: undefined, color: randomcolor() }] thresholds: [{ value: undefined, color: randomcolor() }]
}, },
elements: [{ expression: '', legend: '', type: 'expert', id: '', name: 'A' }], elements: [{ expression: '', legend: '', type: 'expert', id: '', name: 'A', state: 1 }],
panel: '', panel: '',
sync: 0, sync: 0,
remark: '', remark: '',

View File

@@ -989,7 +989,7 @@ export default {
groupId: -1 groupId: -1
} }
this.expressions.forEach((exp, index) => { 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.chartData = chart
this.rightBox.show = true this.rightBox.show = true
@@ -1026,7 +1026,7 @@ export default {
remark: '' remark: ''
} }
this.expressions.forEach((exp, index) => { 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.chartData = chart
this.rightBox.show = true this.rightBox.show = true

View File

@@ -231,7 +231,7 @@ export default {
thresholds: [{ value: undefined, color: randomcolor() }], thresholds: [{ value: undefined, color: randomcolor() }],
showHeader: 1 showHeader: 1
}, },
elements: [{ expression: '', legend: '', type: 'expert', id: '', name: 'A' }], elements: [{ expression: '', legend: '', type: 'expert', id: '', name: 'A', state: 1 }],
panel: '', panel: '',
sync: 0, sync: 0,
remark: '', remark: '',