From a424b3338db93dd27e75ad6a8bf87045dd249125 Mon Sep 17 00:00:00 2001 From: zdl <3489966805@qq.com> Date: Fri, 12 Dec 2025 15:00:51 +0800 Subject: [PATCH] =?UTF-8?q?refactor(FinancialPanorama):=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=B8=B8=E9=87=8F=E9=85=8D=E7=BD=AE=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 颜色配置:中国市场红涨绿跌 - 资产负债表指标:7个分类(流动/非流动资产、负债、权益) - 利润表指标:6个分类(营收、成本、其他收益、利润、EPS、综合收益) - 现金流量表指标:8个核心指标 - 财务指标分类:7大类(盈利、每股、成长、运营、偿债、费用、现金流) - 行业排名和对比指标配置 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../components/FinancialPanorama/constants.ts | 341 ++++++++++++++++++ 1 file changed, 341 insertions(+) create mode 100644 src/views/Company/components/FinancialPanorama/constants.ts diff --git a/src/views/Company/components/FinancialPanorama/constants.ts b/src/views/Company/components/FinancialPanorama/constants.ts new file mode 100644 index 00000000..8ae0e15a --- /dev/null +++ b/src/views/Company/components/FinancialPanorama/constants.ts @@ -0,0 +1,341 @@ +/** + * FinancialPanorama 常量配置 + */ + +import type { MetricSectionConfig, MetricsCategoryMap } from './types'; + +// ==================== 颜色配置 ==================== + +/** 中国市场颜色:红涨绿跌 */ +export const COLORS = { + positiveColor: 'red.500', // 涨 + negativeColor: 'green.500', // 跌 + bgColor: 'white', + borderColor: 'gray.200', + hoverBg: 'gray.50', +} as const; + +// ==================== 资产负债表指标定义 ==================== + +/** 流动资产指标 */ +export const CURRENT_ASSETS_METRICS: MetricSectionConfig = { + title: '流动资产', + key: 'currentAssets', + metrics: [ + { name: '货币资金', key: 'cash', path: 'assets.current_assets.cash', isCore: true }, + { name: '交易性金融资产', key: 'trading_financial_assets', path: 'assets.current_assets.trading_financial_assets' }, + { name: '应收票据', key: 'notes_receivable', path: 'assets.current_assets.notes_receivable' }, + { name: '应收账款', key: 'accounts_receivable', path: 'assets.current_assets.accounts_receivable', isCore: true }, + { name: '预付款项', key: 'prepayments', path: 'assets.current_assets.prepayments' }, + { name: '其他应收款', key: 'other_receivables', path: 'assets.current_assets.other_receivables' }, + { name: '存货', key: 'inventory', path: 'assets.current_assets.inventory', isCore: true }, + { name: '合同资产', key: 'contract_assets', path: 'assets.current_assets.contract_assets' }, + { name: '其他流动资产', key: 'other_current_assets', path: 'assets.current_assets.other_current_assets' }, + { name: '流动资产合计', key: 'total_current_assets', path: 'assets.current_assets.total', isTotal: true }, + ], +}; + +/** 非流动资产指标 */ +export const NON_CURRENT_ASSETS_METRICS: MetricSectionConfig = { + title: '非流动资产', + key: 'nonCurrentAssets', + metrics: [ + { name: '长期股权投资', key: 'long_term_equity_investments', path: 'assets.non_current_assets.long_term_equity_investments' }, + { name: '投资性房地产', key: 'investment_property', path: 'assets.non_current_assets.investment_property' }, + { name: '固定资产', key: 'fixed_assets', path: 'assets.non_current_assets.fixed_assets', isCore: true }, + { name: '在建工程', key: 'construction_in_progress', path: 'assets.non_current_assets.construction_in_progress' }, + { name: '使用权资产', key: 'right_of_use_assets', path: 'assets.non_current_assets.right_of_use_assets' }, + { name: '无形资产', key: 'intangible_assets', path: 'assets.non_current_assets.intangible_assets', isCore: true }, + { name: '商誉', key: 'goodwill', path: 'assets.non_current_assets.goodwill', isCore: true }, + { name: '递延所得税资产', key: 'deferred_tax_assets', path: 'assets.non_current_assets.deferred_tax_assets' }, + { name: '其他非流动资产', key: 'other_non_current_assets', path: 'assets.non_current_assets.other_non_current_assets' }, + { name: '非流动资产合计', key: 'total_non_current_assets', path: 'assets.non_current_assets.total', isTotal: true }, + ], +}; + +/** 资产总计指标 */ +export const TOTAL_ASSETS_METRICS: MetricSectionConfig = { + title: '资产总计', + key: 'totalAssets', + metrics: [ + { name: '资产总计', key: 'total_assets', path: 'assets.total', isTotal: true, isCore: true }, + ], +}; + +/** 流动负债指标 */ +export const CURRENT_LIABILITIES_METRICS: MetricSectionConfig = { + title: '流动负债', + key: 'currentLiabilities', + metrics: [ + { name: '短期借款', key: 'short_term_borrowings', path: 'liabilities.current_liabilities.short_term_borrowings', isCore: true }, + { name: '应付票据', key: 'notes_payable', path: 'liabilities.current_liabilities.notes_payable' }, + { name: '应付账款', key: 'accounts_payable', path: 'liabilities.current_liabilities.accounts_payable', isCore: true }, + { name: '预收款项', key: 'advance_receipts', path: 'liabilities.current_liabilities.advance_receipts' }, + { name: '合同负债', key: 'contract_liabilities', path: 'liabilities.current_liabilities.contract_liabilities' }, + { name: '应付职工薪酬', key: 'employee_compensation_payable', path: 'liabilities.current_liabilities.employee_compensation_payable' }, + { name: '应交税费', key: 'taxes_payable', path: 'liabilities.current_liabilities.taxes_payable' }, + { name: '其他应付款', key: 'other_payables', path: 'liabilities.current_liabilities.other_payables' }, + { name: '一年内到期的非流动负债', key: 'non_current_due_within_one_year', path: 'liabilities.current_liabilities.non_current_liabilities_due_within_one_year' }, + { name: '流动负债合计', key: 'total_current_liabilities', path: 'liabilities.current_liabilities.total', isTotal: true }, + ], +}; + +/** 非流动负债指标 */ +export const NON_CURRENT_LIABILITIES_METRICS: MetricSectionConfig = { + title: '非流动负债', + key: 'nonCurrentLiabilities', + metrics: [ + { name: '长期借款', key: 'long_term_borrowings', path: 'liabilities.non_current_liabilities.long_term_borrowings', isCore: true }, + { name: '应付债券', key: 'bonds_payable', path: 'liabilities.non_current_liabilities.bonds_payable' }, + { name: '租赁负债', key: 'lease_liabilities', path: 'liabilities.non_current_liabilities.lease_liabilities' }, + { name: '递延所得税负债', key: 'deferred_tax_liabilities', path: 'liabilities.non_current_liabilities.deferred_tax_liabilities' }, + { name: '其他非流动负债', key: 'other_non_current_liabilities', path: 'liabilities.non_current_liabilities.other_non_current_liabilities' }, + { name: '非流动负债合计', key: 'total_non_current_liabilities', path: 'liabilities.non_current_liabilities.total', isTotal: true }, + ], +}; + +/** 负债合计指标 */ +export const TOTAL_LIABILITIES_METRICS: MetricSectionConfig = { + title: '负债合计', + key: 'totalLiabilities', + metrics: [ + { name: '负债合计', key: 'total_liabilities', path: 'liabilities.total', isTotal: true, isCore: true }, + ], +}; + +/** 股东权益指标 */ +export const EQUITY_METRICS: MetricSectionConfig = { + title: '股东权益', + key: 'equity', + metrics: [ + { name: '股本', key: 'share_capital', path: 'equity.share_capital', isCore: true }, + { name: '资本公积', key: 'capital_reserve', path: 'equity.capital_reserve' }, + { name: '盈余公积', key: 'surplus_reserve', path: 'equity.surplus_reserve' }, + { name: '未分配利润', key: 'undistributed_profit', path: 'equity.undistributed_profit', isCore: true }, + { name: '库存股', key: 'treasury_stock', path: 'equity.treasury_stock' }, + { name: '其他综合收益', key: 'other_comprehensive_income', path: 'equity.other_comprehensive_income' }, + { name: '归属母公司股东权益', key: 'parent_company_equity', path: 'equity.parent_company_equity', isCore: true }, + { name: '少数股东权益', key: 'minority_interests', path: 'equity.minority_interests' }, + { name: '股东权益合计', key: 'total_equity', path: 'equity.total', isTotal: true, isCore: true }, + ], +}; + +/** 资产负债表所有分类 */ +export const BALANCE_SHEET_SECTIONS = { + assets: [CURRENT_ASSETS_METRICS, NON_CURRENT_ASSETS_METRICS, TOTAL_ASSETS_METRICS], + liabilities: [CURRENT_LIABILITIES_METRICS, NON_CURRENT_LIABILITIES_METRICS, TOTAL_LIABILITIES_METRICS], + equity: [EQUITY_METRICS], +}; + +// ==================== 利润表指标定义 ==================== + +export const INCOME_STATEMENT_SECTIONS: MetricSectionConfig[] = [ + { + title: '营业收入', + key: 'revenue', + metrics: [ + { name: '营业总收入', key: 'total_revenue', path: 'revenue.total_operating_revenue', isCore: true }, + { name: '营业收入', key: 'revenue', path: 'revenue.operating_revenue', isCore: true }, + { name: '其他业务收入', key: 'other_income', path: 'revenue.other_income' }, + ], + }, + { + title: '营业成本与费用', + key: 'costs', + metrics: [ + { name: '营业总成本', key: 'total_cost', path: 'costs.total_operating_cost', isTotal: true }, + { name: '营业成本', key: 'cost', path: 'costs.operating_cost', isCore: true }, + { name: '税金及附加', key: 'taxes_and_surcharges', path: 'costs.taxes_and_surcharges' }, + { name: '销售费用', key: 'selling_expenses', path: 'costs.selling_expenses', isCore: true }, + { name: '管理费用', key: 'admin_expenses', path: 'costs.admin_expenses', isCore: true }, + { name: '研发费用', key: 'rd_expenses', path: 'costs.rd_expenses', isCore: true }, + { name: '财务费用', key: 'financial_expenses', path: 'costs.financial_expenses' }, + { name: ' 其中:利息费用', key: 'interest_expense', path: 'costs.interest_expense' }, + { name: '    利息收入', key: 'interest_income', path: 'costs.interest_income' }, + { name: '三费合计', key: 'three_expenses', path: 'costs.three_expenses_total', isSubtotal: true }, + { name: '四费合计(含研发)', key: 'four_expenses', path: 'costs.four_expenses_total', isSubtotal: true }, + { name: '资产减值损失', key: 'asset_impairment', path: 'costs.asset_impairment_loss' }, + { name: '信用减值损失', key: 'credit_impairment', path: 'costs.credit_impairment_loss' }, + ], + }, + { + title: '其他收益', + key: 'otherGains', + metrics: [ + { name: '公允价值变动收益', key: 'fair_value_change', path: 'other_gains.fair_value_change' }, + { name: '投资收益', key: 'investment_income', path: 'other_gains.investment_income', isCore: true }, + { name: ' 其中:对联营企业和合营企业的投资收益', key: 'investment_income_associates', path: 'other_gains.investment_income_from_associates' }, + { name: '汇兑收益', key: 'exchange_income', path: 'other_gains.exchange_income' }, + { name: '资产处置收益', key: 'asset_disposal_income', path: 'other_gains.asset_disposal_income' }, + ], + }, + { + title: '利润', + key: 'profits', + metrics: [ + { name: '营业利润', key: 'operating_profit', path: 'profit.operating_profit', isCore: true, isTotal: true }, + { name: '加:营业外收入', key: 'non_operating_income', path: 'non_operating.non_operating_income' }, + { name: '减:营业外支出', key: 'non_operating_expenses', path: 'non_operating.non_operating_expenses' }, + { name: '利润总额', key: 'total_profit', path: 'profit.total_profit', isCore: true, isTotal: true }, + { name: '减:所得税费用', key: 'income_tax', path: 'profit.income_tax_expense' }, + { name: '净利润', key: 'net_profit', path: 'profit.net_profit', isCore: true, isTotal: true }, + { name: ' 归属母公司所有者的净利润', key: 'parent_net_profit', path: 'profit.parent_net_profit', isCore: true }, + { name: ' 少数股东损益', key: 'minority_profit', path: 'profit.minority_profit' }, + { name: '持续经营净利润', key: 'continuing_net_profit', path: 'profit.continuing_operations_net_profit' }, + { name: '终止经营净利润', key: 'discontinued_net_profit', path: 'profit.discontinued_operations_net_profit' }, + ], + }, + { + title: '每股收益', + key: 'eps', + metrics: [ + { name: '基本每股收益(元)', key: 'basic_eps', path: 'per_share.basic_eps', isCore: true }, + { name: '稀释每股收益(元)', key: 'diluted_eps', path: 'per_share.diluted_eps' }, + ], + }, + { + title: '综合收益', + key: 'comprehensive', + metrics: [ + { name: '其他综合收益(税后)', key: 'other_comprehensive_income', path: 'comprehensive_income.other_comprehensive_income' }, + { name: '综合收益总额', key: 'total_comprehensive_income', path: 'comprehensive_income.total_comprehensive_income', isTotal: true }, + { name: ' 归属母公司', key: 'parent_comprehensive_income', path: 'comprehensive_income.parent_comprehensive_income' }, + { name: ' 归属少数股东', key: 'minority_comprehensive_income', path: 'comprehensive_income.minority_comprehensive_income' }, + ], + }, +]; + +// ==================== 现金流量表指标定义 ==================== + +export const CASHFLOW_METRICS = [ + { name: '经营现金流净额', key: 'operating_net', path: 'operating_activities.net_flow' }, + { name: '销售收现', key: 'cash_from_sales', path: 'operating_activities.inflow.cash_from_sales' }, + { name: '购买支付现金', key: 'cash_for_goods', path: 'operating_activities.outflow.cash_for_goods' }, + { name: '投资现金流净额', key: 'investment_net', path: 'investment_activities.net_flow' }, + { name: '筹资现金流净额', key: 'financing_net', path: 'financing_activities.net_flow' }, + { name: '现金净增加额', key: 'net_increase', path: 'cash_changes.net_increase' }, + { name: '期末现金余额', key: 'ending_balance', path: 'cash_changes.ending_balance' }, + { name: '自由现金流', key: 'free_cash_flow', path: 'key_metrics.free_cash_flow' }, +]; + +// ==================== 财务指标分类定义 ==================== + +export const FINANCIAL_METRICS_CATEGORIES: MetricsCategoryMap = { + profitability: { + title: '盈利能力指标', + metrics: [ + { name: '净资产收益率(ROE)%', key: 'roe', path: 'profitability.roe', isCore: true }, + { name: '净资产收益率(扣非)%', key: 'roe_deducted', path: 'profitability.roe_deducted' }, + { name: '净资产收益率(加权)%', key: 'roe_weighted', path: 'profitability.roe_weighted', isCore: true }, + { name: '总资产报酬率(ROA)%', key: 'roa', path: 'profitability.roa', isCore: true }, + { name: '毛利率%', key: 'gross_margin', path: 'profitability.gross_margin', isCore: true }, + { name: '净利率%', key: 'net_margin', path: 'profitability.net_profit_margin', isCore: true }, + { name: '营业利润率%', key: 'operating_margin', path: 'profitability.operating_profit_margin' }, + { name: '成本费用利润率%', key: 'cost_profit_ratio', path: 'profitability.cost_profit_ratio' }, + { name: 'EBIT', key: 'ebit', path: 'profitability.ebit' }, + ], + }, + perShare: { + title: '每股指标', + metrics: [ + { name: '每股收益(EPS)', key: 'eps', path: 'per_share_metrics.eps', isCore: true }, + { name: '基本每股收益', key: 'basic_eps', path: 'per_share_metrics.basic_eps', isCore: true }, + { name: '稀释每股收益', key: 'diluted_eps', path: 'per_share_metrics.diluted_eps' }, + { name: '扣非每股收益', key: 'deducted_eps', path: 'per_share_metrics.deducted_eps', isCore: true }, + { name: '每股净资产', key: 'bvps', path: 'per_share_metrics.bvps', isCore: true }, + { name: '每股经营现金流', key: 'operating_cash_flow_ps', path: 'per_share_metrics.operating_cash_flow_ps' }, + { name: '每股资本公积', key: 'capital_reserve_ps', path: 'per_share_metrics.capital_reserve_ps' }, + { name: '每股未分配利润', key: 'undistributed_profit_ps', path: 'per_share_metrics.undistributed_profit_ps' }, + ], + }, + growth: { + title: '成长能力指标', + metrics: [ + { name: '营收增长率%', key: 'revenue_growth', path: 'growth.revenue_growth', isCore: true }, + { name: '净利润增长率%', key: 'profit_growth', path: 'growth.net_profit_growth', isCore: true }, + { name: '扣非净利润增长率%', key: 'deducted_profit_growth', path: 'growth.deducted_profit_growth', isCore: true }, + { name: '归母净利润增长率%', key: 'parent_profit_growth', path: 'growth.parent_profit_growth' }, + { name: '经营现金流增长率%', key: 'operating_cash_flow_growth', path: 'growth.operating_cash_flow_growth' }, + { name: '总资产增长率%', key: 'asset_growth', path: 'growth.total_asset_growth' }, + { name: '净资产增长率%', key: 'equity_growth', path: 'growth.equity_growth' }, + { name: '固定资产增长率%', key: 'fixed_asset_growth', path: 'growth.fixed_asset_growth' }, + ], + }, + operational: { + title: '运营效率指标', + metrics: [ + { name: '总资产周转率', key: 'asset_turnover', path: 'operational_efficiency.total_asset_turnover', isCore: true }, + { name: '固定资产周转率', key: 'fixed_asset_turnover', path: 'operational_efficiency.fixed_asset_turnover' }, + { name: '流动资产周转率', key: 'current_asset_turnover', path: 'operational_efficiency.current_asset_turnover' }, + { name: '应收账款周转率', key: 'receivable_turnover', path: 'operational_efficiency.receivable_turnover', isCore: true }, + { name: '应收账款周转天数', key: 'receivable_days', path: 'operational_efficiency.receivable_days', isCore: true }, + { name: '存货周转率', key: 'inventory_turnover', path: 'operational_efficiency.inventory_turnover', isCore: true }, + { name: '存货周转天数', key: 'inventory_days', path: 'operational_efficiency.inventory_days' }, + { name: '营运资金周转率', key: 'working_capital_turnover', path: 'operational_efficiency.working_capital_turnover' }, + ], + }, + solvency: { + title: '偿债能力指标', + metrics: [ + { name: '流动比率', key: 'current_ratio', path: 'solvency.current_ratio', isCore: true }, + { name: '速动比率', key: 'quick_ratio', path: 'solvency.quick_ratio', isCore: true }, + { name: '现金比率', key: 'cash_ratio', path: 'solvency.cash_ratio' }, + { name: '保守速动比率', key: 'conservative_quick_ratio', path: 'solvency.conservative_quick_ratio' }, + { name: '资产负债率%', key: 'debt_ratio', path: 'solvency.asset_liability_ratio', isCore: true }, + { name: '利息保障倍数', key: 'interest_coverage', path: 'solvency.interest_coverage' }, + { name: '现金到期债务比', key: 'cash_to_maturity_debt', path: 'solvency.cash_to_maturity_debt_ratio' }, + { name: '有形资产净值债务率%', key: 'tangible_asset_debt_ratio', path: 'solvency.tangible_asset_debt_ratio' }, + ], + }, + expense: { + title: '费用率指标', + metrics: [ + { name: '销售费用率%', key: 'selling_expense_ratio', path: 'expense_ratios.selling_expense_ratio', isCore: true }, + { name: '管理费用率%', key: 'admin_expense_ratio', path: 'expense_ratios.admin_expense_ratio', isCore: true }, + { name: '财务费用率%', key: 'financial_expense_ratio', path: 'expense_ratios.financial_expense_ratio' }, + { name: '研发费用率%', key: 'rd_expense_ratio', path: 'expense_ratios.rd_expense_ratio', isCore: true }, + { name: '三费费用率%', key: 'three_expense_ratio', path: 'expense_ratios.three_expense_ratio' }, + { name: '四费费用率%', key: 'four_expense_ratio', path: 'expense_ratios.four_expense_ratio' }, + { name: '营业成本率%', key: 'cost_ratio', path: 'expense_ratios.cost_ratio' }, + ], + }, + cashflow: { + title: '现金流量指标', + metrics: [ + { name: '经营现金流/净利润', key: 'cash_to_profit', path: 'cash_flow_quality.operating_cash_to_profit_ratio', isCore: true }, + { name: '净利含金量', key: 'profit_cash_content', path: 'cash_flow_quality.cash_to_profit_ratio', isCore: true }, + { name: '营收现金含量', key: 'revenue_cash_content', path: 'cash_flow_quality.cash_revenue_ratio' }, + { name: '全部资产现金回收率%', key: 'cash_recovery_rate', path: 'cash_flow_quality.cash_recovery_rate' }, + { name: '经营现金流/短期债务', key: 'cash_to_short_debt', path: 'cash_flow_quality.operating_cash_to_short_debt' }, + { name: '经营现金流/总债务', key: 'cash_to_total_debt', path: 'cash_flow_quality.operating_cash_to_total_debt' }, + ], + }, +}; + +// ==================== 行业排名指标 ==================== + +export const RANKING_METRICS = [ + { name: 'EPS', key: 'eps' }, + { name: '每股净资产', key: 'bvps' }, + { name: 'ROE', key: 'roe' }, + { name: '营收增长率', key: 'revenue_growth' }, + { name: '利润增长率', key: 'profit_growth' }, + { name: '营业利润率', key: 'operating_margin' }, + { name: '资产负债率', key: 'debt_ratio' }, + { name: '应收账款周转率', key: 'receivable_turnover' }, +]; + +// ==================== 对比指标 ==================== + +export const COMPARE_METRICS = [ + { label: '营业收入', key: 'revenue', path: 'financial_summary.revenue' }, + { label: '净利润', key: 'net_profit', path: 'financial_summary.net_profit' }, + { label: 'ROE', key: 'roe', path: 'key_metrics.roe', format: 'percent' }, + { label: 'ROA', key: 'roa', path: 'key_metrics.roa', format: 'percent' }, + { label: '毛利率', key: 'gross_margin', path: 'key_metrics.gross_margin', format: 'percent' }, + { label: '净利率', key: 'net_margin', path: 'key_metrics.net_margin', format: 'percent' }, + { label: '营收增长率', key: 'revenue_growth', path: 'growth_rates.revenue_growth', format: 'percent' }, + { label: '利润增长率', key: 'profit_growth', path: 'growth_rates.profit_growth', format: 'percent' }, + { label: '资产总额', key: 'total_assets', path: 'financial_summary.total_assets' }, + { label: '负债总额', key: 'total_liabilities', path: 'financial_summary.total_liabilities' }, +];