forked from github/dataease
feat(图表): 富文本视图支持指数格式化 #7444
This commit is contained in:
parent
6ff51a142a
commit
395acafeda
@ -55,6 +55,7 @@ import { storeToRefs } from 'pinia'
|
|||||||
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
|
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
|
||||||
import ChartError from '@/views/chart/components/views/components/ChartError.vue'
|
import ChartError from '@/views/chart/components/views/components/ChartError.vue'
|
||||||
import { useEmitt } from '@/hooks/web/useEmitt'
|
import { useEmitt } from '@/hooks/web/useEmitt'
|
||||||
|
import { valueFormatter } from '@/views/chart/components/js/formatter'
|
||||||
const snapshotStore = snapshotStoreWithOut()
|
const snapshotStore = snapshotStoreWithOut()
|
||||||
const errMsg = ref('')
|
const errMsg = ref('')
|
||||||
const dvMainStore = dvMainStoreWithOut()
|
const dvMainStore = dvMainStoreWithOut()
|
||||||
@ -389,9 +390,18 @@ const initCurFields = chartDetails => {
|
|||||||
yDataeaseNamesCfg[yItem.dataeaseName] = yItem.formatterCfg
|
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) {
|
for (const key in rowData) {
|
||||||
dataRowSelect.value[nameIdMap[key]] = rowData[key]
|
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
|
element.value.propValue['innerType'] = chartDetails.type
|
||||||
|
@ -82,7 +82,7 @@ watch(
|
|||||||
},
|
},
|
||||||
{ deep: true }
|
{ 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>(() => {
|
const showValueFormatter = computed<boolean>(() => {
|
||||||
return (
|
return (
|
||||||
AXIS_FORMAT_VIEW.includes(props.chart.type) &&
|
AXIS_FORMAT_VIEW.includes(props.chart.type) &&
|
||||||
|
Loading…
Reference in New Issue
Block a user