diff --git a/src/App.tsx b/src/App.tsx index 72c83d6..22a44f3 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -168,18 +168,6 @@ const defaultTemplateFilterNode = { label: '默认模板', } as const; const overallSummaryKey = 'summary'; -const pivotGridWanValueFields = new Set([ - 'lowValue', - 'centerValue', - 'highValue', - 'maxValue', - 'minValue', - 'avgValue', - 'medianValue', - 'standardDeviation', - 'interquartileRange', -]); - // const mockGeoLocationPayload = { // checkStrictly: true, // type: 3, @@ -301,9 +289,6 @@ function formatNumber(value: number, maximumFractionDigits: number) { function formatCostValue(value: number) { const absValue = Math.abs(value); - if (absValue >= 10000) { - return `${formatNumber(value / 10000, 2)}万元`; - } const fractionDigits = absValue > 0 && absValue < 1 ? 4 : 2; return `${formatNumber(value, fractionDigits)}元`; } @@ -324,16 +309,7 @@ function formatChartValue(value: number, metricKey: MetricKey) { return formatAreaMetricValue(value); } -function formatGridWanValue(value: number) { - const wanValue = value / 10000; - const fractionDigits = Math.abs(wanValue) > 0 && Math.abs(wanValue) < 1 ? 4 : 2; - return formatNumber(wanValue, fractionDigits); -} - function formatGridMetricValue(value: number, metricKey: MetricKey) { - if (metricKey === 'cost') { - return formatGridWanValue(value); - } const absValue = Math.abs(value); const fractionDigits = absValue > 0 && absValue < 1 ? 4 : 2; return formatNumber(value, fractionDigits); @@ -1102,7 +1078,7 @@ function App() { ); const pivotGridColumnDefs = useMemo<(ColDef | ColGroupDef)[]>( () => { - const valueUnit = requestMetricKey === 'cost' ? '万元' : '元/m²'; + const valueUnit = requestMetricKey === 'cost' ? '元' : '元/m²'; const valueColumnMinWidth = requestMetricKey === 'cost' ? 112 : 142; const valueFormatter = ({ value }: ValueFormatterParams) => ( value == null ? '' : formatGridMetricValue(Number(value), requestMetricKey) @@ -1231,12 +1207,6 @@ function App() { const exportPivotGrid = useCallback(() => { pivotGridApiRef.current?.exportDataAsCsv({ fileName: '建筑设施对象统计表.csv', - processCellCallback: ({ column, value }) => { - if (value == null) return ''; - return pivotGridWanValueFields.has(column.getColId()) - ? String(Number(value) / 10000) - : String(value); - }, }); setGridContextMenuPosition(null); }, []);