112 lines
3.3 KiB
Markdown
112 lines
3.3 KiB
Markdown
## 移除天体事件列表中的小行星编号列
|
||
|
||
### 修改内容
|
||
|
||
在 `/Users/jiliu/WorkSpace/cosmo/frontend/src/pages/admin/CelestialEvents.tsx` 中进行了以下修改:
|
||
|
||
#### 1. 移除小行星编号列(第143-148行已删除)
|
||
```typescript
|
||
// 删除了这一列
|
||
{
|
||
title: '小行星编号',
|
||
dataIndex: ['details', 'designation'],
|
||
width: 150,
|
||
render: (designation) => designation || '-',
|
||
},
|
||
```
|
||
|
||
**原因:**
|
||
- 现在有多种事件类型(合、冲、近距离接近等)
|
||
- 小行星编号只对某些接近事件有意义
|
||
- 对于行星合冲事件,这个字段没有实际价值
|
||
|
||
#### 2. 更新事件类型支持(第97-119行)
|
||
|
||
添加了 `close_approach` 事件类型的显示:
|
||
|
||
```typescript
|
||
const getEventTypeColor = (type: string) => {
|
||
const colorMap: Record<string, string> = {
|
||
'approach': 'blue',
|
||
'close_approach': 'magenta', // 新增
|
||
'eclipse': 'purple',
|
||
'conjunction': 'cyan',
|
||
'opposition': 'orange',
|
||
'transit': 'green',
|
||
};
|
||
return colorMap[type] || 'default';
|
||
};
|
||
|
||
const getEventTypeLabel = (type: string) => {
|
||
const labelMap: Record<string, string> = {
|
||
'approach': '接近',
|
||
'close_approach': '近距离接近', // 新增
|
||
'eclipse': '食',
|
||
'conjunction': '合',
|
||
'opposition': '冲',
|
||
'transit': '凌',
|
||
};
|
||
return labelMap[type] || type;
|
||
};
|
||
```
|
||
|
||
#### 3. 更新事件类型过滤器(第169-175行)
|
||
|
||
在过滤器中添加了 `close_approach` 选项:
|
||
|
||
```typescript
|
||
filters: [
|
||
{ text: '接近', value: 'approach' },
|
||
{ text: '近距离接近', value: 'close_approach' }, // 新增
|
||
{ text: '食', value: 'eclipse' },
|
||
{ text: '合', value: 'conjunction' },
|
||
{ text: '冲', value: 'opposition' },
|
||
],
|
||
```
|
||
|
||
#### 4. 简化搜索功能(第76-84行)
|
||
|
||
移除了对小行星编号的搜索支持:
|
||
|
||
```typescript
|
||
// 修改前:搜索标题、描述、小行星编号
|
||
item.title.toLowerCase().includes(lowerKeyword) ||
|
||
item.description?.toLowerCase().includes(lowerKeyword) ||
|
||
item.details?.designation?.toLowerCase().includes(lowerKeyword)
|
||
|
||
// 修改后:只搜索标题和描述
|
||
item.title.toLowerCase().includes(lowerKeyword) ||
|
||
item.description?.toLowerCase().includes(lowerKeyword)
|
||
```
|
||
|
||
### 当前列布局
|
||
|
||
更新后的事件列表包含以下列:
|
||
|
||
1. **ID** - 事件ID
|
||
2. **事件标题** - 完整的事件标题
|
||
3. **目标天体** - 关联的天体(带过滤器)
|
||
4. **事件类型** - 事件类型标签(带过滤器)
|
||
5. **事件时间** - 事件发生时间
|
||
6. **距离 (AU)** - 对于接近事件显示距离
|
||
7. **数据源** - 事件数据来源
|
||
8. **操作** - 删除按钮
|
||
|
||
### 支持的事件类型
|
||
|
||
现在支持以下事件类型,每种都有对应的颜色标签:
|
||
|
||
- 🔵 **接近 (approach)** - 小行星/彗星接近事件(来自NASA SBDB)
|
||
- 🟣 **近距离接近 (close_approach)** - 行星间近距离接近(来自Skyfield计算)
|
||
- 🟣 **食 (eclipse)** - 日食/月食
|
||
- 🔵 **合 (conjunction)** - 行星合日(来自Skyfield计算)
|
||
- 🟠 **冲 (opposition)** - 行星冲日(来自Skyfield计算)
|
||
- 🟢 **凌 (transit)** - 行星凌日
|
||
|
||
### 效果
|
||
|
||
- ✓ 界面更简洁,去除了对大部分事件无意义的列
|
||
- ✓ 专注于通用信息:目标天体、事件类型、时间
|
||
- ✓ 支持所有事件类型的显示和过滤
|
||
- ✓ 如需要查看详细信息(如小行星编号),可以查看事件的完整描述或详情
|