调整订单列表待处理数量口径

This commit is contained in:
andy
2026-07-20 12:05:54 +07:00
parent d7b24cbef7
commit c5244bc652
12 changed files with 149 additions and 14 deletions

View File

@@ -0,0 +1,86 @@
# Order List Open Work Count 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:** 订单列表待处理数量展示统一使用后端 `open_work_item_count`,不再使用旧 `open_task_count` 或前端自行相加。
**Architecture:** 类型层在订单列表 item 上补齐 `open_work_item_count`,页面层新增展示列和格式化 helper只读取该统一字段。继续处理入口仍复用现有 V4 优先、旧任务回退 helper不改变 V4 任务详情、任务列表或 S10/S99 来源通知逻辑。
**Tech Stack:** Vue 3, TypeScript, Vue Router, Vue I18n, Vitest, Vue Test Utils.
## Global Constraints
- 不改后端接口。
- 不改 V4 订单任务详情页。
- 不改任务列表。
- 不改 S10/S99 来源通知逻辑。
- 不在前端计算 `open_task_count + v4_open_order_task_count`
- 提交时不带入 `.idea``client/dist.zip`、后端代码或其他无关工作区改动。
---
### Task 1: Order List Uses Backend Unified Open Count
**Files:**
- Modify: `client/src/types/reservation.ts`
- Modify: `client/src/views/reservation/ReservationOrderListView.vue`
- Modify: `client/src/tests/reservationViews.spec.ts`
- Modify: `client/src/tests/reservationService.spec.ts`
- Modify: `client/src/i18n/locales/zh-CN.ts`
- Modify: `client/src/i18n/locales/en-US.ts`
- Modify: `client/src/i18n/locales/th-TH.ts`
**Interfaces:**
- Consumes: `ReservationOrderListItem.open_work_item_count?: number | null`
- Produces: 订单列表“待处理”列只展示 `open_work_item_count`
- [x] **Step 1: Write failing view test**
Add a case where `open_task_count=99`, `v4_open_order_task_count=88`, and `open_work_item_count=3`; assert the order row shows `3` under the open count column and does not show `99` or `88`.
- [x] **Step 2: Verify red**
Run `CI=true pnpm --dir client test -- reservationViews.spec.ts`.
Expected: FAIL because the current order list has no `open_work_item_count` display.
- [x] **Step 3: Implement types and UI**
Add `open_work_item_count` to `ReservationOrderListItem`. Add a “待处理 / Open work” column and render only `formatOpenWorkItemCount(order)`.
- [x] **Step 4: Update service test**
Add `open_work_item_count` to the order list service mock and assert the value is preserved.
- [x] **Step 5: Verify green**
Run `CI=true pnpm --dir client test -- reservationViews.spec.ts reservationService.spec.ts`.
### Task 2: Documentation, Review, Verification, Commit
**Files:**
- Modify: `PROJECT_STATE.md`
- Modify: `docs/project/frontend-backend/backend-to-frontend-notes.md`
- Modify: `docs/project/frontend-backend/frontend-to-backend-api-requests.md`
**Interfaces:**
- Produces: 前端已改用 `open_work_item_count` 的状态说明
- [x] **Step 1: Update docs**
Record that frontend order list display now uses `open_work_item_count` and no longer uses `open_task_count` as the displayed count.
- [x] **Step 2: Run verification**
Run:
- `CI=true pnpm --dir client lint`
- `CI=true pnpm --dir client typecheck`
- `CI=true pnpm --dir client test`
- `CI=true pnpm --dir client build`
- [x] **Step 3: Code review**
Review routing invariants, open count source, tests, docs, and staged files.
- [x] **Step 4: Commit**
Stage only related frontend/doc files and commit with a Chinese message.