67 lines
3.1 KiB
Markdown
67 lines
3.1 KiB
Markdown
|
|
# 订单班命名规范和映射表
|
|||
|
|
|
|||
|
|
## 命名统一原则
|
|||
|
|
|
|||
|
|
所有订单班的命名必须在以下三个地方保持一致:
|
|||
|
|
1. **orderClasses.json** 中的 `id` 字段
|
|||
|
|
2. **simulationMap** 中的 key
|
|||
|
|
3. **终端模拟文件名**和**导出函数名**
|
|||
|
|
|
|||
|
|
## 当前订单班中英文映射表
|
|||
|
|
|
|||
|
|
| 中文名称 | 英文ID | 文件名 | 导出函数名 | 状态 |
|
|||
|
|
|---------|--------|--------|-----------|------|
|
|||
|
|
| 食品 | `food` | `food.ts` | `foodSimulation` | ✅ 已实现 |
|
|||
|
|
| 文旅 | `wenlu` | `wenlu.ts` | `wenluSimulation` | ✅ 已实现 |
|
|||
|
|
| 智能制造 | `manufacturing` | `intelligentManufacturing.ts` | `intelligentManufacturingSimulation` | ✅ 已实现 |
|
|||
|
|
| 智能开发 | `developer` | - | - | ⏸️ 未实现 |
|
|||
|
|
| 财经商贸 | `finance` | - | - | ⏸️ 未实现 |
|
|||
|
|
| 视觉设计 | `visual` | `visualDesign.ts` | `visualSimulation` | ✅ 已实现 |
|
|||
|
|
| 大健康 | `health` | `health.ts` | `healthSimulation` | ✅ 已实现 |
|
|||
|
|
| 交通物流 | `transportation` | `transportation.ts` | `transportationSimulation` | ✅ 已实现 |
|
|||
|
|
| 能源 | `energy` | `energy.ts` | `energySimulation` | ✅ 已实现 |
|
|||
|
|
| 化工 | `chemical` | - | - | ⏸️ 未实现 |
|
|||
|
|
| 环保 | `environmental` | - | - | ⏸️ 未实现 |
|
|||
|
|
| 土木 | `civil` | `civilEngineering.ts` | `civilEngineeringSimulation` | ✅ 已实现 |
|
|||
|
|
|
|||
|
|
## 最近修改记录 (2025-10-02)
|
|||
|
|
|
|||
|
|
### 交通物流订单班统一命名
|
|||
|
|
**问题**:
|
|||
|
|
- orderClasses.json 中 ID 为 `transportation`
|
|||
|
|
- simulationMap 中 key 为 `logistics`
|
|||
|
|
- 导致点击"交通物流"模版无法触发终端模拟
|
|||
|
|
|
|||
|
|
**解决方案**:
|
|||
|
|
1. 重命名文件:`logistics.ts` → `transportation.ts`
|
|||
|
|
2. 更新函数名:`logisticsSimulation()` → `transportationSimulation()`
|
|||
|
|
3. 更新变量名:`logisticsAgents` → `transportationAgents`
|
|||
|
|
4. 更新 orderClassId:`'logistics'` → `'transportation'`
|
|||
|
|
5. 更新 index.ts 导入语句和 simulationMap 注册
|
|||
|
|
|
|||
|
|
### 智能制造订单班ID修正
|
|||
|
|
**问题**: orderClasses.json 中 ID 为 `manufacture`,但 simulationMap 中为 `manufacturing`
|
|||
|
|
|
|||
|
|
**解决方案**: 修改 orderClasses.json 中的 ID:`"manufacture"` → `"manufacturing"`
|
|||
|
|
|
|||
|
|
## 关键文件位置
|
|||
|
|
|
|||
|
|
- **订单班配置**: `/web_frontend/exhibition-demo/src/data/orderClasses.json`
|
|||
|
|
- **模拟数据映射**: `/web_frontend/exhibition-demo/src/data/terminalSimulations/index.ts`
|
|||
|
|
- **各订单班模拟数据**: `/web_frontend/exhibition-demo/src/data/terminalSimulations/*.ts`
|
|||
|
|
|
|||
|
|
## 添加新订单班的流程
|
|||
|
|
|
|||
|
|
1. 在 `orderClasses.json` 中添加订单班配置,设定统一的 `id`
|
|||
|
|
2. 创建 `/terminalSimulations/{id}.ts` 文件
|
|||
|
|
3. 导出函数命名为 `{id}Simulation`
|
|||
|
|
4. 在 `index.ts` 中导入并注册到 `simulationMap`
|
|||
|
|
5. 确保 orderClassId 与配置文件中的 id 一致
|
|||
|
|
|
|||
|
|
## 注意事项
|
|||
|
|
|
|||
|
|
- ⚠️ **切勿使用不同的命名**:orderClasses.json 的 ID 必须与 simulationMap 的 key 完全一致
|
|||
|
|
- ⚠️ **函数命名规范**:导出函数应命名为 `{id}Simulation`,如 `transportationSimulation`
|
|||
|
|
- ⚠️ **变量命名规范**:Agent 数组应命名为 `{id}Agents`,如 `transportationAgents`
|
|||
|
|
- ✅ **ID 使用英文单词**:优先使用完整、直观的英文单词,如 `transportation` 而不是 `logistics`
|