This commit is contained in:
zlwu committed 2026-10-17 11:46:53 +08:00
1 parent 48dcf991dc
commit be2226e4ca
100 files changed
+61340 -40975

No files matched your search

@@ -0,0 +1,36 @@
# 存储服务与市场移动端完整性测试及修复计划
> 执行方式:当前会话按模块并行排查,协调者统一集成与回归;采用 systematic-debugging、test-driven-development、verification-before-completion。
**目标:** 对指定七个 Web 模块与市场专员、地区经理各五个移动模块建立测试证据,修复可复现缺陷并回归。
**架构:** 沿用现有 FastAPI、Vue 管理端、uni-app 壳与市场 H5;仅修改目标模块及其专用测试。普通角色权限在隔离数据库验证,真实环境使用 admin 验证接口和页面。
**范围:** protocol-audit、presign-order、payment-info、payment-chase、sample-info(客户服务)、sample-freight、payment-confirm;mobile-h5 市场入口与 mobile-oa-h5 市场五模块。OA、生产、质检及其他业务不在修改范围。
## 测试步骤
- [x] 确认运行服务、菜单与代码映射,记录初始工作区修改。
- [x] 使用提供的 admin 账号通过 Web 登录。
- [x] 执行后端目标模块基线测试、移动端 307 项基线及 Web 专项检查。
- [x] 验证七个 Web 列表/详情/表单及十个移动入口,记录浏览器和接口错误。
- [x] 用专用 QA 标记数据验证预签约、转账提交/撤回/退回/确认、转正式、协议缴费、催缴、运费和客户服务。
- [x] 对缺陷增加先失败的回归测试,再实施最小修复。
- [x] 重新运行相关自动化、页面与接口检查,更新知识图谱和字段一致性检查。
- [x] 汇总测试报告、缺陷闭环、残余限制与复测方法。
## 第一轮发现与改造方案
### QA-01 Web 运费缺少角色数据权限
发现:`backend/app/api/sample_freight.py` 调用 CRUD 时未传当前用户数据权限;同租户受限用户能访问超出角色范围的运费。
方案:在运费列表、详情、写入以及可选/关联样本检查现有数据权限;保持多角色并集语义,并保留移动端既有市场角色范围。仅修改运费 API/CRUD 与专用测试。
验证:隔离 SQLite 构造本人/他人、部门及多角色范围,证明未授权列表、详情和修改被拒绝;验证管理员与授权路径仍可用。先运行失败测试,再修复并重跑。
后续缺陷及具体修复记录随实测补充到测试报告,避免将静态猜测记为已确认问题。
## 执行结果
已完成报告:`docs/testing/2026-10-15-storage-market-report.md`。新增缺陷及修复方案、回归证据和真实验收限制见报告;财务成功链路以隔离测试覆盖,严格权限规则未修改。
@@ -0,0 +1,31 @@
# OA 已办中心打印按钮 — Implementation Plan
> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
**Goal:** 为 Web / 小程序【已办中心】补齐打印入口,复用现有 PDF 导出链路。
**Architecture:** 不新增打印引擎;Web 复制 `cc`/`mine` 的 `printRow`;小程序复制 `mine` 的 `onCardLongPress` + `autoPrint`。
**Tech Stack:** Vue 3 + Element Plus(web-admin);uni-app Vue2(mobile-h5)
---
### Task 1: Web 已办中心加打印
**Files:**
- Modify: `web-admin/src/views/oa-approval/done/index.vue`
**Step 1:** 操作列加「打印」按钮与 `printRow`(`instanceId`,`exportOaApprovalPdf`)
**Step 2:** 操作列 `min-width` 调至约 320,避免裁切
---
### Task 2: 小程序已办中心加长按打印
**Files:**
- Modify: `mobile-h5/pages/oa/done/index.vue`
**Step 1:** 卡片 `@longpress="onCardLongPress"`
**Step 2:** `onCardLongPress` + `openView(row, { autoPrint })` 对齐 `mine`
@@ -29,7 +29,7 @@
**Files:**
- Modify: `backend/tests/test_oa_instance_history.py`
- [ ] **Step 1: Extend setUp with SysDept tree and initiator_dept_id on instances**
- [x] **Step 1: Extend setUp with SysDept tree and initiator_dept_id on instances**
Import `SysDept` from `app.models.models`.
@@ -0,0 +1,107 @@
# Security Scan and Weak Password Reset 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:** Deliver a static security scan report (SQLi/XSS etc., no business code fixes) and a script to reset `sys_user` passwords that verify as `111111` to `Zkxw@123`.
**Architecture:** Static grep/read audit of `backend/app` and frontend `src` trees; findings written to Markdown. Weak-password reset uses bcrypt verify in a one-off Python script; SQL file documents why pure SQL cannot match hashes and points to the script.
**Tech Stack:** Python 3.9, bcrypt, SQLAlchemy/pymysql via existing backend settings; Markdown reports under `docs/`.
**Spec:** `docs/superpowers/specs/2026-10-16-security-scan-and-weak-password-design.md`
---
### Task 1: Static security audit and report
**Files:**
- Create: `docs/testing/2026-10-16-security-scan-report.md`
- [x] **Step 1: Search backend for SQL injection patterns**
Run from repo root:
```bash
rg -n "text\(|execute\(|f[\"'].*(SELECT|INSERT|UPDATE|DELETE)|%\s*\(.*SELECT|\.format\(" backend/app --glob '*.py'
rg -n "sql_template|strategy.*sql|_FORBIDDEN_SQL" backend/app --glob '*.py'
```
Read each hit that builds or runs SQL with possible user/config input (especially `workflow_engine.py` SQL approver strategy). Note file:line, risk, suggestion.
- [x] **Step 2: Search frontends for XSS patterns**
```bash
rg -n "v-html|innerHTML|document\.write|eval\(|new Function" web-admin/src mobile-oa-h5/src mobile-h5 miniprogram --glob '*.{vue,js,ts}'
```
For each `v-html`, check whether content passes `sanitizeHtml` / DOMPurify. Exclude vendor noise.
- [x] **Step 3: Spot-check auth / weak-password related info items**
Confirm password hashing (`backend/app/core/security.py`), default `admin`/`111111` docs (`AGENTS.md`, `backend/README.md`). Record as 信息 if relevant.
- [x] **Step 4: Write the report**
Create `docs/testing/2026-10-16-security-scan-report.md` with:
- Summary (counts by severity)
- Findings table/sections: 标题、风险、位置、简述、建议
- Method, scope, limitations
- Explicit “未发现” for categories with clean results after search
Do not modify business application code.
---
### Task 2: Weak-password reset script
**Files:**
- Create: `backend/scripts/reset_weak_password_111111.py`
- Create: `docs/sql/2026-10-16-reset-weak-password-111111.sql`
- [x] **Step 1: Implement Python script**
Create `backend/scripts/reset_weak_password_111111.py` that:
1. Adds repo `backend` to `sys.path` and loads settings like other scripts (reuse `app.core.database` / `app.core.config` / `app.core.security`).
2. Queries `SysUser` where `del_flag == 0`.
3. For each row, `verify_password("111111", password)`; if true and not `--dry-run`, set password via `get_password_hash("Zkxw@123")` and update `update_time` if present.
4. Supports `--dry-run` (list only) and optional `--commit` or default commit with clear print of counts.
5. Prints `user_no`, `id`, `status` for each hit.
Follow patterns in existing `backend/scripts/*.py` for DB session bootstrap.
- [x] **Step 2: Write SQL companion doc**
Create `docs/sql/2026-10-16-reset-weak-password-111111.sql` explaining bcrypt limitation; include example:
```sql
-- 说明:无法用 WHERE password='111111' 命中弱密码。
-- 请使用: python backend/scripts/reset_weak_password_111111.py [--dry-run]
-- 以下仅为「已知单用户」手工更新模板(哈希需现场生成):
-- UPDATE sys_user SET password = '<bcrypt of Zkxw@123>', update_time = NOW()
-- WHERE id = '<user_id>' AND del_flag = 0;
```
Generate one real bcrypt hash of `Zkxw@123` in comments for operators who must UPDATE a known id manually.
- [x] **Step 3: Dry-run verification**
```bash
cd backend && source venv/bin/activate && python scripts/reset_weak_password_111111.py --dry-run
```
Expected: script starts, lists matching users or “0 matches”, does not write. If DB unavailable, document in report/script README comment how to run when DB is up; do not invent failures as bugs.
---
### Task 3: Spec checklist
- [x] **Step 1: Confirm deliverables exist**
- [x] `docs/testing/2026-10-16-security-scan-report.md`
- [x] `backend/scripts/reset_weak_password_111111.py`
- [x] `docs/sql/2026-10-16-reset-weak-password-111111.sql`
- [x] No unrelated business code changes
- [x] **Step 2: Stop for human review** (no auto-commit unless user asks)
@@ -0,0 +1,538 @@
# 移动端缴费信息 · 协议只读 + 缴费明细同屏转账 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.
> **Status:** Tasks 1–6 implemented on `V2.0` (commits `80d238d3`…`d355cd06`). Market suite 323/323 pass. Manual UI checklist still recommended.
**Goal:** 缴费列表「协议单」进入只读协议详情(隐藏编辑/删除);「缴费明细」同屏应缴只读 + 期次转账可写(保存/提交财务/撤回),附件统一 `MarketAttachmentCards`。
**Architecture:** 方案 1——协议复用 `MarketModuleDetail`,用 `query.from=payment` 过滤写动作;缴费详情挂载 `PaymentDetailTransfersPanel`,转账区抽共享 `ScheduleTransferEditor`(从 `ProtocolSamplePaymentPanel` 抽出),API 仍走现有 `/mini/market/{role}/payment-transfers`。
**Tech Stack:** Vue 3 + Vant(`mobile-oa-h5`)、既有 `protocol-sample-transfer.js` 纯函数、`MarketAttachmentCards`、node `--test`
**Spec:** `docs/superpowers/specs/2026-10-17-mobile-payment-detail-parity-design.md`
**Demo:** `docs/demos/2026-10-17-mobile-payment-detail-parity-demo.html`
---
## File map
| 文件 | 职责 |
|------|------|
| Create: `mobile-oa-h5/src/market/payment-entry.js` | `from=payment` 判定与协议动作过滤纯函数 |
| Create: `mobile-oa-h5/src/market/payment-entry.test.js` | 上述纯函数测试 |
| Modify: `mobile-oa-h5/src/views/market/MarketModuleList.vue` | `openProtocol` 附加 `from=payment` |
| Modify: `mobile-oa-h5/src/views/market/MarketModuleDetail.vue` | 协议只读压制;缴费详情挂载转账面板;缴费底栏去掉转账动作 |
| Create: `mobile-oa-h5/src/market/components/ScheduleTransferEditor.vue` | 单期转账卡片 CRUD/提交/撤回/凭证 |
| Create: `mobile-oa-h5/src/market/components/PaymentDetailTransfersPanel.vue` | 缴费详情摘要 + 期次头 + 挂载 Editor |
| Modify: `mobile-oa-h5/src/market/components/ProtocolSamplePaymentPanel.vue` | 转账区改为组合 `ScheduleTransferEditor` |
| Modify: `mobile-oa-h5/src/market/protocol-sample-transfer.js` | `assertCanSaveTransfer` / `canSubmitFinance` 支持 `contextId`(协议或缴费) |
| Modify: `mobile-oa-h5/src/market/mobile-parity-ui.test.js` 等 | 契约断言 |
| Docs only(已存在) | spec + demo,实现中勿改产品决策 |
---
### Task 1: `from=payment` 协议动作过滤(纯函数)
**Files:**
- Create: `mobile-oa-h5/src/market/payment-entry.js`
- Create: `mobile-oa-h5/src/market/payment-entry.test.js`
- [x] **Step 1: 写失败测试**
```js
import test from 'node:test'
import assert from 'node:assert/strict'
import {
isPaymentEntryView,
filterProtocolActionsForPaymentEntry
} from './payment-entry.js'
test('isPaymentEntryView detects from=payment', () => {
assert.equal(isPaymentEntryView({ from: 'payment' }), true)
assert.equal(isPaymentEntryView({ from: 'Payment' }), false)
assert.equal(isPaymentEntryView({}), false)
assert.equal(isPaymentEntryView(null), false)
})
test('filterProtocolActionsForPaymentEntry hides edit and delete', () => {
assert.deepEqual(
filterProtocolActionsForPaymentEntry(['view', 'edit', 'delete', 'create']),
['view']
)
assert.deepEqual(
filterProtocolActionsForPaymentEntry([
{ code: 'edit' },
{ code: 'delete' },
{ code: 'view' }
]),
[{ code: 'view' }]
)
})
```
- [ ] **Step 2: 跑测确认失败**
```bash
cd mobile-oa-h5 && node --test src/market/payment-entry.test.js
```
Expected: FAIL(模块不存在)
- [ ] **Step 3: 最小实现**
```js
/** 缴费信息入口进入协议详情时的只读压制 */
const PROTOCOL_WRITE_CODES = new Set(['edit', 'delete', 'create'])
export function isPaymentEntryView(query) {
return String(query?.from || '') === 'payment'
}
function actionCode(action) {
return typeof action === 'string'
? action
: String(action?.code || action?.action || action?.key || '').trim()
}
export function filterProtocolActionsForPaymentEntry(actions) {
return (Array.isArray(actions) ? actions : []).filter(
(action) => !PROTOCOL_WRITE_CODES.has(actionCode(action))
)
}
```
注:`create` 一般不会出现在详情底栏,一并过滤无害。
- [ ] **Step 4: 跑测通过**
```bash
cd mobile-oa-h5 && node --test src/market/payment-entry.test.js
```
Expected: PASS
- [ ] **Step 5: Commit**
```bash
git add mobile-oa-h5/src/market/payment-entry.js mobile-oa-h5/src/market/payment-entry.test.js
git commit -m "$(cat <<'EOF'
feat(mobile-oa-h5): add payment-entry helpers for readonly protocol view
EOF
)"
```
---
### Task 2: 列表跳转 + 详情只读压制
**Files:**
- Modify: `mobile-oa-h5/src/views/market/MarketModuleList.vue`(`openProtocol`)
- Modify: `mobile-oa-h5/src/views/market/MarketModuleDetail.vue`(`allowedActions`)
- Modify: `mobile-oa-h5/src/market/mobile-parity-ui.test.js`(源码契约)
- [ ] **Step 1: 写失败契约测试**
在 `mobile-parity-ui.test.js` 增加:
```js
test('payment list openProtocol passes from=payment', async () => {
const list = await readFile(new URL('../views/market/MarketModuleList.vue', import.meta.url), 'utf8')
assert.match(list, /from:\s*['"]payment['"]|from:\s*'payment'/)
assert.match(list, /openProtocol/)
})
test('protocol detail filters actions when from=payment', async () => {
const detail = await readFile(new URL('../views/market/MarketModuleDetail.vue', import.meta.url), 'utf8')
assert.match(detail, /isPaymentEntryView|filterProtocolActionsForPaymentEntry/)
})
```
(按文件现有 `readFile` / 断言风格微调。)
- [ ] **Step 2: 跑测确认失败**
```bash
cd mobile-oa-h5 && node --test src/market/mobile-parity-ui.test.js
```
- [ ] **Step 3: 改 `openProtocol`**
在 `MarketModuleList.vue` 的 `openProtocol` query 中增加 `from: 'payment'`(仅当当前模块为 `payment` 或 `payment-chase` 时;**缴费信息列表**与催缴进协议都应用只读——按 spec:缴费入口。催缴若也调 `openProtocol`,同样带 `from=payment` 与产品「只能看」一致;若催缴需编辑,则仅 `context.module === 'payment'` 时附加)。
**本计划明确:** 仅当 `context.value.module === 'payment'` 时附加 `from: 'payment'`。
```js
query: {
...pickMarketNavigationQuery(route.query),
source: item.source || 'cell_storage',
...(context.value.module === 'payment' ? { from: 'payment' } : {})
}
```
- [ ] **Step 4: 改 `MarketModuleDetail` 的 `allowedActions`**
```js
import {
isPaymentEntryView,
filterProtocolActionsForPaymentEntry
} from '../../market/payment-entry.js'
const allowedActions = computed(() => {
const raw = collectAllowedActions(
context.value.module,
context.value.marketRole,
detail.value
)
if (context.value.module === 'protocol' && isPaymentEntryView(route.query)) {
return filterProtocolActionsForPaymentEntry(raw)
}
return raw
})
```
`has-bottom-bar` 已绑定 `allowedActions.length > 0`,过滤后为空则自动无底栏。
- [ ] **Step 5: 跑测通过并 Commit**
```bash
cd mobile-oa-h5 && node --test src/market/payment-entry.test.js src/market/mobile-parity-ui.test.js
git add mobile-oa-h5/src/views/market/MarketModuleList.vue \
mobile-oa-h5/src/views/market/MarketModuleDetail.vue \
mobile-oa-h5/src/market/mobile-parity-ui.test.js
git commit -m "$(cat <<'EOF'
feat(mobile-oa-h5): open protocol from payment as readonly detail
EOF
)"
```
---
### Task 3: 扩展转账纯函数支持缴费 contextId
**Files:**
- Modify: `mobile-oa-h5/src/market/protocol-sample-transfer.js`
- Modify: `mobile-oa-h5/src/market/protocol-sample-transfer.test.js`
- [ ] **Step 1: 写失败测试**
```js
test('assertCanSaveTransfer accepts contextId alias for protocolId', () => {
assert.doesNotThrow(() =>
assertCanSaveTransfer({ contextId: 'pay-1', scheduleId: 's1' })
)
assert.throws(
() => assertCanSaveTransfer({ contextId: '', scheduleId: 's1' }),
/请先保存/
)
})
test('canSubmitFinance accepts contextId', () => {
assert.equal(
canSubmitFinance({ id: 't1', payStatus: 'dfj' }, 'pay-1'),
true
)
})
```
- [ ] **Step 2: 跑测确认失败**
```bash
cd mobile-oa-h5 && node --test src/market/protocol-sample-transfer.test.js
```
- [ ] **Step 3: 实现**
将 `assertCanSaveTransfer` 改为:
```js
export function assertCanSaveTransfer({ protocolId, contextId, scheduleId } = {}) {
const ctx = String(contextId || protocolId || '').trim()
if (!ctx) {
throw new Error('请先保存后再保存转账记录')
}
if (!String(scheduleId || '').trim()) {
throw new Error('缺少应缴批次,无法保存转账记录')
}
}
```
`canSubmitFinance` / `canWithdrawFinance` 第二个参数语义改为「业务上下文 id」(协议 id 或样本缴费 id),保持签名 `(transfer, contextId)`,调用方传 `props.protocolId` 或 `props.samplePaymentId` 即可。错误文案若协议侧测试依赖「请先保存协议…」,则:
```js
if (!ctx) {
throw new Error(
protocolId != null || contextId == null
? '请先保存协议后再保存转账记录'
: '缺少缴费上下文,无法保存转账记录'
)
}
```
更稳妥:保持协议旧文案当仅传 `protocolId`;传 `contextId` 时用中性文案。更新测试断言与之一致。
- [ ] **Step 4: 跑测通过并 Commit**
```bash
cd mobile-oa-h5 && node --test src/market/protocol-sample-transfer.test.js
git add mobile-oa-h5/src/market/protocol-sample-transfer.js \
mobile-oa-h5/src/market/protocol-sample-transfer.test.js
git commit -m "$(cat <<'EOF'
refactor(mobile-oa-h5): allow transfer helpers to use payment contextId
EOF
)"
```
---
### Task 4: 抽出 `ScheduleTransferEditor` 并接到协议面板
**Files:**
- Create: `mobile-oa-h5/src/market/components/ScheduleTransferEditor.vue`
- Modify: `mobile-oa-h5/src/market/components/ProtocolSamplePaymentPanel.vue`
- Modify: `mobile-oa-h5/src/market/mobile-parity-ui.test.js` / `protocol-mobile-parity.test.js`
- [ ] **Step 1: 写失败契约测试**
```js
test('ScheduleTransferEditor exposes save submit withdraw and MarketAttachmentCards', async () => {
const src = await readFile(
new URL('./components/ScheduleTransferEditor.vue', import.meta.url),
'utf8'
)
assert.match(src, /MarketAttachmentCards|PresignAttachmentUploader/)
assert.match(src, /提交财务/)
assert.match(src, /撤回/)
assert.match(src, /添加转账/)
})
```
- [ ] **Step 2: 跑测确认失败**
- [ ] **Step 3: 创建 `ScheduleTransferEditor.vue`**
Props(最小集):
```js
defineProps({
schedule: { type: Object, required: true },
transferTypes: { type: Array, default: () => [] },
marketRole: { type: String, required: true },
contextId: { type: String, required: true }, // protocolId 或 samplePaymentId
disabled: { type: Boolean, default: false }
})
defineEmits(['update:schedule', 'changed'])
```
行为从 `ProtocolSamplePaymentPanel` 迁入(按期次单份):
- `emptyTransferRow` / `validateTransferRow` / `buildTransferSavePayload` / `applySavedTransfer`
- `canAdd` / `canEdit` / `canDelete` / `canSubmit` / `canWithdraw`(用 `canUseProtocolScheduleAction` / `canUseProtocolTransferAction`)
- UI:转账卡片字段 + `PresignAttachmentUploader`(内部即 `MarketAttachmentCards`)
- API:`performMarketAction(context, 'register-transfer'|'edit-transfer'|…)`,`context = { marketRole, module: 'payment' }`(与现面板一致)
- 保存:`data: { scheduleId: schedule.id, ...payload }`;创建用 `register-transfer`,更新用带 id 的 update
从面板剪切转账相关 template/script 时,保持按钮文案与确认框与现网一致。
- [ ] **Step 4: `ProtocolSamplePaymentPanel` 每期改为**
```vue
<ScheduleTransferEditor
:schedule="sch"
:transfer-types="transferTypes"
:market-role="marketRole"
:context-id="protocolId"
:disabled="disabled || !canManageTransfers"
@update:schedule="(next) => replaceSchedule(pIdx, sIdx, next)"
@changed="onTransferChanged"
/>
```
实现 `replaceSchedule`:写回 `modelValue[pIdx].schedules[sIdx]` 并 `emit('update:modelValue')` / dirty 事件。
- [ ] **Step 5: 跑协议相关测通过并 Commit**
```bash
cd mobile-oa-h5 && node --test \
src/market/protocol-sample-transfer.test.js \
src/market/protocol-mobile-parity.test.js \
src/market/mobile-parity-ui.test.js
```
```bash
git add mobile-oa-h5/src/market/components/ScheduleTransferEditor.vue \
mobile-oa-h5/src/market/components/ProtocolSamplePaymentPanel.vue \
mobile-oa-h5/src/market/*.test.js
git commit -m "$(cat <<'EOF'
refactor(mobile-oa-h5): extract ScheduleTransferEditor for shared transfer UI
EOF
)"
```
---
### Task 5: `PaymentDetailTransfersPanel` + 挂到缴费详情
**Files:**
- Create: `mobile-oa-h5/src/market/components/PaymentDetailTransfersPanel.vue`
- Modify: `mobile-oa-h5/src/views/market/MarketModuleDetail.vue`
- Modify: `mobile-oa-h5/src/market/action-policy.js` 或 Detail 内过滤:缴费详情不展示转账底栏动作
- Modify: tests
- [ ] **Step 1: 写失败契约测试**
```js
test('payment detail hosts PaymentDetailTransfersPanel and hides transfer bottom actions', async () => {
const detail = await readFile(new URL('../views/market/MarketModuleDetail.vue', import.meta.url), 'utf8')
assert.match(detail, /PaymentDetailTransfersPanel/)
assert.match(detail, /filterPaymentDetailBottomActions|PAYMENT_TRANSFER_BOTTOM/)
})
```
- [ ] **Step 2: 实现 `PaymentDetailTransfersPanel.vue`**
- Props:`detail`(缴费详情)、`marketRole`、`transferTypes`(可由父组件拉取字典,或面板内 `onMounted` 拉与 Form 相同的转账方式字典——优先父组件传入,与 Form 一致)
- 模板:
1. 摘要区(客户、样本、方式 Tag、合同额、已缴/待缴、进度)——字段取自 `detail` 现有键(对齐 `modules/payment.js` detailSections 摘要)
2. 「应缴批次」标题
3. `v-for="sch in detail.schedules"`:期头只读(第 N 期 · 应缴 · 应缴日 · 已缴 · 欠缴 + 状态 Tag)+ `ScheduleTransferEditor`
- `@changed`:调用父级 `reloadDetail`(emit `refresh`)
样式类名跟现有 `market-detail-*` / Demo 期次卡,勿引入 Web mint 色;用三墙 token。
- [ ] **Step 3: 挂载到 `MarketModuleDetail`**
当 `context.module === 'payment'` 且已加载 `detail`:
```vue
<PaymentDetailTransfersPanel
v-if="context.module === 'payment' && detail"
:detail="detail"
:market-role="context.marketRole"
:transfer-types="paymentTransferTypes"
@refresh="loadDetail"
/>
```
只读 `detailSections` 中「应缴批次 / 转账」重复展示时:对 payment 模块 **跳过** 会重复的 schedule 分区——做法二选一(本计划固定选 A):
- **A(推荐)**:payment 模块详情 **不再渲染** `detailSections` 里的批次转账卡片,仅渲染摘要类 section + `PaymentDetailTransfersPanel`;或 `detailSections` 只返回非 schedule 的概览 section。
- 实现:在 `modules/payment.js` 的 `detailSections` 去掉 schedule 嵌套卡,改为仅概览字段;转账全由 Panel 负责。
- [ ] **Step 4: 隐藏缴费详情底栏转账动作**
在 `payment-entry.js` 增加:
```js
const PAYMENT_TRANSFER_BOTTOM_CODES = new Set([
'register-transfer',
'edit-transfer',
'delete-payment-transfer',
'submit',
'withdraw'
])
export function filterPaymentDetailBottomActions(actions) {
return (Array.isArray(actions) ? actions : []).filter(
(action) => !PAYMENT_TRANSFER_BOTTOM_CODES.has(actionCode(action))
)
}
```
`MarketModuleDetail`:
```js
if (context.value.module === 'payment') {
return filterPaymentDetailBottomActions(raw)
}
```
并为该函数补单测。
转账方式字典:复用 Form 拉取逻辑(查 `MarketModuleForm` 中 transferTypes 来源,抽一小函数或在 Detail `onMounted` 同样请求)。若 Detail 暂无字典 API,可从 `detail` 无关的全局字典接口复制 Form 现有调用。
- [ ] **Step 5: 跑测 + Commit**
```bash
cd mobile-oa-h5 && node --test src/market/payment-entry.test.js \
src/market/protocol-sample-transfer.test.js \
src/market/mobile-parity-ui.test.js \
src/market/module-contracts.test.js \
src/market/module-actions.test.js
```
```bash
git add mobile-oa-h5/src/market/components/PaymentDetailTransfersPanel.vue \
mobile-oa-h5/src/market/modules/payment.js \
mobile-oa-h5/src/market/payment-entry.js \
mobile-oa-h5/src/views/market/MarketModuleDetail.vue \
mobile-oa-h5/src/market/*.test.js
git commit -m "$(cat <<'EOF'
feat(mobile-oa-h5): inline payment detail transfers aligned with web dialog
EOF
)"
```
---
### Task 6: 手工验收清单 + 收尾
- [ ] **Step 1: 本地手工验收(专员或经理账号)**
1. 缴费列表 →「协议单」:分区与协议模块详情一致;底栏无编辑/删除;附件为标准卡片且只读。
2. 从「协议单」模块进同一协议:仍可编辑(无 `from=payment`)。
3. 缴费列表 →「缴费明细」:摘要 + 各期;欠缴期可添加转账;凭证为虚线「添加」卡片。
4. 保存 → 提交财务 → 状态确认中且锁定 → 撤回 → 可再改。
5. 已付款转账无操作按钮。
6. 底栏不再出现「登记转账 / 提交财务确认」等转账入口。
- [ ] **Step 2: 全量相关自动化**
```bash
cd mobile-oa-h5 && node --test src/market/**/*.test.js src/market/presign/**/*.test.js
```
Expected: 全部 PASS(若有与旧「跳转表单」强耦合的断言,按新主路径更新断言,勿保留双路径要求)。
- [ ] **Step 3: Commit 测试/文案修正(若有)**
```bash
git add -u mobile-oa-h5
git commit -m "$(cat <<'EOF'
test(mobile-oa-h5): align payment detail parity contracts with inline transfers
EOF
)"
```
---
## Spec coverage(自检)
| Spec 要求 | Task |
|-----------|------|
| 协议复用详情 + `from=payment` 隐藏编辑/删除 | 1–2 |
| 附件 MarketAttachmentCards | 4–5(Uploader/Cards) |
| 缴费明细同屏应缴只读 + 转账可写 | 4–5 |
| 保存/提交财务/撤回/删除 | 4–5(复用协议面板逻辑) |
| 去掉缴费详情转账底栏主路径 | 5 |
| 不改应缴计划 / 不做移动财务确认 | 非目标,无 Task |
| 复用 payment-transfers API | 4–5 |
| Demo/spec 已存在 | 文档,实现不改决策 |
## Placeholder scan
无 TBD;`transferTypes` 拉取指向 Form 既有实现;`detailSections` 去重选 A 已写死。
## Type / 命名一致性
- Query:`from=payment`
- 共享组件:`ScheduleTransferEditor`
- 缴费面板:`PaymentDetailTransfersPanel`
- 上下文 id:`contextId`(协议 `protocolId` 或缴费 `detail.id` / samplePaymentId)
- 过滤:`filterProtocolActionsForPaymentEntry`、`filterPaymentDetailBottomActions`
@@ -0,0 +1,175 @@
# 采集协议单状态变更记录 · 方案 A 实现计划
> **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:** 详情「状态变更记录」改为与「审核记录」一致的表格流水;每次状态变更追加一行,同类型不覆盖。
**Architecture:** 新增两张追加写历史表(细胞存储 / 科研捐赠),状态变更写路径在更新主表「最新快照字段」的同时插入历史行;详情与移动端只读改为拉历史列表。主表 `effective_*` / `expire_*` / `void_*` / `to_research_*`(捐赠侧 `to_storage_*`)保留为最新快照,供列表筛选与兼容旧数据。
**Tech Stack:** MySQL 5.7 · FastAPI/SQLAlchemy · Vue 3 web-admin · mobile-oa-h5
**UI 定稿:** [docs/demos/2026-10-17-protocol-status-change-records-demo.html](../../demos/2026-10-17-protocol-status-change-records-demo.html) 方案 A(表格流水)
**范围默认:** 细胞存储采集协议单 + 科研捐赠协议单(统一页两个 Tab);移动端详情只读同步。
---
## 文件与职责
| 路径 | 职责 |
|------|------|
| `docs/sql/migrations/2026-10-17-protocol-status-change-log.sql` | 建表 + 从主表快照回填首条历史 |
| `backend/app/models/models.py`(或 donation 模型文件) | `BizProtocolStatusChange` / `BizDonationStatusChange` |
| `backend/app/crud/collection_protocol.py` | 状态变更时写历史;list 历史 API 支撑 |
| `backend/app/crud/research_donation.py` | `change_status` / `convert_from_storage` 写历史;list 历史 |
| `backend/app/api/collection_protocol.py` | `GET .../status-changes` |
| `backend/app/api/research_donation.py` | `GET .../status-changes` |
| `web-admin/.../ProtocolViewDialog.vue` | 表格替换 `data-grid--4` |
| `web-admin/.../DonationViewDialog.vue` | 同上 |
| `web-admin/src/api/collection-protocol.ts` / `research-donation.ts` | 列表 API |
| `mobile-oa-h5/src/market/modules/protocol.js` | 状态变更区块改为行列表(或表格字段集) |
| `backend/tests/test_protocol_status_change_history.py`(新建) | 追加不覆盖 + 回填语义 |
---
## 数据模型
### `biz_protocol_status_change`(细胞存储)
字段顺序:`id` → 业务字段 → 公共字段(对齐 database-conventions)。
| 字段 | 说明 |
|------|------|
| `id` | VARCHAR(64) UUID |
| `collection_protocol_id` | 协议单 ID |
| `change_type` | `activate` / `expire` / `void` / `to_research` |
| `from_status` | 变更前状态码 |
| `to_status` | 变更后状态码(`sxz`/`ygq`/`yzf`/`zky`) |
| `change_time` | 业务时间(表单选择的时间) |
| `change_desc` | 描述 |
| `void_type` | 作废类型(仅 void,可空) |
| `operator_user_id` | 操作人 |
| `tenant_no` … `del_flag` | 公共字段 |
索引:`(tenant_no, collection_protocol_id, del_flag, change_time)`。
### `biz_donation_status_change`(科研捐赠)
对称设计:`research_donation_id` + `change_type`(`activate`/`expire`/`void`/`to_storage`)。
### 回填规则(一次性 SQL)
对主表已有非空时间字段,各插入 1 条历史(`from_status` 可空或按常识推断;`create_by`/`operator` 用协议 `update_by`):
- `effective_time` → `activate`
- `expire_time` → `expire`
- `void_time` → `void`(带 `void_type`)
- `to_research_time` / `to_storage_time` → 对应类型
回填后主表快照字段**不删不改**。
---
## 写路径(追加不覆盖)
```mermaid
flowchart LR
UI[StatusChangeDialog] --> API[update / status-change / convert]
API --> Snap[更新主表最新快照字段]
API --> Log[INSERT 历史行]
Snap --> DB[(MySQL)]
Log --> DB
Detail[ViewDialog / Mobile] --> ListAPI[GET status-changes]
ListAPI --> DB
```
1. **细胞存储生效/过期/作废**:现有 `fetchUpdateCollectionProtocol` 写 `protocolStatus` + 时间描述。在 `update_collection_protocol` 中,当 `protocol_status` 实际变更且对应时间字段被写入时,插入历史行(记录 `from_status`/`to_status`)。
2. **转科研**:`convert_from_storage` 写 `to_research_*` 时同步插历史。
3. **科研捐赠**:`change_status` 每次成功变更插历史;转细胞存储对称处理。
4. 纯编辑其它字段(附件等)**不**写历史。
列表排序:`change_time ASC, create_time ASC`(与 Demo 时间线一致;若产品要最新在上可改为 DESC,前后端统一)。
---
## 前端展示(方案 A)
列(对齐 Demo / 审核记录):
| 列 | 来源 |
|----|------|
| 序号 | index |
| 变更类型 | Tag:`activate→生效` / `expire→过期` / `void→作废` / `to_research→转科研` / `to_storage→转细胞存储` |
| 变更时间 | `changeTime` |
| 状态流转 | `fromLabel → toLabel`(用现有 `protocolStatusDisplayLabel`) |
| 变更说明 | `changeDesc`;作废时前缀「作废类型:xxx;」 |
| 操作人 | 用户昵称 |
空态:`暂无状态变更记录`(`el-table` empty-text)。
去掉现有 `data-grid data-grid--4` 快照拼盘;`hasAnyStatusChange` 改为 `statusChangeRecords.length > 0`。
---
## 任务清单
### Task 1:建表 SQL + 回填
- [x] 编写 `docs/sql/migrations/2026-10-17-protocol-status-change-log.sql`
- [x] 含两张表 CREATE + 从 `biz_collection_protocol` / `biz_research_donation` 回填 INSERT
- [ ] 本地/测试库执行验证行数合理(需在目标库手工执行 migration)
### Task 2:后端模型 + CRUD 写历史
- [x] 增加 SQLAlchemy 模型
- [x] `update_collection_protocol`:状态相关字段写入时 append log
- [x] `convert_from_storage`:append `to_research`
- [x] `change_status`(捐赠):append log
- [x] 捐赠转存储路径若有对称写字段,一并 append
### Task 3:列表 API
- [x] `GET /web/admin/collection-protocols/{id}/status-changes`
- [x] `GET /web/admin/research-donations/{id}/status-changes`
- [x] 返回字段 camelCase;附带 `operatorUserName`;租户隔离 + 软删过滤
- [x] 注册路由(已有 router 模块内新增,无需改 main)
### Task 4:后端测试
- [x] 同类型连续两次变更 → 历史 2 行,主表快照为第二次
- [x] 详情 list API 返回顺序与条数正确(CRUD list 覆盖)
- [x] `pytest` 相关用例通过
### Task 5:web-admin 详情
- [x] `ProtocolViewDialog`:加载历史 + 方案 A 表格
- [x] `DonationViewDialog`:同上
- [x] API 封装
### Task 6:移动端只读对齐
- [x] `mobile-oa-h5` protocol module `statusChange` 区块改为多行记录(非扁平字段)
- [x] 更新 `protocol-mobile-parity` / `mobile-parity-ui` 相关断言
### Task 7:验证与图谱
- [ ] 手动:审核页两个 Tab 打开详情,做两次过期类变更,确认两条都在(需先执行 SQL)
- [x] `./scripts/update-graph.sh all`
---
## 非目标
- 不改状态机合法流转规则(仍用 `assert_protocol_status_transition`)
- 不删除主表快照列
- 不在本迭代做历史编辑/删除 UI
- 不改审核记录表
---
## 验收标准
1. 详情「状态变更记录」为单行表格,不再出现四列网格挤行。
2. 同类型变更第二次后,历史中仍可见第一次。
3. 细胞存储与科研捐赠行为一致。
4. 旧数据经回填后至少能看到各类「最后一次」快照对应的一条历史。
@@ -0,0 +1,20 @@
# OA 已办中心补齐打印按钮
## Goal
在 Web 管理端与小程序【已办中心】补齐与「我发起的 / 抄送我的 / 提到我的」一致的打印能力。
## Scope
- In: `web-admin` `oa-approval/done` 列表操作列「打印」
- In: `mobile-h5` `pages/oa/done` 长按 ActionSheet「打印」→ `autoPrint=1`
- Out: 详情页改动、PDF 模板改动、其它已具备打印的列表页
## Behavior
- Web:拉 `fetchOaInstanceDetail(instanceId)` → `exportOaApprovalPdf`
- 小程序:对齐 `mine` 长按菜单,仅「打印」一项(已办无「复制并重新发起」)
## ID
已办行主键用 `row.instanceId`(与现有「查看」一致);Web 兼容 `instanceId || id`。
@@ -0,0 +1,110 @@
# 安全扫描与弱密码刷新设计
日期:2026-10-16
状态:待评审
## 背景与目标
业务方要求:
1. 对项目做安全扫描,重点关注 SQL 注入、XSS 等常见 Web 安全问题。
2. 将库中密码明文等价于弱密码 `111111` 的用户,统一改为强密码 `Zkxw@123`。
本次交付:**只出报告、不改业务代码**;弱密码另附可执行刷新脚本/SQL。
## 决策摘要
| 项 | 决策 |
|----|------|
| 扫描方式 | 方案 A:静态代码审计(人工 + 定向检索) |
| 扫描交付 | Markdown 报告:问题清单 + 风险等级 + 文件位置 + 简述与建议 |
| 代码修复 | 本次不做;报告中给出建议,后续另开任务 |
| 弱密码目标 | `111111` → `Zkxw@123` |
| 弱密码识别 | 因 bcrypt 随机盐,须用应用侧 `bcrypt.checkpw` 校验,不能纯 SQL `WHERE password='111111'` |
| 弱密码范围 | `sys_user`,`del_flag = 0`;**含已禁用用户**(`status != '1'` 也刷新,避免复用账号时残留弱口令) |
## 1. 安全扫描
### 1.1 范围
**纳入:**
- `backend/app/`:原始 SQL / `text()`、字符串拼接查询、动态 SQL(含工作流审批人 SQL 策略)、鉴权与敏感接口相关模式
- `web-admin/src/`:`v-html`、未消毒 HTML、`innerHTML` 等 XSS 相关用法
- 业务相关前端(如 `mobile-oa-h5/src/`、`mobile-h5/`、`miniprogram/` 中同类模式,若存在)
**排除:**
- `backend/venv/`、`node_modules/`、第三方静态资源(如 `web-admin/public/tinymce/`)
- 纯 Demo / mockup HTML(`docs/**` 演示页、`mobile-ui/**` 等),除非被生产路径引用
### 1.2 检查类别(至少覆盖)
| 类别 | 关注点 |
|------|--------|
| SQL 注入 | `text()` + 用户可控拼接;`f"...SELECT..."`;`%` / `.format` 拼 SQL;工作流 `strategy=sql` |
| XSS | `v-html` 是否经 `sanitizeHtml`/DOMPurify;未消毒的 `innerHTML` |
| 认证/口令(信息项) | 默认弱口令文档、明文登录开关等(记入报告,不强制本次改代码) |
| 其他高信号 | 硬编码密钥/口令、危险 `eval`/`new Function`(业务代码) |
### 1.3 风险等级
- **高**:可被外部/低权限用户直接利用,导致读改删数据或执行脚本
- **中**:需特定权限/配置或利用链较长,仍有实质影响
- **低**:防御不完善但当前利用面小,或仅内部可控场景
- **信息**:加固建议、文档/默认配置风险,非直接漏洞
### 1.4 报告格式与路径
路径:`docs/testing/2026-10-16-security-scan-report.md`
每条问题包含:
1. 标题
2. 风险等级
3. 文件位置(路径 + 尽量到函数/行号)
4. 问题简述
5. 修复建议(文字,不直接改代码)
报告末尾附:扫描方法说明、覆盖范围、已知局限(静态审计无法替代动态渗透)。
## 2. 弱密码刷新
### 2.1 约束
- `sys_user.password` 存 **bcrypt**(`$2b$...`),每次哈希盐不同。
- 无法用单条 `UPDATE ... WHERE password = '111111'` 命中所有弱密码用户。
- 新密码明文:`Zkxw@123`(写入运维说明;哈希由脚本生成)。
### 2.2 交付物
| 文件 | 作用 |
|------|------|
| `backend/scripts/reset_weak_password_111111.py` | **主路径**:连接当前环境库,逐用户 `verify` 是否为 `111111`,命中则更新为 `Zkxw@123` 的新 bcrypt 哈希;打印命中 `user_no` / 数量;支持 `--dry-run` |
| `docs/sql/2026-10-16-reset-weak-password-111111.sql` | **辅助**:说明为何不能纯 SQL 筛选;给出预生成示例哈希与单条 `UPDATE` 模板;引导使用上述 Python 脚本 |
### 2.3 脚本行为
1. 读取环境 DB 配置(与现有 backend 一致:`.env` / `.env.local` 等)。
2. 查询 `sys_user`:`del_flag = 0`,取出 `id, user_no, password, status`。
3. 对每条用 bcrypt 校验明文 `111111`;命中则 `password = bcrypt(Zkxw@123)`,更新 `update_time`(若列存在)。
4. 默认提交事务;`--dry-run` 只列出将修改的账号。
5. 不修改业务应用代码、不重置非 `111111` 的密码。
### 2.4 运维注意
- 执行前备份 `sys_user` 或整库。
- 执行后通知相关用户使用新密码,并建议首次登录后自行修改。
- 文档中的默认账号说明(如 `admin` / `111111`)后续由文档任务单独更新(本次可不改 AGENTS.md,可在报告「信息」项列出)。
## 3. 非目标
- 不修复报告中的代码漏洞
- 不做完整渗透测试、依赖 CVE 全量扫描、基础设施扫描
- 不批量重置「所有用户」密码,仅命中弱密码 `111111` 的用户
## 4. 验收标准
1. 存在上述安全扫描报告,且至少覆盖 SQL 注入与 XSS 两类检索结论(含「未发现」亦需写明检索范围)。
2. 存在弱密码 Python 脚本与 SQL 说明文件;`--dry-run` 可列出命中用户;正式执行后原 `111111` 用户可用 `Zkxw@123` 登录。
3. 业务源码无功能性改动(仅新增 docs/scripts/sql 交付物)。
@@ -0,0 +1,170 @@
# 移动端缴费信息 · 协议只读 + 缴费明细同屏转账(对齐 Web)
**日期:** 2026-10-17
**状态:** 设计已确认(待实现)
**Demo:** `docs/demos/2026-10-17-mobile-payment-detail-parity-demo.html`
**实现路径:** 方案 1 — 复用现有协议详情路由 + 缴费详情内嵌转账区
**对齐权威:**
- Web:`docs/superpowers/specs/2026-10-10-payment-info-detail-list-mode-design.md`
- 移动转账视觉:`docs/superpowers/specs/2026-10-14-payment-detail-transfer-display-design.md`
- 协议内转账:`ProtocolSamplePaymentPanel.vue`、`MarketAttachmentCards.vue`
## 1. 背景与目标
### 1.1 现状
地区经理 / 市场专员在 `mobile-oa-h5`「缴费信息」列表有两个操作:
| 按钮 | 现状 | 问题 |
|------|------|------|
| 协议单 | 已跳转 `protocol-detail` | 详情底栏仍可能出现编辑等写动作;产品要求从缴费入口只能看 |
| 缴费明细 | 只读分区 + 底栏跳独立表单登记/编辑转账 | 与 Web「缴费明细」弹窗(同屏期次下转账)交互不一致 |
`mobile-h5` 仅为 WebView 壳,无独立业务实现;改动落在 `mobile-oa-h5`。
### 1.2 目标
1. **协议单**:打开与小程序「协议单」模块**同一套详情界面**;从缴费入口进入时**完全隐藏编辑 / 删除**(决策 A)。
2. **缴费明细**:对齐 Web 缴费信息页「缴费明细」弹窗语义——应缴只读;每一期可增加转账记录,支持保存、提交财务审核、撤回、删除草稿。
3. **附件**:协议详情与转账凭证统一使用小程序标准附件卡片(`MarketAttachmentCards`,与协议单新增一致)。
### 1.3 已确认决策
| 项 | 决策 |
|----|------|
| 实现路径 | **方案 1**:复用现有页面/组件,不新建第二套协议详情 |
| 协议入口写动作 | **A**:完全隐藏编辑/删除;改协议去「协议单」模块 |
| 缴费明细 UX | 同屏期次下转账可写(Demo 第 3 Tab);非跳转独立表单为主路径 |
| 附件样式 | `MarketAttachmentCards`(84×84;可写态虚线「添加」+ 删除角标;只读态无添加/删除,保留预览/下载) |
| 专员 vs 经理 | 缴费写能力同权;仅数据范围不同 |
| 后端 | 复用现有 market `payment-transfers` API,不新增资源模型 |
## 2. 信息架构
```
缴费信息列表(specialist | manager)
├─「协议单」
│ → market-{role}-protocol-detail
│ → query 增加来源标记 from=payment
│ → MarketModuleDetail + protocol.detailSections
│ → 过滤 edit / delete;无写动作时可隐藏底栏
│
└─「缴费明细」
→ market-{role}-payment-detail
→ 摘要 + 应缴批次只读
→ 每期内嵌转账卡片(可写)
→ 凭证 = MarketAttachmentCards
```
### 2.1 产品边界(不变)
- 不在缴费菜单修改应缴计划(趸交/分期方案仍在协议单编辑内改)。
- 财务确认 / 拒绝仅 Web「缴费财务确认」。
- 不改 Web 缴费明细弹窗本身。
## 3. 界面与交互
### 3.1 协议单(只读压制)
- 跳转仍复用 `MarketModuleList.openProtocol`,附加 query:`from=payment`(固定键名,不做别名)。
- `MarketModuleDetail`:当 `route.query.from === 'payment'` 时,`allowedActions` 排除 `edit`、`delete` 及任何写协议动作。
- 详情分区、附件与「协议单」模块详情一致(协议信息 / 采集 / 客户 / 样本 / 缴费摘要 / 退费 / 审核 / 附件等)。
- 附件:`MarketAttachmentCards` 且 `editable=false`。
- **不**新建独立协议只读页。
### 3.2 缴费明细(同屏转账)
对齐 Web 样本缴费详情弹窗 + 移动 Demo:
1. **摘要区**:客户、样本编码、缴费方式 Tag、合同额、已缴/待缴、整体进度、缴费进度 Tag。
2. **应缴批次**:按 `scheduleNo` 升序;期头只读(应缴、应缴日、已缴、欠缴、状态 Tag)。
3. **添加转账**:`arrearsAmount > 0` 且业务允许时显示;已缴清期不显示添加。
4. **转账卡片**(列表模式语义,移动为卡片而非表格):
| 字段 | 可编辑条件 |
|------|------------|
| 转账方式 | 非锁定(非 `jfqrz` / `yjf`) |
| 转账金额 | 同上 |
| 转账时间 | 同上 |
| 转账凭证 | 同上;`MarketAttachmentCards` / `PresignAttachmentUploader` |
| 备注 | 同上 |
| 财务备注 | 只读 |
| 状态 | Tag:`dfj` / `jfqrz` / `yjf` |
| 状态 | 操作 |
|------|------|
| `dfj`(含未落库草稿) | 保存;有 id 可提交财务;可删除 |
| `jfqrz` | 仅撤回 |
| `yjf` | 无操作(—) |
校验与文案对齐 `ProtocolSamplePaymentPanel`:
- 转账方式必填;金额 > 0。
- 上传中禁止保存。
- 未保存不可提交 → Toast「请先保存该转账记录后再提交财务确认」。
- 提交 / 撤回 / 删除需二次确认。
### 3.3 与现有底栏动作
同屏可写落地后,缴费详情底栏**不再展示** `register-transfer` / `edit-transfer` / `submit` / `withdraw` / `delete-payment-transfer` 等转账相关动作(避免双路径)。API 仍由同屏面板直接调用。
## 4. 组件与数据流
### 4.1 组件职责
| 单元 | 职责 |
|------|------|
| `MarketModuleList` | 「协议单」跳转带 `from=payment`;「缴费明细」进 payment-detail |
| `MarketModuleDetail` | `from=payment` 时过滤协议写动作 |
| `ScheduleTransferEditor`(新建共享子组件,从 `ProtocolSamplePaymentPanel` 抽出转账区) | 单期/多样本共用:转账卡片 CRUD、提交/撤回、凭证卡片;**不含**改应缴计划 |
| `PaymentDetailTransfersPanel`(新建,挂在缴费详情) | 拉缴费详情数据;渲染摘要 + 期次头(应缴只读)+ 每期挂载 `ScheduleTransferEditor` |
| `ProtocolSamplePaymentPanel` | 保留配方案 UI;转账区改为组合 `ScheduleTransferEditor`,避免双套状态机 |
| `modules/payment.js` | 配合详情挂载可写面板所需数据;弱化「纯只读 section + 跳表单」主路径 |
| `MarketAttachmentCards` | 协议详情只读附件;转账凭证可写/只读 |
### 4.2 数据流
```
打开缴费明细 → GET /mini/market/{role}/payments/{id}
添加/编辑转账(本地)→ 保存:POST 或 PUT .../payment-transfers
提交财务 → POST .../payment-transfers/{id}/submit → jfqrz
撤回 → POST .../withdraw → dfj
删除草稿 → DELETE(未落库仅本地移除)
成功后刷新详情或 patch 本地行
```
凭证上传:复用现有 market 附件上传策略(accept / maxSize 与协议单新增一致)。
### 4.3 错误与并发
- 接口失败:Toast 展示错误,不静默成功。
- 单行 `busyKey` 防重复点击。
- 校验失败不发请求。
## 5. 测试要点
- `from=payment`:协议详情无 edit/delete;无该标记时行为不变。
- 缴费详情:欠缴期可添加;`dfj` 可保存/提交/删;`jfqrz` 仅撤回;`yjf` 锁定。
- 附件:卡片规格与协议新增一致;详情只读无添加/删除。
- 回归:协议编辑内转账链路仍可用。
- 合约/UI 测试:缴费主路径不再依赖跳转独立转账表单。
## 6. 非目标
- 不改 Web 缴费明细弹窗实现。
- 不开放移动端财务确认/拒绝。
- 不在缴费菜单改分期/趸交方案。
- 不新增后端资源模型。
- `mobile-h5` 无独立业务页改动(壳层入口不变即可)。
## 7. 参考路径
| 类型 | 路径 |
|------|------|
| Demo | `docs/demos/2026-10-17-mobile-payment-detail-parity-demo.html` |
| Web 弹窗 | `web-admin/src/components/business/sample-payment-detail-dialog/index.vue` |
| 移动协议详情分区 | `mobile-oa-h5/src/market/modules/protocol.js` → `detailSections` |
| 移动协议内转账 | `mobile-oa-h5/src/market/components/ProtocolSamplePaymentPanel.vue` |
| 附件标准 | `mobile-oa-h5/src/market/components/MarketAttachmentCards.vue` |
| 缴费列表动作 | `mobile-oa-h5/src/market/list-presenter.js`、`MarketModuleList.vue` |
| 后端 | `backend/app/api/market_mobile.py`、`backend/app/services/market_payment.py` |