Files
AIclinicalresearch/docs/_templates/README.md
HaHafeng 66255368b7 feat(admin): Add user management and upgrade to module permission system
Features - User Management (Phase 4.1):
- Database: Add user_modules table for fine-grained module permissions
- Database: Add 4 user permissions (view/create/edit/delete) to role_permissions
- Backend: UserService (780 lines) - CRUD with tenant isolation
- Backend: UserController + UserRoutes (648 lines) - 13 API endpoints
- Backend: Batch import users from Excel
- Frontend: UserListPage (412 lines) - list/filter/search/pagination
- Frontend: UserFormPage (341 lines) - create/edit with module config
- Frontend: UserDetailPage (393 lines) - details/tenant/module management
- Frontend: 3 modal components (592 lines) - import/assign/configure
- API: GET/POST/PUT/DELETE /api/admin/users/* endpoints

Architecture Upgrade - Module Permission System:
- Backend: Add getUserModules() method in auth.service
- Backend: Login API returns modules array in user object
- Frontend: AuthContext adds hasModule() method
- Frontend: Navigation filters modules based on user.modules
- Frontend: RouteGuard checks requiredModule instead of requiredVersion
- Frontend: Remove deprecated version-based permission system
- UX: Only show accessible modules in navigation (clean UI)
- UX: Smart redirect after login (avoid 403 for regular users)

Fixes:
- Fix UTF-8 encoding corruption in ~100 docs files
- Fix pageSize type conversion in userService (String to Number)
- Fix authUser undefined error in TopNavigation
- Fix login redirect logic with role-based access check
- Update Git commit guidelines v1.2 with UTF-8 safety rules

Database Changes:
- CREATE TABLE user_modules (user_id, tenant_id, module_code, is_enabled)
- ADD UNIQUE CONSTRAINT (user_id, tenant_id, module_code)
- INSERT 4 permissions + role assignments
- UPDATE PUBLIC tenant with 8 module subscriptions

Technical:
- Backend: 5 new files (~2400 lines)
- Frontend: 10 new files (~2500 lines)
- Docs: 1 development record + 2 status updates + 1 guideline update
- Total: ~4900 lines of code

Status: User management 100% complete, module permission system operational
2026-01-16 13:42:10 +08:00

92 lines
1.5 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.
# 文档模板
> **目录说明:** 本目录包含各类文档的标准模板
> **使用方法:** 创建新文档时,复制对应模板,填充内容
---
## 📋 模板清单
| 模板 | 说明 | 适用场景 |
|------|------|---------|
| **[AI对接] 快速上下文-模板.md** | 快速上下文文档模板 | 创建新模块/能力时 |
| **模块README-模板.md** | 模块README模板 | 创建新业务模块时 |
---
## 🎯 使用说明
### 1. 创建新业务模块
**步骤:**
1. 复制 `模块README-模板.md` 到新模块目录
2. 重命名为 `README.md`
3. 填充所有 `[占位符]` 内容
4. 删除不需要的章节
### 2. 创建快速上下文文档
**步骤:**
1. 复制 `[AI对接] 快速上下文-模板.md` 到对应目录
2. 重命名为 `[AI对接] [模块代号]快速上下文.md`
3. 填充所有内容
4. 确保Token消耗在目标范围内
---
## 📏 模板规范
### 快速上下文文档规范
**L0级别总体**
- Token消耗~800
- 阅读时间2分钟
- 内容:项目全貌、快速跳转
**L1级别层级**
- Token消耗~1500
- 阅读时间3分钟
- 内容:层级概览、模块清单
**L2级别模块**
- Token消耗~2000
- 阅读时间5分钟
- 内容:模块详情、开发指南
---
## 🔗 相关文档
- [文档体系重构方案](../00-系统总体设计/02-文档体系重构方案.md)
---
**最后更新:** 2025-11-06
**维护人:** 技术架构师