From 02f2c6660b464d3a6ee5dc4ef1a8f7b60204650f Mon Sep 17 00:00:00 2001 From: Cheng Zhou Date: Thu, 4 Jun 2026 11:13:28 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E6=9D=83=E9=99=90=E4=B8=8E?= =?UTF-8?q?=E7=89=A9=E8=B5=84=E5=AE=9E=E7=8E=B0=E8=AE=A1=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1、记录项目权限一致性实施计划,明确前后端权限矩阵以接口权限为准。 2、列出快捷入口、参与者操作、路由权限和权限契约测试的实施任务。 3、记录物资设备详情页实施计划,覆盖路由、详情页和列表导航入口。 4、保留验证步骤与约束说明,便于后续按计划复查实现范围。 --- ...t-permission-consistency-implementation.md | 57 +++++++++++++++++++ .../2026-06-02-material-equipment-detail.md | 38 +++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 docs/plans/2026-05-29-project-permission-consistency-implementation.md create mode 100644 docs/plans/2026-06-02-material-equipment-detail.md diff --git a/docs/plans/2026-05-29-project-permission-consistency-implementation.md b/docs/plans/2026-05-29-project-permission-consistency-implementation.md new file mode 100644 index 00000000..407a55ff --- /dev/null +++ b/docs/plans/2026-05-29-project-permission-consistency-implementation.md @@ -0,0 +1,57 @@ +# Project Permission Consistency Implementation Plan + +> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. + +**Goal:** Make project-level backend permissions and frontend route/menu/action visibility consistent. + +**Architecture:** Treat backend `API_ENDPOINT_PERMISSIONS` and effective `/api-permissions/me` matrix as the source of truth. Frontend route guards, menus, quick actions, page actions, and attachment controls should only project that matrix into visibility or disabled states. + +**Tech Stack:** FastAPI, SQLAlchemy, pytest, Vue 3, Pinia, Vue Router, Element Plus, Vitest. + +--- + +### Task 1: Frontend Action Visibility + +**Files:** +- Modify: `frontend/src/components/QuickActions.vue` +- Modify: `frontend/src/views/ia/SubjectManagement.vue` +- Modify: `frontend/src/utils/permission.ts` +- Test: `frontend/src/components/QuickActions.test.ts` +- Test: `frontend/src/views/ia/SubjectManagement.test.ts` +- Test: `frontend/src/utils/permission.test.ts` + +**Steps:** +1. Write failing source-level tests that prove quick actions are filtered by `getProjectRoutePermission`/`hasProjectPermission`. +2. Write failing source-level tests that prove subject create/delete actions are guarded by `subjects:create` and `subjects:delete`. +3. Add minimal permission checks in the affected components. +4. Run the targeted Vitest files and confirm they pass. + +### Task 2: Permission Contract Coverage + +**Files:** +- Modify: `frontend/src/utils/projectRoutePermissions.test.ts` +- Modify: `backend/tests/test_api_permissions.py` + +**Steps:** +1. Add tests for route landing paths and project route mappings using backend operation key names already present in the frontend contract. +2. Extend backend configuration tests so service-level checks are included where feasible, especially document and attachment permission mappings. +3. Keep tests focused on permission contract shape, not business data setup. +4. Run targeted backend pytest files. + +### Task 3: Verification + +**Files:** +- No production files unless tests identify another mismatch. + +**Steps:** +1. Run targeted frontend tests. +2. Run frontend type check if dependencies are available. +3. Run targeted backend permission tests. +4. Report exact commands and results. + +### Constraints + +- Do not create branches. +- Do not commit. +- Do not revert unrelated dirty worktree changes. +- Keep changes narrow and avoid redesigning permission management. diff --git a/docs/plans/2026-06-02-material-equipment-detail.md b/docs/plans/2026-06-02-material-equipment-detail.md new file mode 100644 index 00000000..764fb578 --- /dev/null +++ b/docs/plans/2026-06-02-material-equipment-detail.md @@ -0,0 +1,38 @@ +# Material Equipment Detail Implementation Plan + +> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. + +**Goal:** Add a read-only detail page for material equipment records in the material management module. + +**Architecture:** Reuse the existing material equipment API detail endpoint and the project detail-page layout conventions. Add one route, one detail view, and one list-page navigation entry without changing create/update/delete behavior. + +**Tech Stack:** Vue 3, Vue Router, Element Plus, Vitest static source tests. + +--- + +### Task 1: Route And Navigation Tests + +**Files:** +- Modify: `frontend/src/views/detailNavigation.test.ts` +- Modify: `frontend/src/views/detailBreadcrumbContext.test.ts` +- Modify: `frontend/src/views/ia/MaterialEquipment.test.ts` + +**Steps:** +1. Add the future equipment detail view to detail-navigation expectations. +2. Add breadcrumb expectations for equipment detail page title. +3. Add a list-page expectation for detail navigation. +4. Run the focused tests and confirm they fail because the route/view/link do not exist yet. + +### Task 2: Detail Page Implementation + +**Files:** +- Create: `frontend/src/views/materials/MaterialEquipmentDetail.vue` +- Modify: `frontend/src/router/index.ts` +- Modify: `frontend/src/views/ia/MaterialEquipment.vue` + +**Steps:** +1. Build a read-only detail view using `getMaterialEquipment`. +2. Set breadcrumb context using the equipment name. +3. Register `/materials/equipment/:equipmentId`. +4. Add the list table detail link. +5. Run focused frontend tests and type/build verification where feasible.