fix(FinancialPanorama): 优化期数切换和数据加载

- Tab 切换时检查期数是否一致,不一致则重新加载
- 股票切换时立即清空旧数据,确保显示骨架屏
- 表格右上角显示当前期数

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
zdl
2025-12-19 16:16:12 +08:00
parent d394c25d7e
commit 0ad0287f7b
3 changed files with 60 additions and 9 deletions

View File

@@ -90,15 +90,15 @@ const FinancialPanorama: React.FC<FinancialPanoramaProps> = ({ stockCode: propSt
refetchByTab,
selectedPeriods,
setSelectedPeriods,
setActiveTab,
handleTabChange: handleTabChangeWithPeriodCheck,
activeTab,
} = useFinancialData({ stockCode: propStockCode });
// 处理 Tab 切换
// 处理 Tab 切换(使用 hook 提供的带期数检查的函数)
const handleTabChange = useCallback((index: number, tabKey: string) => {
const dataTypeKey = TAB_KEY_MAP[index] || (tabKey as DataTypeKey);
setActiveTab(dataTypeKey);
}, [setActiveTab]);
handleTabChangeWithPeriodCheck(dataTypeKey);
}, [handleTabChangeWithPeriodCheck]);
// 处理刷新 - 只刷新当前 Tab
const handleRefresh = useCallback(() => {