This commit is contained in:
wintsa 2026-08-21 14:39:39 +08:00
parent 3a4e7d73bc
commit f2b99c3e54
5 changed files with 18 additions and 31 deletions

View File

@ -0,0 +1,8 @@
{
"topic_20260821-062201_c21eb2dbea49a53e": {
"stage": 1,
"userTurns": 1,
"basisHash": "10579074257f2c51",
"updatedAt": 1787293862779
}
}

View File

@ -0,0 +1,3 @@
{
"topic_20260821-062201_c21eb2dbea49a53e": 1787293321185
}

View File

@ -0,0 +1,3 @@
{
"topic_20260821-062201_c21eb2dbea49a53e": "auto"
}

View File

@ -0,0 +1,3 @@
{
"topic_20260821-062201_c21eb2dbea49a53e": "aggrid导出的时候数值不对现在…"
}

View File

@ -147,18 +147,6 @@ const defaultTemplateFilterNode = {
label: '默认模板', label: '默认模板',
} as const; } as const;
const overallSummaryKey = 'summary'; const overallSummaryKey = 'summary';
const pivotGridWanValueFields = new Set([
'lowValue',
'centerValue',
'highValue',
'maxValue',
'minValue',
'avgValue',
'medianValue',
'standardDeviation',
'interquartileRange',
]);
// const mockGeoLocationPayload = { // const mockGeoLocationPayload = {
// checkStrictly: true, // checkStrictly: true,
// type: 3, // type: 3,
@ -279,9 +267,6 @@ function formatNumber(value: number, maximumFractionDigits: number) {
function formatCostValue(value: number) { function formatCostValue(value: number) {
const absValue = Math.abs(value); const absValue = Math.abs(value);
if (absValue >= 10000) {
return `${formatNumber(value / 10000, 2)}万元`;
}
const fractionDigits = absValue > 0 && absValue < 1 ? 4 : 2; const fractionDigits = absValue > 0 && absValue < 1 ? 4 : 2;
return `${formatNumber(value, fractionDigits)}`; return `${formatNumber(value, fractionDigits)}`;
} }
@ -302,16 +287,7 @@ function formatChartValue(value: number, metricKey: MetricKey) {
return formatAreaMetricValue(value); 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) { function formatGridMetricValue(value: number, metricKey: MetricKey) {
if (metricKey === 'cost') {
return formatGridWanValue(value);
}
const absValue = Math.abs(value); const absValue = Math.abs(value);
const fractionDigits = absValue > 0 && absValue < 1 ? 4 : 2; const fractionDigits = absValue > 0 && absValue < 1 ? 4 : 2;
return formatNumber(value, fractionDigits); return formatNumber(value, fractionDigits);
@ -1070,7 +1046,7 @@ function App() {
); );
const pivotGridColumnDefs = useMemo<(ColDef<PivotGridRow> | ColGroupDef<PivotGridRow>)[]>( const pivotGridColumnDefs = useMemo<(ColDef<PivotGridRow> | ColGroupDef<PivotGridRow>)[]>(
() => { () => {
const valueUnit = requestMetricKey === 'cost' ? '元' : '元/m²'; const valueUnit = requestMetricKey === 'cost' ? '元' : '元/m²';
const valueColumnMinWidth = requestMetricKey === 'cost' ? 112 : 142; const valueColumnMinWidth = requestMetricKey === 'cost' ? 112 : 142;
const valueFormatter = ({ value }: ValueFormatterParams<PivotGridRow, number | null>) => ( const valueFormatter = ({ value }: ValueFormatterParams<PivotGridRow, number | null>) => (
value == null ? '' : formatGridMetricValue(Number(value), requestMetricKey) value == null ? '' : formatGridMetricValue(Number(value), requestMetricKey)
@ -1199,12 +1175,6 @@ function App() {
const exportPivotGrid = useCallback(() => { const exportPivotGrid = useCallback(() => {
pivotGridApiRef.current?.exportDataAsCsv({ pivotGridApiRef.current?.exportDataAsCsv({
fileName: '组团统计表.csv', fileName: '组团统计表.csv',
processCellCallback: ({ column, value }) => {
if (value == null) return '';
return pivotGridWanValueFields.has(column.getColId())
? String(Number(value) / 10000)
: String(value);
},
}); });
setGridContextMenuPosition(null); setGridContextMenuPosition(null);
}, []); }, []);