37 lines
2.7 KiB
Markdown
37 lines
2.7 KiB
Markdown
## 1. 后端模型与CRUD
|
||
|
||
- [ ] 1.1 在 `backend/app/models/models.py` 新增 SysDictType、SysDictData SQLAlchemy 模型,遵循 V0.3 公共字段约定(id, 业务字段, tenant_no, order_num, remark, create_by, create_dept_id, create_time, update_by, update_time, del_flag)
|
||
- [ ] 1.2 在 `backend/app/models/__init__.py` 导出新模型
|
||
- [ ] 1.3 创建 `backend/app/crud/dict_type.py`:实现 list_dict_types、get_dict_type、create_dict_type、update_dict_type、soft_delete_dict_type 函数,包含 _row_to_dict 转换、关键词搜索、分页、唯一性校验
|
||
- [ ] 1.4 创建 `backend/app/crud/dict_data.py`:实现 list_dict_data、get_dict_data、create_dict_data、update_dict_data、soft_delete_dict_data 函数,包含按 dict_type 过滤、dict_label 搜索、分页
|
||
- [ ] 1.5 实现 dict-data options 下拉查询接口的 CRUD 函数(不分页,返回 label+value 列表)
|
||
|
||
## 2. 后端API路由
|
||
|
||
- [ ] 2.1 在 `backend/app/api/admin.py` 新增字典类型 CRUD 路由(GET /dict-types, POST /dict-types, PUT /dict-types/{id}, DELETE /dict-types/{id})
|
||
- [ ] 2.2 在 `backend/app/api/admin.py` 新增字典数据 CRUD 路由(GET /dict-data, POST /dict-data, PUT /dict-data/{id}, DELETE /dict-data/{id})
|
||
- [ ] 2.3 新增字典数据下拉选项路由(GET /dict-data/options)
|
||
- [ ] 2.4 验证所有路由使用 require_admin_or_super_admin 依赖注入,正确传递 tenant_no、user_id
|
||
|
||
## 3. 前端API与类型
|
||
|
||
- [ ] 3.1 在 `web-admin/src/types/api.d.ts` 新增 `Api.Dict` 命名空间,定义 DictTypeItem、DictDataItem 接口
|
||
- [ ] 3.2 在 `web-admin/src/api/admin.ts` 新增字典类型 API 函数:fetchDictTypeList、fetchCreateDictType、fetchUpdateDictType、fetchDeleteDictType
|
||
- [ ] 3.3 在 `web-admin/src/api/admin.ts` 新增字典数据 API 函数:fetchDictDataList、fetchCreateDictData、fetchUpdateDictData、fetchDeleteDictData、fetchDictDataOptions
|
||
|
||
## 4. 前端页面
|
||
|
||
- [ ] 4.1 创建 `web-admin/src/views/system/dict/index.vue` 字典类型列表页,参照 unit/index.vue 模板
|
||
- [ ] 4.2 实现字典类型搜索、分页、新增/编辑弹窗
|
||
- [ ] 4.3 实现字典数据配置弹窗(Dialog + 内嵌表格),支持弹窗内新增/编辑/删除字典数据
|
||
- [ ] 4.4 在 `web-admin/src/router/modules/sqxp.ts` 系统管理路由组下注册字典管理路由(path: dict, component: /system/dict/index)
|
||
|
||
## 5. 数据初始化
|
||
|
||
- [ ] 5.1 在 `docs/sql/` 下创建字典初始化数据 SQL 脚本,包含初始字典类型(zzlbbm、bmzt、zdlx、zdywfw)及其字典数据
|
||
|
||
## 6. 验证
|
||
|
||
- [ ] 6.1 后端验证:启动服务,通过 Swagger /docs 测试所有字典 CRUD 接口
|
||
- [ ] 6.2 前端验证:启动 dev server,验证字典类型列表页和字典数据配置弹窗功能完整可用
|