From 59de26b118959b37963957db093a8097a74f3440 Mon Sep 17 00:00:00 2001 From: zdl <3489966805@qq.com> Date: Mon, 29 Dec 2025 15:01:37 +0800 Subject: [PATCH] =?UTF-8?q?fix(MainBusinessAnalysis):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=8E=86=E5=8F=B2=E5=AF=B9=E6=AF=94=E8=A1=A8=E6=A0=BC=E5=88=97?= =?UTF-8?q?=E6=A0=87=E9=A2=98=E5=92=8C=E8=BE=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 简化报告类型显示:2024年三季报 -> 24Q3 - 缩小列宽,支持更好的横向滚动 - 移除外层边框和圆角,减少视觉干扰 - 业务列添加 ellipsis 省略过长内容 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../components/MainBusinessAnalysis.tsx | 53 ++++++++++++------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/src/views/Company/components/FinancialPanorama/components/MainBusinessAnalysis.tsx b/src/views/Company/components/FinancialPanorama/components/MainBusinessAnalysis.tsx index f3d7da2d..7806416a 100644 --- a/src/views/Company/components/FinancialPanorama/components/MainBusinessAnalysis.tsx +++ b/src/views/Company/components/FinancialPanorama/components/MainBusinessAnalysis.tsx @@ -88,19 +88,35 @@ interface HistoricalRowData { } // 历史对比表格组件(整合业务明细) -interface HistoricalComparisonTableProps { +export interface HistoricalComparisonTableProps { historicalData: (ProductClassification | IndustryClassification)[]; businessItems: BusinessItem[]; hasProductData: boolean; latestReportType: string; + /** 是否隐藏标题(用于弹窗中避免重复) */ + hideTitle?: boolean; } -const HistoricalComparisonTable: React.FC = ({ +export const HistoricalComparisonTable: React.FC = ({ historicalData, businessItems, hasProductData, latestReportType, + hideTitle = false, }) => { + // 简化报告类型显示(2024年三季报 -> 24Q3) + const formatReportType = (reportType: string): string => { + const match = reportType.match(/(\d{4})年(.+)/); + if (!match) return reportType; + const year = match[1].slice(2); // 2024 -> 24 + const type = match[2]; + if (type.includes('一季')) return `${year}Q1`; + if (type.includes('中报') || type.includes('半年')) return `${year}Q2`; + if (type.includes('三季')) return `${year}Q3`; + if (type.includes('年报')) return `${year}Y`; + return `${year}`; + }; + // 动态生成列配置 const columns: ColumnsType = useMemo(() => { const cols: ColumnsType = [ @@ -109,23 +125,24 @@ const HistoricalComparisonTable: React.FC = ({ dataIndex: 'business', key: 'business', fixed: 'left', - width: 150, + width: 120, + ellipsis: true, }, { - title: `毛利率(${latestReportType})`, + title: `毛利率`, dataIndex: 'grossMargin', key: 'grossMargin', align: 'right', - width: 120, + width: 80, render: (value: number | undefined) => value !== undefined ? formatUtils.formatPercent(value) : '-', }, { - title: `利润(${latestReportType})`, + title: `利润`, dataIndex: 'profit', key: 'profit', align: 'right', - width: 100, + width: 90, render: (value: number | undefined) => value !== undefined ? formatUtils.formatLargeNumber(value) : '-', }, @@ -133,12 +150,13 @@ const HistoricalComparisonTable: React.FC = ({ // 添加各期间营收列 historicalData.slice(0, 4).forEach((period) => { + const shortPeriod = formatReportType(period.report_type); cols.push({ - title: `营收(${period.report_type})`, + title: shortPeriod, dataIndex: period.period, key: period.period, align: 'right', - width: 120, + width: 90, render: (value: number | string | undefined) => value !== undefined && value !== '-' ? formatUtils.formatLargeNumber(value as number) @@ -179,20 +197,19 @@ const HistoricalComparisonTable: React.FC = ({ return ( - - - 主营业务明细与历史对比 - - - + {!hideTitle && ( + + + 主营业务明细与历史对比 + + + )} + columns={columns}