From 395acafedac68de14212f76c5cdb9f47b16cb640 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Mon, 19 Feb 2024 19:00:47 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=9B=BE=E8=A1=A8):=20=E5=AF=8C=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E8=A7=86=E5=9B=BE=E6=94=AF=E6=8C=81=E6=8C=87=E6=95=B0?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96=20#7444?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../custom-component/rich-text/DeRichTextView.vue | 12 +++++++++++- .../chart/components/editor/drag-item/QuotaItem.vue | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/core/core-frontend/src/custom-component/rich-text/DeRichTextView.vue b/core/core-frontend/src/custom-component/rich-text/DeRichTextView.vue index 5c190c4138..f0f775f939 100644 --- a/core/core-frontend/src/custom-component/rich-text/DeRichTextView.vue +++ b/core/core-frontend/src/custom-component/rich-text/DeRichTextView.vue @@ -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 = 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 diff --git a/core/core-frontend/src/views/chart/components/editor/drag-item/QuotaItem.vue b/core/core-frontend/src/views/chart/components/editor/drag-item/QuotaItem.vue index acc6bbe4d2..48d25deff0 100644 --- a/core/core-frontend/src/views/chart/components/editor/drag-item/QuotaItem.vue +++ b/core/core-frontend/src/views/chart/components/editor/drag-item/QuotaItem.vue @@ -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(() => { return ( AXIS_FORMAT_VIEW.includes(props.chart.type) &&