From bf8847698bfc9b01e4cd3cd635d00470fe2690a2 Mon Sep 17 00:00:00 2001 From: zdl <3489966805@qq.com> Date: Wed, 10 Dec 2025 11:02:24 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20CompanyOverview=20TypeScript=20?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=AE=9A=E4=B9=89=E5=92=8C=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - types.ts: 添加公司基本信息、股东、管理层等接口定义 - utils.ts: 添加注册资本、日期格式化函数 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../components/CompanyOverview/types.ts | 118 ++++++++++++++++++ .../components/CompanyOverview/utils.ts | 26 ++++ 2 files changed, 144 insertions(+) create mode 100644 src/views/Company/components/CompanyOverview/types.ts create mode 100644 src/views/Company/components/CompanyOverview/utils.ts diff --git a/src/views/Company/components/CompanyOverview/types.ts b/src/views/Company/components/CompanyOverview/types.ts new file mode 100644 index 00000000..c274f8a8 --- /dev/null +++ b/src/views/Company/components/CompanyOverview/types.ts @@ -0,0 +1,118 @@ +// src/views/Company/components/CompanyOverview/types.ts +// 公司概览组件类型定义 + +/** + * 公司基本信息 + */ +export interface BasicInfo { + ORGNAME?: string; + SECNAME?: string; + SECCODE?: string; + sw_industry_l1?: string; + sw_industry_l2?: string; + sw_industry_l3?: string; + legal_representative?: string; + chairman?: string; + general_manager?: string; + establish_date?: string; + reg_capital?: number; + province?: string; + city?: string; + website?: string; + email?: string; + tel?: string; + company_intro?: string; +} + +/** + * 实际控制人 + */ +export interface ActualControl { + controller_name?: string; + controller_type?: string; + holding_ratio?: number; +} + +/** + * 股权集中度 + */ +export interface Concentration { + top1_ratio?: number; + top5_ratio?: number; + top10_ratio?: number; +} + +/** + * 管理层信息 + */ +export interface Management { + name?: string; + position?: string; + start_date?: string; + end_date?: string; +} + +/** + * 股东信息 + */ +export interface Shareholder { + shareholder_name?: string; + holding_ratio?: number; + holding_amount?: number; +} + +/** + * 分支机构 + */ +export interface Branch { + branch_name?: string; + address?: string; +} + +/** + * 公告信息 + */ +export interface Announcement { + title?: string; + publish_date?: string; + url?: string; +} + +/** + * 披露计划 + */ +export interface DisclosureSchedule { + report_type?: string; + disclosure_date?: string; +} + +/** + * useCompanyOverviewData Hook 返回值 + */ +export interface CompanyOverviewData { + basicInfo: BasicInfo | null; + actualControl: ActualControl[]; + concentration: Concentration[]; + management: Management[]; + topCirculationShareholders: Shareholder[]; + topShareholders: Shareholder[]; + branches: Branch[]; + announcements: Announcement[]; + disclosureSchedule: DisclosureSchedule[]; + loading: boolean; + dataLoaded: boolean; +} + +/** + * CompanyOverview 组件 Props + */ +export interface CompanyOverviewProps { + stockCode?: string; +} + +/** + * CompanyHeaderCard 组件 Props + */ +export interface CompanyHeaderCardProps { + basicInfo: BasicInfo; +} diff --git a/src/views/Company/components/CompanyOverview/utils.ts b/src/views/Company/components/CompanyOverview/utils.ts new file mode 100644 index 00000000..6b72259d --- /dev/null +++ b/src/views/Company/components/CompanyOverview/utils.ts @@ -0,0 +1,26 @@ +// src/views/Company/components/CompanyOverview/utils.ts +// 公司概览格式化工具函数 + +/** + * 格式化注册资本 + * @param value - 注册资本(万元) + * @returns 格式化后的字符串 + */ +export const formatRegisteredCapital = (value: number | null | undefined): string => { + if (!value && value !== 0) return "-"; + const absValue = Math.abs(value); + if (absValue >= 100000) { + return (value / 10000).toFixed(2) + "亿元"; + } + return value.toFixed(2) + "万元"; +}; + +/** + * 格式化日期 + * @param dateString - 日期字符串 + * @returns 格式化后的日期字符串 + */ +export const formatDate = (dateString: string | null | undefined): string => { + if (!dateString) return "-"; + return new Date(dateString).toLocaleDateString("zh-CN"); +};