64 lines
3.2 KiB
Markdown
64 lines
3.2 KiB
Markdown
# System Permission Split Tabs And Empty Org Mind Map 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:** Rework 系统权限管理 into two independent tabs, make 组织脑图 initialize as a single 总公司 root, and support right-click organization/person maintenance without polluting miniapp personnel master data.
|
|
|
|
**Architecture:** Keep `sys_department` as the organization-node table and add a small `sys_org_employee_binding` table for explicit mind-map personnel leaves. Backend owns root creation, level rules, deletion safety, manager binding, and employee binding. Frontend uses a full-width mind-map tab plus a separate personnel/role tab, with a deterministic non-draggable SVG mind map and a context menu.
|
|
|
|
**Tech Stack:** FastAPI, SQLAlchemy 2, Pydantic, MySQL 8 / SQLite tests, Vue 3, Vite, plain SVG/CSS.
|
|
|
|
---
|
|
|
|
### Task 1: Backend Data Model And Service Rules
|
|
|
|
**Files:**
|
|
- Modify: `backend/app/models/org.py`
|
|
- Modify: `backend/app/schemas/system_permissions.py`
|
|
- Modify: `backend/app/services/system_permissions.py`
|
|
- Modify: `backend/app/api/routes/system_permissions.py`
|
|
- Test: `backend/tests/test_system_permission_management.py`
|
|
|
|
- [ ] Add failing tests for empty-root org tree, explicit employee binding, delete guards, and valid child node types.
|
|
- [ ] Implement `OrgEmployeeBinding` model and schema fields.
|
|
- [ ] Build org tree from the managed root only, not legacy root departments.
|
|
- [ ] Add create/update/delete org node service rules.
|
|
- [ ] Add bind/unbind employee leaf service rules.
|
|
- [ ] Run backend focused tests.
|
|
|
|
### Task 2: SQL Patch
|
|
|
|
**Files:**
|
|
- Create: `backend/sql/add_system_permission_org_mindmap_patch.sql`
|
|
|
|
- [ ] Create `sys_org_employee_binding` safely.
|
|
- [ ] Ensure one `ORG_ROOT` company root named `总公司` exists.
|
|
- [ ] Support `GROUP` node type in comments/default expectations.
|
|
- [ ] Execute the patch against current test DB.
|
|
- [ ] Verify table and root exist.
|
|
|
|
### Task 3: Frontend Page Split And Mind Map Interactions
|
|
|
|
**Files:**
|
|
- Modify: `frontend/src/views/SystemPermissionView.vue`
|
|
- Modify: `frontend/src/components/OrgMindMap.vue`
|
|
- Modify: `frontend/scripts/test-system-permission-management-ui.mjs`
|
|
|
|
- [ ] Add static UI assertions for two top-level tabs, personnel/role tab separation, right-click menu, default collapsed employee leaves, and no free dragging.
|
|
- [ ] Rework `SystemPermissionView.vue` into `组织脑图` and `人员与角色维护` tabs.
|
|
- [ ] Move role/user cards and new-user action into `人员与角色维护`.
|
|
- [ ] Add right-click context menu commands by node type.
|
|
- [ ] Rework org drawer modes: rename, add child, set manager, add employee.
|
|
- [ ] Rework `OrgMindMap.vue` to show organization nodes first and collapse employee leaves behind a plus toggle.
|
|
- [ ] Run frontend static UI test and production build.
|
|
|
|
### Task 4: Final Verification
|
|
|
|
**Files:**
|
|
- Backend and frontend touched above.
|
|
|
|
- [ ] Run backend focused test.
|
|
- [ ] Run frontend static UI test.
|
|
- [ ] Run frontend build.
|
|
- [ ] Summarize SQL execution and verification output.
|