Merge pull request #9327 from dataease/pr@dev@fix_formatter_cfg_edit

fix(视图): 修复编辑单个指标的数值格式化时其他指标也受影响 #9126
This commit is contained in:
wisonic-s 2024-04-25 11:59:02 +08:00 committed by GitHub
commit 4f0af1913b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3708,7 +3708,9 @@ export default {
this.showValueFormatter = false
},
saveValueFormatter() {
const ele = this.valueFormatterItem.formatterCfg.decimalCount
const formatterItem = _.cloneDeep(this.valueFormatterItem)
const formatterCfg = formatterItem.formatterCfg
const ele = formatterCfg.decimalCount
if (ele === undefined || ele.toString().indexOf('.') > -1 || parseInt(ele).toString() === 'NaN' || parseInt(ele) < 0 || parseInt(ele) > 10) {
this.$message({
message: this.$t('chart.formatter_decimal_count_error'),
@ -3718,14 +3720,14 @@ export default {
return
}
//
if (this.valueFormatterItem.formatterType === 'quota' && this.chart.type !== 'bar-time-range') {
this.view.yaxis[this.valueFormatterItem.index].formatterCfg = this.valueFormatterItem.formatterCfg
} else if (this.valueFormatterItem.formatterType === 'quotaExt') {
this.view.yaxisExt[this.valueFormatterItem.index].formatterCfg = this.valueFormatterItem.formatterCfg
} else if (this.valueFormatterItem.formatterType === 'dimension') {
this.view.xaxis[this.valueFormatterItem.index].formatterCfg = this.valueFormatterItem.formatterCfg
if (formatterItem.formatterType === 'quota' && this.chart.type !== 'bar-time-range') {
this.view.yaxis[formatterItem.index].formatterCfg = formatterCfg
} else if (formatterItem.formatterType === 'quotaExt') {
this.view.yaxisExt[formatterItem.index].formatterCfg = formatterCfg
} else if (formatterItem.formatterType === 'dimension') {
this.view.xaxis[formatterItem.index].formatterCfg = formatterCfg
} else if (this.chart.type === 'bar-time-range') {
this.view.xaxisExt[this.valueFormatterItem.index].formatterCfg = this.valueFormatterItem.formatterCfg
this.view.xaxisExt[formatterItem.index].formatterCfg = formatterCfg
}
this.calcData(true)
this.closeValueFormatter()