forked from github/dataease
Merge pull request #8065 from dataease/pr@dev-v2@feat——rich-text
feat(图表): 富文本视图支持指数格式化 #7444
This commit is contained in:
commit
d1406a3686
@ -55,6 +55,7 @@ import { storeToRefs } from 'pinia'
|
||||
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
|
||||
import ChartError from '@/views/chart/components/views/components/ChartError.vue'
|
||||
import { useEmitt } from '@/hooks/web/useEmitt'
|
||||
import { valueFormatter } from '@/views/chart/components/js/formatter'
|
||||
const snapshotStore = snapshotStoreWithOut()
|
||||
const errMsg = ref('')
|
||||
const dvMainStore = dvMainStoreWithOut()
|
||||
@ -389,9 +390,18 @@ const initCurFields = chartDetails => {
|
||||
yDataeaseNamesCfg[yItem.dataeaseName] = yItem.formatterCfg
|
||||
})
|
||||
}
|
||||
const valueFieldMap: Record<string, Axis> = chartDetails.yAxis.reduce((p, n) => {
|
||||
p[n.dataeaseName] = n
|
||||
return p
|
||||
}, {})
|
||||
for (const key in rowData) {
|
||||
dataRowSelect.value[nameIdMap[key]] = rowData[key]
|
||||
dataRowNameSelect.value[sourceFieldNameIdMap[key]] = rowData[key]
|
||||
let rowDataValue = rowData[key]
|
||||
const f = valueFieldMap[key]
|
||||
if (f && f.formatterCfg) {
|
||||
rowDataValue = valueFormatter(rowDataValue, f.formatterCfg)
|
||||
}
|
||||
dataRowNameSelect.value[sourceFieldNameIdMap[key]] = rowDataValue
|
||||
}
|
||||
}
|
||||
element.value.propValue['innerType'] = chartDetails.type
|
||||
|
@ -82,7 +82,7 @@ watch(
|
||||
},
|
||||
{ deep: true }
|
||||
)
|
||||
const AXIS_FORMAT_VIEW = ['table-normal', 'table-info', 'table-pivot', 'indicator']
|
||||
const AXIS_FORMAT_VIEW = ['table-normal', 'table-info', 'table-pivot', 'indicator', 'rich-text']
|
||||
const showValueFormatter = computed<boolean>(() => {
|
||||
return (
|
||||
AXIS_FORMAT_VIEW.includes(props.chart.type) &&
|
||||
|
Loading…
Reference in New Issue
Block a user