liuyun ad002003fe chore(openspec): track fe-admin-user-page implementation
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-11 01:16:08 +08:00

41 lines
2.2 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.

## Context
布局壳已完成(`frontend/AD/layout`)。菜单占位数据里「用户管理」指向 `/system/user`,但该路由页面尚未创建。本阶段只做界面,占位数据字段对齐后端 User 模型,后端对接放到后续。
## Goals / Non-Goals
**Goals:**
- 跑通 CRUD 页面模式(搜索 + 表格 + 分页 + 弹窗表单 + 删除确认 + 重置密码),作为后续页面的模板。
- 数据源隔离在 `src/api/user.ts`,页面只调其函数,后续换 http 不动页面。
**Non-Goals:**
- 不接后端真实接口;不做「关联角色/部门」的跨域操作;不抽公共 CRUD 组件(等第二个页面再抽共性)。
## Decisions
### D1. 数据源:mock 模块,契约对齐后端
`src/api/user.ts` 导出异步函数(`listUsers/createUser/updateUser/deleteUser/resetPassword`),内部用模块级数组模拟数据,返回 `{code:0, message:'ok', data}`。字段严格对齐后端 `User`(`id/tenantCode/username/nickname/email/phone/status/orgCode/createdAt`)。
- 备选:页面内联 mock。放弃——后续接后端要改页面,隔离到 api 模块换实现即可。
- 该模块用注释标注「TODO: 对接后端」,后续替换为 `http` 调用。
### D2. 页面结构(直接使用 Element Plus)
`src/pages/system/user/index.vue` 使用 el-form(搜索)+ el-table(列表)+ el-pagination(分页)+ el-dialog + el-form(新增/编辑/重置密码)+ ElMessage/ElMessageBox(提示/确认)。
- 不抽公共组件:等第二个域页面出现重复再提取(YAGNI)。
- 页面用 `<route>` 块声明 `meta`(breadcrumb/title 等可后续补)。
### D3. 状态与组织展示
状态 `status` 用 el-tag 区分(enabled=success / disabled=info / locked=danger)。所属组织 `orgCode` 在表格显示组织名(mock 内联一个 org 映射),表单用 el-select 选择。
## Risks / Trade-offs
- [mock 数据不持久] → 刷新即重置,仅用于界面演示;接后端后自然解决。
- [公共组件抽取时机] → 先做单页,第二个域页面出现重复时再抽 `ty-*` 公共组件。
## Migration Plan
- 纯前端新增,无迁移。回滚 `git revert`。
## Open Questions
(无)