68 lines
2.8 KiB
Markdown
68 lines
2.8 KiB
Markdown
# 移动端协议单样本及运输对齐 Implementation Plan
|
||
|
||
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||
|
||
**Goal:** 小程序协议编辑页内嵌「样本及运输」,功能对齐 Web `sample-transport-form-section`(含运费配置),样式用 Vant。
|
||
|
||
**Architecture:** 新建 `ProtocolSampleTransportPanel` 托管 samples;后端扩 `MarketProtocolSampleBody`(sampleStatus/freightId/freightDraft)并详情挂 freight;运费复用 market freight API + `apply_freight_on_protocol_save`。
|
||
|
||
**Tech Stack:** Vue 3 + Vant(mobile-oa-h5)、FastAPI market_protocol / market_freight
|
||
|
||
**Spec:** `docs/superpowers/specs/2026-10-13-mobile-protocol-sample-transport-parity-design.md`
|
||
|
||
---
|
||
|
||
## File map
|
||
|
||
| 文件 | 职责 |
|
||
|------|------|
|
||
| `backend/app/schemas/market_mobile.py` | SampleBody 增字段 |
|
||
| `backend/app/services/market_protocol.py` | 详情样本挂 freight;捐赠编码如需 |
|
||
| `backend/tests/test_market_protocol_api.py` 等 | 后端测 |
|
||
| `mobile-oa-h5/src/market/protocol-sample-transport.js` | 校验/草稿/运费纯函数 |
|
||
| `mobile-oa-h5/src/market/components/ProtocolSampleTransportPanel.vue` | 面板 UI |
|
||
| `mobile-oa-h5/src/views/market/MarketModuleForm.vue` | 接线 |
|
||
| `mobile-oa-h5/src/market/modules/protocol.js` | 去 samples formSections;详情补运费 |
|
||
| 相关 `*.test.js` | 契约与回归 |
|
||
|
||
---
|
||
|
||
### Task 1: 后端 schema + 详情 freight
|
||
|
||
**Files:** `market_mobile.py` schemas;`market_protocol.py`;tests
|
||
|
||
- [x] Step 1: 写失败测 — SampleBody 接受 sampleStatus/freightId/freightDraft;详情 sample 含 freight
|
||
- [x] Step 2: 跑测失败
|
||
- [x] Step 3: 实现 schema + enrichment(复用 freight_map / 已有 dict)
|
||
- [x] Step 4: 跑测通过
|
||
|
||
### Task 2: 样本运输纯函数
|
||
|
||
**Files:** Create `protocol-sample-transport.js` + test
|
||
|
||
- [x] Step 1: 失败测 — emptySample、validateSample、applyTypeDefaults、buildFreightDraft、partition configurable
|
||
- [x] Step 2–4: 实现并绿
|
||
|
||
### Task 3: ProtocolSampleTransportPanel 样本 UI
|
||
|
||
**Files:** Create panel;update parity tests
|
||
|
||
- [x] Step 1: 契约测 — 添加样本、样本状态、特殊说明、细胞有价捐赠无价
|
||
- [x] Step 2–4: 实现样本增删改 Popup + Form 接线 props
|
||
|
||
### Task 4: 面板内嵌运费
|
||
|
||
- [x] Step 1: 契约测 — 配置运费、取消运费文案/绑定
|
||
- [x] Step 2–4: Popup + freight API;草稿 freightDraft
|
||
|
||
### Task 5: Form / protocol.js / 详情
|
||
|
||
- [x] 移除 formSections samples;Form 挂面板两端 source
|
||
- [x] detailSections 补运输方式/运费
|
||
- [x] 更新依赖旧 samples fields 的测试
|
||
|
||
### Task 6: 验证
|
||
|
||
- [x] mobile market 全量 node test;相关 pytest
|
||
- [x] `./scripts/update-graph.sh backend`
|