Files
zkxw/docs/superpowers/plans/2026-08-11-oa-task-centers-pagination.md
T
2026-08-11 11:13:01 +08:00

45 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# OA 四个中心列表分页 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:** 为待办/已办/我发起的/抄送我的四中心补前后端分页,默认每页 20 条。
**Architecture:** `list_tasks` 在 DB 查询上 count + offset/limit,返回 `{list,total}`;API 透传 page/pageSize;四页 Vue 对齐草稿箱分页条。
**Tech Stack:** FastAPI + SQLAlchemy;Vue 3 + Element Plus;unittest。
---
### Task 1: 后端分页测试(TDD)
**Files:**
- Create: `backend/tests/test_oa_tasks_pagination.py`
- Modify: `backend/tests/test_oa_engine.py`(适配返回结构)
- [ ] 写失败测试:创建多条 pending,`page=1,page_size=20` 时 `len(list)==20` 且 `total` 更大;`page=2` 条数正确
- [ ] 跑测确认失败
- [ ] 实现后绿;同步改现有 `list_tasks(...)` 调用为 `["list"]`
### Task 2: `list_tasks` + API
**Files:**
- Modify: `backend/app/services/oa_engine.py`(`list_tasks`)
- Modify: `backend/app/api/oa_approval.py`(`list_oa_tasks`)
- [ ] `page`/`page_size` 规范化;四 kind 分页;返回 `{list,total}`
- [ ] API Query + `success_response({"list","total"})`
### Task 3: 前端 API + 四页
**Files:**
- Modify: `web-admin/src/api/oaApproval.ts`
- Modify: `web-admin/src/views/oa-approval/{pending,done,mine,cc}/index.vue`
- [ ] `fetchOaTasks` 增加 page/pageSize,类型含 total
- [ ] 四页分页 UI 与加载逻辑对齐草稿箱
### Task 4: 验证
- [ ] `pytest tests/test_oa_tasks_pagination.py tests/test_oa_engine.py -q`
- [ ] `./scripts/update-graph.sh backend`(若后端签名变更)