feat: 添加mock数据

This commit is contained in:
zdl
2025-10-17 23:23:31 +08:00
parent 0953367e03
commit 69784d094d
7 changed files with 413 additions and 74 deletions

View File

@@ -452,6 +452,7 @@ function StockDetailPanel({ visible, event, onClose }) {
// 初始化数据加载
useEffect(() => {
console.log('[StockDetailPanel] useEffect 触发, visible:', visible, 'event:', event?.id);
if (visible && event) {
setActiveTab('stocks');
loadAllData();
@@ -460,8 +461,9 @@ function StockDetailPanel({ visible, event, onClose }) {
// 加载所有数据的函数
const loadAllData = useCallback(() => {
console.log('[StockDetailPanel] loadAllData 被调用, event:', event?.id);
if (!event) return;
// 加载自选股列表
loadWatchlist();
@@ -590,17 +592,38 @@ function StockDetailPanel({ visible, event, onClose }) {
dataIndex: 'relation_desc',
key: 'relation_desc',
width: 300,
render: (text, record) => {
console.log('[表格渲染] 股票:', record.stock_code, 'relation_desc:', text);
if (!text) return '--';
render: (relationDesc, record) => {
console.log('[表格渲染] 股票:', record.stock_code, 'relation_desc:', relationDesc);
// 处理 relation_desc 的两种格式
let text = '';
if (!relationDesc) {
return '--';
} else if (typeof relationDesc === 'string') {
// 旧格式:直接是字符串
text = relationDesc;
} else if (typeof relationDesc === 'object' && relationDesc.data && Array.isArray(relationDesc.data)) {
// 新格式:{data: [{query_part: "...", sentences: "..."}]}
// 提取所有 query_part用逗号连接
text = relationDesc.data
.map(item => item.query_part || item.sentences || '')
.filter(s => s)
.join('') || '--';
} else {
console.warn('[表格渲染] 未知的 relation_desc 格式:', relationDesc);
return '--';
}
if (!text || text === '--') return '--';
const isExpanded = expandedRows.has(record.stock_code);
const maxLength = 30; // 收缩时显示的最大字符数
const needTruncate = text.length > maxLength;
return (
<div style={{ position: 'relative' }}>
<div style={{
<div style={{
whiteSpace: isExpanded ? 'normal' : 'nowrap',
overflow: isExpanded ? 'visible' : 'hidden',
textOverflow: isExpanded ? 'clip' : 'ellipsis',
@@ -619,7 +642,7 @@ function StockDetailPanel({ visible, event, onClose }) {
e.stopPropagation(); // 防止触发行点击事件
toggleRowExpand(record.stock_code);
}}
style={{
style={{
position: isExpanded ? 'static' : 'absolute',
right: 0,
top: 0,