Merge pull request #7143 from dataease/pr@dev-v2@fix_table_normal_desensitization

fix(视图-汇总表): 脱敏字段显示不正确。
This commit is contained in:
wisonic-s 2023-12-13 16:44:12 +08:00 committed by GitHub
commit c035461bd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 13 deletions

View File

@ -4,6 +4,7 @@ import { parseJson } from '../../../util'
import { S2ChartView, S2DrawOptions } from '../../types/impl/s2' import { S2ChartView, S2DrawOptions } from '../../types/impl/s2'
import { TABLE_EDITOR_PROPERTY, TABLE_EDITOR_PROPERTY_INNER } from './common' import { TABLE_EDITOR_PROPERTY, TABLE_EDITOR_PROPERTY_INNER } from './common'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { isNumber } from 'lodash-es'
const { t } = useI18n() const { t } = useI18n()
@ -70,17 +71,14 @@ export class TableInfo extends S2ChartView<TableSheet> {
if (value === null || value === undefined) { if (value === null || value === undefined) {
return value return value
} }
if (f.groupType === 'd') { if (f.groupType === 'd' || !isNumber(value)) {
return value return value
} else {
if (f.formatterCfg) {
const v = valueFormatter(value, f.formatterCfg)
return v.includes('NaN') ? value : v
} else {
const v = valueFormatter(value, formatterItem)
return v.includes('NaN') ? value : v
}
} }
let formatCfg = f.formatterCfg
if (!formatCfg) {
formatCfg = formatterItem
}
return valueFormatter(value, formatCfg)
} }
}) })
}) })

View File

@ -5,6 +5,7 @@ import { formatterItem, valueFormatter } from '@/views/chart/components/js/forma
import { getCurrentField } from '@/views/chart/components/js/panel/common/common_table' import { getCurrentField } from '@/views/chart/components/js/panel/common/common_table'
import { TABLE_EDITOR_PROPERTY, TABLE_EDITOR_PROPERTY_INNER } from './common' import { TABLE_EDITOR_PROPERTY, TABLE_EDITOR_PROPERTY_INNER } from './common'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { isNumber } from 'lodash-es'
const { t } = useI18n() const { t } = useI18n()
/** /**
@ -70,11 +71,14 @@ export class TableNormal extends S2ChartView<TableSheet> {
if (value === null || value === undefined) { if (value === null || value === undefined) {
return value return value
} }
if (f.formatterCfg) { if (f.groupType === 'd' || !isNumber(value)) {
return valueFormatter(value, f.formatterCfg) return value
} else {
return valueFormatter(value, formatterItem)
} }
let formatCfg = f.formatterCfg
if (!formatCfg) {
formatCfg = formatterItem
}
return valueFormatter(value, formatCfg)
} }
}) })
}) })