2026-08-06-oa-drafts-pending-menu-badge.md 1.8 KB

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: 侧栏「草稿箱」「待办中心」展示数量角标,对齐「抄送我的」。

Architecture: 后端增加轻量 count 接口;前端扩展 oa-menu-badge store 与 refreshOaMenuBadges,在相关页操作后刷新。

Tech Stack: FastAPI / SQLAlchemy / Vue 3 / Pinia

Spec: docs/superpowers/specs/2026-08-06-oa-drafts-pending-menu-badge-design.md


Task 1: Backend count helpers + API

Files:

  • Modify: backend/app/services/oa_engine.py(count_pending_tasks)
  • Modify: backend/app/crud/oa_instance_draft.py(count_drafts)
  • Modify: backend/app/api/oa_approval.py
  • Test: backend/tests/test_oa_menu_badge_counts.py

  • [x] Step 1: 写失败单测(mock query.count)

  • [x] Step 2: 实现 count_pending_tasks / count_drafts + 路由

  • [x] Step 3: 跑通 pytest

Task 2: Frontend badge wiring

Files:

  • Modify: web-admin/src/store/modules/oa-menu-badge.ts
  • Modify: web-admin/src/utils/oa-menu-badge.ts
  • Modify: web-admin/src/api/oaApproval.ts
  • Modify: web-admin/src/views/oa-approval/drafts/index.vue
  • Modify: web-admin/src/views/oa-approval/pending/index.vue
  • Modify: web-admin/src/views/oa-approval/start/index.vue
  • Modify: web-admin/src/views/oa-approval/instances/detail.vue
  • Modify: web-admin/src/store/modules/user.ts

  • [x] Step 1: API + store codes + refresh 并行拉取

  • [x] Step 2: 页面操作后 refresh;logout clear

  • [x] Step 3: 更新 graphify(frontend + backend;HTML viz 过大时跳过)