Skip to content

Commit

Permalink
Merge pull request #9327 from dataease/pr@dev@fix_formatter_cfg_edit
Browse files Browse the repository at this point in the history
fix(视图): 修复编辑单个指标的数值格式化时其他指标也受影响 #9126
  • Loading branch information
wisonic-s committed Apr 25, 2024
2 parents 1eecb50 + d66c747 commit 4f0af19
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions core/frontend/src/views/chart/view/ChartEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand All @@ -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()
Expand Down

0 comments on commit 4f0af19

Please sign in to comment.