49 lines
2.5 KiB
Markdown
49 lines
2.5 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:** 采集协议单新增/编辑保存成功后,自动将 `dfj` 转账/缴费明细提交财务确认(对齐预签约)。
|
||
|
||
**Architecture:** 保存 create/update 后用 `protocolId` 回查详情,展平 v2 transfers 或取 v1 paymentDetails,复用 `submitDfjTransfersOnSave` 逐笔调用独立提交接口;失败不回滚协议,仅警告。历史 v1→v2 迁移不在本期。
|
||
|
||
**Tech Stack:** Vue 3 + TypeScript(web-admin)、现有 `presign-save-auto-submit.ts`、collection-protocol / protocol-sample-payment API
|
||
|
||
**Spec:** `docs/superpowers/specs/2026-10-15-protocol-save-auto-submit-and-v1-to-v2-migration-design.md`
|
||
|
||
---
|
||
|
||
### Task 1: 泛化自动提交工具文案
|
||
|
||
**Files:**
|
||
- Modify: `web-admin/src/utils/presign-save-auto-submit.ts`
|
||
- Modify: `web-admin/src/utils/presign-save-auto-submit.test.ts`
|
||
|
||
- [x] **Step 1:** `formatAutoSubmitFinanceFailureMessage(failures, entityLabel = '订单')` → `「${entityLabel}已保存,但有 N 笔…」`
|
||
- [x] **Step 2:** 新增 `flattenSamplePaymentTransfers(samplePayments)` 返回带 `id`/`payStatus` 的 transfer 列表
|
||
- [x] **Step 3:** 单测覆盖新文案与 flatten;预签约旧断言仍用默认「订单」
|
||
- [x] **Step 4:** 跑测试通过
|
||
|
||
### Task 2: API 支持关闭成功 toast
|
||
|
||
**Files:**
|
||
- Modify: `web-admin/src/api/protocol-sample-payment.ts` — `fetchSubmitPaymentTransferFinance`
|
||
- Modify: `web-admin/src/api/collection-protocol.ts` — `fetchSubmitReceiptFinance`
|
||
|
||
- [x] **Step 1:** 增加可选 `options?: { showSuccessMessage?: boolean }`,默认 true(与预签约一致)
|
||
|
||
### Task 3: ProtocolFormDialog 保存后自动提交
|
||
|
||
**Files:**
|
||
- Modify: `web-admin/src/views/cell-storage/protocol/ProtocolFormDialog.vue`
|
||
|
||
- [x] **Step 1:** create/update 取返回 `id`(编辑用 `editingId`)
|
||
- [x] **Step 2:** `fetchCollectionProtocolDetail(id)` 回查
|
||
- [x] **Step 3:** v2 → flatten `samplePayments` transfers;v1 → `paymentDetails`
|
||
- [x] **Step 4:** `submitDfjTransfersOnSave` + 对应 submit API(`showSuccessMessage: false`)
|
||
- [x] **Step 5:** 有 failures 则 `ElMessage.warning(format…(failures, '协议'))`;关窗 `emit('saved')`
|
||
|
||
### Task 4: 验证
|
||
|
||
- [x] 跑 `presign-save-auto-submit` 单测
|
||
- [x] 必要时 `./scripts/update-graph.sh frontend`
|