520 lines
24 KiB
Markdown
520 lines
24 KiB
Markdown
# 山峡化工生产一体化门户 — 工程清理 + Tag 集中化实施计划
|
||
|
||
> **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.
|
||
|
||
## 背景与目标
|
||
|
||
将 zkxw 工程清理为山峡化工生产一体化门户(shanxia2.0)的基础框架:
|
||
1. **删除所有 zkxw 业务代码**(前端 + 后端),仅保留系统管理、工作流管理、请假申请模块
|
||
2. **Tag 颜色集中化**:在 `sys_dict_data` 表新增 `tag_type` 字段,前端全局 Dict Store 统一管理所有状态标签显示,彻底删除 `status-tag-registry.ts`
|
||
3. **数据库清理**:删除所有业务表模型,仅保留系统表 + 工作流表 + 请假表 + 附件表
|
||
|
||
## 保留清单
|
||
|
||
### 后端保留
|
||
- **API**:`public.py`(鉴权), `menu.py`(菜单), `admin.py`(系统管理), `workflow.py`(工作流), `leave.py`(请假)
|
||
- **Services**:`workflow_engine.py`, `workflow_callback.py`, `web_auth_roles.py`
|
||
- **模型**(models.py 中):Sys*, Wf*, BizLeaveRequest, BizAttachment, SysEthnic, SysApiRequestLog, SysApiRequestLogHis
|
||
- **CRUD**:dict_type, dict_data, dept, menu, post, role, tenant, user, workflow, leave, attachment, base, api_request_log, biz_no_generator, site
|
||
- **Schemas**:auth, common, leave, menu, user, workflow, attachment
|
||
|
||
### 前端保留
|
||
- **Views 目录**:`auth/`, `dashboard/`, `exception/`, `index/`, `outside/`, `system/`(子目录: dept, dict, leave, menu, post, role, tenant, user, workflow)
|
||
- **API 模块**:`auth.ts`, `admin.ts`, `system.ts`, `workflow.ts`
|
||
- **Store**:`user.ts`, `menu.ts`, `setting.ts`, `table.ts`, `worktab.ts`
|
||
- **Router**:`index.ts`, `sqxp.ts`(精简为仅保留路由), `exception.ts`
|
||
|
||
### 删除清单
|
||
- **后端 API**(17 个文件):basic_info, collection_protocol, operations, ethnic, sample_reception, qc, research_donation, production, pilot_service, insurance_company, material, storage_release_review, sample_sms_notification, storage_entry_sms_notification, pilot_application, pilot_checkup, pilot_delivery, pilot_infusion_confirm, pilot_infusion_schedule_mgmt, outbound_release_review, clinical_payment
|
||
- **后端模型**(独立文件 3 个 + models.py 中 ~100 个 Biz* 类):clinical_payment.py, material.py, qc_material.py, qc_param.py, research_donation.py + models.py 中所有 Biz* 类(除 BizLeaveRequest, BizAttachment)
|
||
- **后端 CRUD**(~50 个业务文件):所有非保留清单的 crud 文件
|
||
- **后端 Schemas**(~30 个业务文件):所有非保留清单的 schema 文件
|
||
- **前端 Views**(7 个目录):basic-info, cell-storage, operations, pilot-service, production, quality-inspection, research-donation
|
||
- **前端 API**(~26 个业务文件):所有非保留清单的 api 文件
|
||
- **前端 Router**:`sqxp.ts` 中所有业务路由(13 个一级菜单精简为 3 个:工作流管理、系统管理、Dashboard)
|
||
- **`status-tag-registry.ts`**:整体删除,所有 tag 走字典
|
||
|
||
---
|
||
|
||
## 实施任务
|
||
|
||
### Phase 1: 数据库层变更
|
||
|
||
#### Task 1.1: sys_dict_data 表新增 tag_type 字段
|
||
- [ ] 编写 SQL migration 脚本 `docs/sql/20260530_add_tag_type_to_dict_data.sql`
|
||
```sql
|
||
ALTER TABLE `sys_dict_data`
|
||
ADD COLUMN `tag_type` varchar(20) NOT NULL DEFAULT ''
|
||
COMMENT '标签类型:success/warning/danger/info/primary/空'
|
||
AFTER `dict_value`;
|
||
```
|
||
- [ ] 在 shanxia2.0 数据库上执行该 SQL
|
||
|
||
#### Task 1.2: 字典种子数据初始化
|
||
- [ ] 编写 SQL 脚本 `docs/sql/20260530_seed_dict_data_for_framework.sql`
|
||
|
||
需要创建以下 dict_type 及其 dict_data 条目(每条都含 tag_type):
|
||
|
||
| dict_type | dict_name | 数据项 (dict_value → dict_label / tag_type) |
|
||
|-----------|-----------|----------------------------------------------|
|
||
| `sys_status` | 通用状态 | 1 → 正常 / success, 0 → 停用 / danger |
|
||
| `sys_sex` | 性别 | 0 → 男 / primary, 1 → 女 / success |
|
||
| `sys_data_scope` | 数据权限范围 | 1 → 全部数据 / '', 2 → 本部门数据 / info, 3 → 本部门及以下 / info, 4 → 仅本人 / warning, 5 → 自定义 / primary |
|
||
| `sys_visible` | 显示状态 | 1 → 显示 / success, 0 → 隐藏 / info |
|
||
| `menu_type` | 菜单类型 | M → 目录 / '', C → 菜单 / success, F → 按钮 / warning |
|
||
| `leave_status` | 请假状态 | draft → 草稿 / info, pending → 审批中 / warning, approved → 已通过 / success, rejected → 已驳回 / danger, cancelled → 已取消 / info |
|
||
| `wf_process_status` | 流程实例状态 | running → 进行中 / warning, completed → 已完成 / success, rejected → 已驳回 / danger, cancelled → 已取消 / info, pending → 待处理 / warning, approved → 已通过 / success, withdrawn → 已撤回 / info |
|
||
| `wf_node_type` | 流程节点类型 | start → 开始 / info, end → 结束 / info, approver → 审批人 / warning, condition → 条件分支 / primary |
|
||
| `wf_approve_type` | 审批方式 | any → 或签 / primary, all → 会签 / success |
|
||
| `user_role` | 用户角色 | admin → 管理员 / primary, super_admin → 超级管理员 / danger |
|
||
|
||
**每个 dict_type 先在 `sys_dict_type` 中创建,再插入对应的 `sys_dict_data` 条目,每条都带 tag_type 值。**
|
||
|
||
- [ ] 在 shanxia2.0 数据库上执行种子数据 SQL
|
||
|
||
#### Task 1.3: 清理数据库业务表(生成脚本,不自动执行)
|
||
- [ ] 编写 SQL 脚本 `docs/sql/20260530_drop_business_tables.sql`
|
||
- 列出所有需要 DROP 的业务表(所有非 sys_、wf_、biz_leave_request、biz_attachment 的表)
|
||
- 脚本中每个 DROP 前加注释说明原用途
|
||
- [ ] 交给用户确认后手动执行
|
||
|
||
---
|
||
|
||
### Phase 2: 后端清理
|
||
|
||
#### Task 2.1: 清理后端 API 路由文件
|
||
- [ ] 删除以下 API 文件(17 个):
|
||
```
|
||
backend/app/api/basic_info.py
|
||
backend/app/api/collection_protocol.py
|
||
backend/app/api/operations.py
|
||
backend/app/api/ethnic.py
|
||
backend/app/api/sample_reception.py
|
||
backend/app/api/qc.py
|
||
backend/app/api/research_donation.py
|
||
backend/app/api/production.py
|
||
backend/app/api/pilot_service.py
|
||
backend/app/api/insurance_company.py
|
||
backend/app/api/material.py
|
||
backend/app/api/storage_release_review.py
|
||
backend/app/api/sample_sms_notification.py
|
||
backend/app/api/storage_entry_sms_notification.py
|
||
backend/app/api/pilot_application.py
|
||
backend/app/api/pilot_checkup.py
|
||
backend/app/api/pilot_delivery.py
|
||
backend/app/api/pilot_infusion_confirm.py
|
||
backend/app/api/pilot_infusion_schedule_mgmt.py
|
||
backend/app/api/outbound_release_review.py
|
||
backend/app/api/clinical_payment.py
|
||
```
|
||
|
||
#### Task 2.2: 清理后端模型文件
|
||
- [ ] 删除独立模型文件(4 个):
|
||
```
|
||
backend/app/models/clinical_payment.py
|
||
backend/app/models/material.py
|
||
backend/app/models/qc_material.py
|
||
backend/app/models/qc_param.py
|
||
backend/app/models/research_donation.py
|
||
```
|
||
- [ ] 精简 `backend/app/models/models.py`:
|
||
- **保留**的类:SysUser, SysRole, SysUserRole, SysRoleMenu, SysRoleDataScopeDetail, SysMenu, SysDept, SysTenant, SysSite, SysPost, SysUserPost, SysDictType, SysEthnic, SysDictData, SysApiRequestLog, SysApiRequestLogHis, BizLeaveRequest, BizAttachment, WfProcessDef, WfProcessVersion, WfNode, WfTransition, WfProcessInstance, WfTask
|
||
- **删除**的类:所有 Biz* 类(除 BizLeaveRequest, BizAttachment),即从 BizItemUnit 开始到文件末尾的所有业务类
|
||
- 在 SysDictData 类中新增字段:`tag_type = Column(String(20), nullable=False, default="", comment="标签类型")`,位置在 `dict_value` 之后
|
||
|
||
#### Task 2.3: 清理后端 CRUD 文件
|
||
- [ ] 删除以下业务 CRUD 文件(约 50 个,仅保留列出的保留清单):
|
||
```
|
||
# 保留:base.py, api_request_log.py, biz_no_generator.py, dept.py, dict_data.py,
|
||
# dict_type.py, leave.py, menu.py, post.py, role.py, tenant.py, user.py,
|
||
# workflow.py, attachment.py, site.py, ethnic.py
|
||
# 删除:其余全部(cell_product.py, collection_protocol.py, customer.py ... 等约 50 个文件)
|
||
```
|
||
|
||
完整删除列表:
|
||
```
|
||
backend/app/crud/cell_product.py
|
||
backend/app/crud/cell_sample_type.py
|
||
backend/app/crud/clean_room.py
|
||
backend/app/crud/clinical_payment.py
|
||
backend/app/crud/collection_protocol.py
|
||
backend/app/crud/collection_protocol_no.py
|
||
backend/app/crud/collection_region.py
|
||
backend/app/crud/consumable.py
|
||
backend/app/crud/consumable_pack.py
|
||
backend/app/crud/consumable_stock_log.py
|
||
backend/app/crud/customer.py
|
||
backend/app/crud/exhibition_appointment.py
|
||
backend/app/crud/express_company.py
|
||
backend/app/crud/item_unit.py
|
||
backend/app/crud/material.py
|
||
backend/app/crud/material_stock_log.py
|
||
backend/app/crud/outbound_handover.py
|
||
backend/app/crud/outbound_handover_inventory.py
|
||
backend/app/crud/outbound_release_material.py
|
||
backend/app/crud/outbound_release_review.py
|
||
backend/app/crud/output_type.py
|
||
backend/app/crud/pilot_application.py
|
||
backend/app/crud/pilot_checkup.py
|
||
backend/app/crud/pilot_delivery.py
|
||
backend/app/crud/pilot_infusion_confirm.py
|
||
backend/app/crud/pilot_infusion_schedule_mgmt.py
|
||
backend/app/crud/pilot_outbound_status_sync.py
|
||
backend/app/crud/pilot_service.py
|
||
backend/app/crud/process.py
|
||
backend/app/crud/process_category.py
|
||
backend/app/crud/process_route.py
|
||
backend/app/crud/production_task.py
|
||
backend/app/crud/production_work_order.py
|
||
backend/app/crud/protocol_donation_convert.py
|
||
backend/app/crud/qc_item_param.py
|
||
backend/app/crud/qc_lab_test_item.py
|
||
backend/app/crud/qc_material.py
|
||
backend/app/crud/qc_material_usage.py
|
||
backend/app/crud/qc_task.py
|
||
backend/app/crud/qc_task_result.py
|
||
backend/app/crud/qc_third_party_company.py
|
||
backend/app/crud/qc_third_party_item.py
|
||
backend/app/crud/qc_work_order.py
|
||
backend/app/crud/reagent.py
|
||
backend/app/crud/reagent_stock_log.py
|
||
backend/app/crud/research_donation.py
|
||
backend/app/crud/sample_code.py
|
||
backend/app/crud/sample_reception.py
|
||
backend/app/crud/sample_reception_check_item.py
|
||
backend/app/crud/sample_reception_check_result.py
|
||
backend/app/crud/sample_sms_notification.py
|
||
backend/app/crud/sop_document.py
|
||
backend/app/crud/storage_entry_sms_notification.py
|
||
backend/app/crud/storage_facility.py
|
||
backend/app/crud/storage_occupancy.py
|
||
backend/app/crud/storage_release_review.py
|
||
```
|
||
|
||
#### Task 2.4: 清理后端 Schemas 文件
|
||
- [ ] 删除以下业务 Schema 文件(约 30 个,仅保留列出的保留清单):
|
||
```
|
||
# 保留:auth.py, common.py, leave.py, menu.py, user.py, workflow.py, attachment.py
|
||
# 删除:其余全部
|
||
```
|
||
|
||
完整删除列表:
|
||
```
|
||
backend/app/schemas/category.py
|
||
backend/app/schemas/category_parameter.py
|
||
backend/app/schemas/cell_product.py
|
||
backend/app/schemas/delivery.py
|
||
backend/app/schemas/inquiry.py
|
||
backend/app/schemas/order.py
|
||
backend/app/schemas/order_adjust.py
|
||
backend/app/schemas/outbound_handover.py
|
||
backend/app/schemas/outbound_release_material.py
|
||
backend/app/schemas/outbound_release_review.py
|
||
backend/app/schemas/price_list.py
|
||
backend/app/schemas/process_route.py
|
||
backend/app/schemas/product.py
|
||
backend/app/schemas/product_banner.py
|
||
backend/app/schemas/product_detail_media.py
|
||
backend/app/schemas/product_parameter.py
|
||
backend/app/schemas/product_parameter_value.py
|
||
backend/app/schemas/product_review.py
|
||
backend/app/schemas/product_review_media.py
|
||
backend/app/schemas/production_task.py
|
||
backend/app/schemas/production_work_order.py
|
||
backend/app/schemas/qc_task.py
|
||
backend/app/schemas/qc_work_order.py
|
||
backend/app/schemas/quotation.py
|
||
backend/app/schemas/region.py
|
||
backend/app/schemas/storage_occupancy.py
|
||
backend/app/schemas/storage_release_review.py
|
||
backend/app/schemas/unit.py
|
||
```
|
||
|
||
#### Task 2.5: 更新后端路由注册
|
||
- [ ] 重写 `backend/app/api/__init__.py`:仅保留 public_router, menu_router, admin_router, workflow_router, leave_router 的 import 和注册
|
||
- [ ] 重写 `backend/app/main.py` 的 import 行:仅 import 保留的 5 个 router,同时删除对已删除 API 文件的任何引用
|
||
- [ ] 更新 `backend/app/main.py` 中的 title/description:将 "zkxw" 替换为 "shanxia2.0" / "山峡化工生产一体化门户"
|
||
|
||
#### Task 2.6: 后端 dict 模块改造(Tag 集中化核心)
|
||
- [ ] 修改 `backend/app/models/models.py` 中 SysDictData:新增 `tag_type` Column(在 Task 2.2 中已完成)
|
||
- [ ] 修改 `backend/app/crud/dict_data.py`:
|
||
- `_row_to_dict()` 返回值新增 `"tagType": d.tag_type or ""`
|
||
- `create_dict_data()` 新增 tag_type 参数
|
||
- `update_dict_data()` 新增 tag_type 参数更新
|
||
- `list_dict_data_options()` 返回值新增 `"tagType": r.tag_type or ""`
|
||
- [ ] 修改 `backend/app/api/admin.py` 中字典相关 endpoint:
|
||
- `create_dict_data` body 新增 tag_type 字段
|
||
- `update_dict_data` payload 新增 tag_type
|
||
- `dict_data_options` 返回值含 tagType
|
||
- [ ] 新增 API endpoint `GET /web/admin/dict-data/all`:
|
||
- 返回当前租户下所有有效(del_flag=0)的字典数据,按 dict_type 分组
|
||
- 返回格式:`{ "data": { "sys_status": [{ label, value, tagType }, ...], "leave_status": [...] } }`
|
||
- 添加到 `admin.py` 中
|
||
|
||
#### Task 2.7: 清理 admin.py 中的业务端点
|
||
- [ ] 从 `backend/app/api/admin.py` 中删除所有业务相关的端点:
|
||
- 客户相关 (customer)
|
||
- 快递公司 (express)
|
||
- 计量单位 (item-unit)
|
||
- 采样区域 (collection-region)
|
||
- 细胞样本类型 (cell-sample-type)
|
||
- 采样医院 (collection-hospital)
|
||
- 其他所有非系统管理的端点
|
||
- [ ] 保留的端点:用户、角色、部门、租户、菜单、字典类型、字典数据、岗位、站点、附件上传、组织管理
|
||
|
||
#### Task 2.8: 验证后端可启动
|
||
- [ ] 激活 venv 后运行 `python -c "from app.main import app; print('OK')"`
|
||
- [ ] 如有 import 错误,逐一修复(清理残留引用)
|
||
- [ ] 启动服务 `./start-local.sh`,确认无报错
|
||
|
||
---
|
||
|
||
### Phase 3: 前端清理
|
||
|
||
#### Task 3.1: 删除业务 Views 目录
|
||
- [ ] 删除以下 7 个前端 Views 目录:
|
||
```
|
||
web-admin/src/views/basic-info/
|
||
web-admin/src/views/cell-storage/
|
||
web-admin/src/views/operations/
|
||
web-admin/src/views/pilot-service/
|
||
web-admin/src/views/production/
|
||
web-admin/src/views/quality-inspection/
|
||
web-admin/src/views/research-donation/
|
||
```
|
||
|
||
#### Task 3.2: 删除 system/ 下的模板/业务页面
|
||
- [ ] 删除以下目录(属于模板参考页或业务页面):
|
||
```
|
||
web-admin/src/views/system/category/
|
||
web-admin/src/views/system/product/
|
||
web-admin/src/views/system/order/
|
||
web-admin/src/views/system/express/
|
||
```
|
||
|
||
#### Task 3.3: 删除业务 API 模块
|
||
- [ ] 删除以下前端 API 文件(约 26 个):
|
||
```
|
||
web-admin/src/api/business.ts
|
||
web-admin/src/api/cell-product.ts
|
||
web-admin/src/api/collection-protocol.ts
|
||
web-admin/src/api/ethnic.ts
|
||
web-admin/src/api/infusion-schedule-handover.ts
|
||
web-admin/src/api/material.ts
|
||
web-admin/src/api/outbound-release-review.ts
|
||
web-admin/src/api/production-task.ts
|
||
web-admin/src/api/production-work-order.ts
|
||
web-admin/src/api/production.ts
|
||
web-admin/src/api/qc-item-param.ts
|
||
web-admin/src/api/qc-lab-test-item.ts
|
||
web-admin/src/api/qc-material-usage.ts
|
||
web-admin/src/api/qc-material.ts
|
||
web-admin/src/api/qc-task-result.ts
|
||
web-admin/src/api/qc-task.ts
|
||
web-admin/src/api/qc-third-party-company.ts
|
||
web-admin/src/api/qc-third-party-item.ts
|
||
web-admin/src/api/qc-work-order.ts
|
||
web-admin/src/api/research-donation.ts
|
||
web-admin/src/api/sample-reception-check-item.ts
|
||
web-admin/src/api/sample-reception.ts
|
||
web-admin/src/api/sample-sms-notification.ts
|
||
web-admin/src/api/storage-entry-sms-notification.ts
|
||
web-admin/src/api/storage-release-review.ts
|
||
web-admin/src/api/chinaRegion.ts
|
||
```
|
||
|
||
#### Task 3.4: 精简前端路由
|
||
- [ ] 重写 `web-admin/src/router/modules/sqxp.ts`:
|
||
- 仅保留 3 个一级菜单路由:
|
||
1. Dashboard(控制台)
|
||
2. 工作流管理(子菜单:流程配置、待办中心、已办中心、我的申请、请假申请)
|
||
3. 系统管理(子菜单:租户管理、字典管理、菜单管理、组织管理、角色管理、用户管理、职位管理)
|
||
- 删除所有业务路由(细胞存储、科研捐赠、中试服务、临床应用、质检管理、生产管理、运营支撑、市场/质检/生产基础信息等)
|
||
- 更新注释为山峡化工相关
|
||
|
||
#### Task 3.5: 删除 status-tag-registry.ts
|
||
- [ ] 删除 `web-admin/src/utils/status-tag-registry.ts`
|
||
|
||
#### Task 3.6: 清理 admin.ts 中的业务 API 函数
|
||
- [ ] 从 `web-admin/src/api/admin.ts` 中删除所有业务相关的函数(客户、快递、计量单位等)
|
||
- [ ] 保留的函数:用户、角色、部门、租户、菜单、字典类型、字典数据、岗位、站点、组织管理、附件上传
|
||
|
||
---
|
||
|
||
### Phase 4: 前端 Tag 集中化
|
||
|
||
#### Task 4.1: 新增前端类型定义
|
||
- [ ] 修改 `web-admin/src/types/api.d.ts`:
|
||
- 在 `Dict.DictDataItem` 中新增 `tagType: string`
|
||
- 在 `Dict.DictDataOption` 中新增 `tagType: string`
|
||
- 新增类型:
|
||
```typescript
|
||
Dict {
|
||
// ...existing...
|
||
interface DictDataOption {
|
||
label: string
|
||
value: string
|
||
tagType: string // 新增
|
||
}
|
||
interface DictDataGroup {
|
||
[dictType: string]: DictDataItem[]
|
||
}
|
||
interface DictAllResponse {
|
||
[dictType: string]: { label: string; value: string; tagType: string }[]
|
||
}
|
||
}
|
||
```
|
||
|
||
#### Task 4.2: 新增前端 Dict Store
|
||
- [ ] 新建 `web-admin/src/store/modules/dict.ts`:
|
||
```typescript
|
||
// 核心功能:
|
||
// 1. state: dictMap (Map<dictType, DictDataItem[]>)
|
||
// 2. action: loadAllDict() — 调用 /web/admin/dict-data/all 一次性加载
|
||
// 3. getter: getLabel(dictType, value) → string
|
||
// 4. getter: getTagType(dictType, value) → string
|
||
// 5. getter: getOptions(dictType) → { label, value, tagType }[]
|
||
```
|
||
- [ ] 在应用入口 `web-admin/src/main.ts` 或登录后的路由守卫中调用 `loadAllDict()`
|
||
|
||
#### Task 4.3: 新增前端 composable
|
||
- [ ] 新建 `web-admin/src/composables/useDictTag.ts`:
|
||
```typescript
|
||
// useDictTag(dictType: string)
|
||
// 返回:{ getLabel(value), getTagType(value), options }
|
||
// 内部从 dict store 获取数据
|
||
```
|
||
|
||
#### Task 4.4: 前端 admin.ts 新增全量加载 API
|
||
- [ ] 在 `web-admin/src/api/admin.ts` 中新增:
|
||
```typescript
|
||
export function fetchAllDictData() {
|
||
return request.get<Api.Dict.DictAllResponse>({
|
||
url: '/web/admin/dict-data/all'
|
||
})
|
||
}
|
||
```
|
||
|
||
#### Task 4.5: 字典管理页面支持 tag_type 编辑
|
||
- [ ] 修改 `web-admin/src/views/system/dict/index.vue`:
|
||
- 在字典数据的新增/编辑表单中增加 `tag_type` 选择字段
|
||
- 选项:空(默认)、success(成功/绿)、warning(警告/橙)、danger(危险/红)、info(信息/灰)、primary(主要/蓝)
|
||
- 在字典数据列表中增加 tag_type 显示列(渲染为对应颜色的 el-tag 预览)
|
||
|
||
---
|
||
|
||
### Phase 5: 保留页面 Tag 迁移
|
||
|
||
#### Task 5.1: 迁移 system/dept/index.vue
|
||
- [ ] 将 `row.status === '1' ? 'success' : 'danger'` 改为 `dictStore.getTagType('sys_status', row.status)`
|
||
- [ ] 将硬编码的中文标签改为 `dictStore.getLabel('sys_status', row.status)`
|
||
|
||
#### Task 5.2: 迁移 system/user/index.vue
|
||
- [ ] 将 `row.status === '1' ? 'success' : 'info'` 改为 `dictStore.getTagType('sys_status', row.status)`
|
||
|
||
#### Task 5.3: 迁移 system/role/index.vue
|
||
- [ ] 将 `row.status === '1' ? 'success' : 'info'` 改为 `dictStore.getTagType('sys_status', row.status)`
|
||
|
||
#### Task 5.4: 迁移 system/post/index.vue
|
||
- [ ] 将 `row.status === '1' ? 'success' : 'info'` 改为 `dictStore.getTagType('sys_status', row.status)`
|
||
|
||
#### Task 5.5: 迁移 system/site/index.vue
|
||
- [ ] 将 `row.status === '1' ? 'success' : 'info'` 改为 `dictStore.getTagType('sys_status', row.status)`
|
||
|
||
#### Task 5.6: 迁移 system/menu/index.vue
|
||
- [ ] 删除 `menuTypeTagMap` 硬编码对象
|
||
- [ ] 将菜单类型的 tag 改为 `dictStore.getTagType('menu_type', row.menuType)`
|
||
- [ ] 将菜单类型的 label 改为 `dictStore.getLabel('menu_type', row.menuType)`
|
||
- [ ] 将 `row.visible === '1' ? 'success' : 'info'` 改为 `dictStore.getTagType('sys_visible', row.visible)`
|
||
- [ ] 将 `row.status === '1' ? 'success' : 'danger'` 改为 `dictStore.getTagType('sys_status', row.status)`
|
||
|
||
#### Task 5.7: 迁移 system/user/detail.vue
|
||
- [ ] 将 `getRoleTagType` 改为 `dictStore.getTagType('user_role', userData.role)`
|
||
- [ ] 将 `getRoleText` 改为 `dictStore.getLabel('user_role', userData.role)`
|
||
- [ ] 将 `userData.isActive ? 'success' : 'danger'` 改为 `dictStore.getTagType('sys_status', userData.isActive ? '1' : '0')`
|
||
|
||
#### Task 5.8: 迁移 system/leave/index.vue
|
||
- [ ] 删除 `import { leaveStatusLabel, leaveStatusTagType } from '@/utils/status-tag-registry'`
|
||
- [ ] 将 `statusTagType(row.status)` 改为 `dictStore.getTagType('leave_status', row.status)`
|
||
- [ ] 将 `statusLabel(row.status)` 改为 `dictStore.getLabel('leave_status', row.status)`
|
||
|
||
#### Task 5.9: 迁移 system/workflow/components/ProcessStatusTag.vue
|
||
- [ ] 删除硬编码 `statusMap` 对象
|
||
- [ ] 改为从 dict store 获取:
|
||
```typescript
|
||
const tagType = computed(() => dictStore.getTagType('wf_process_status', props.status))
|
||
const label = computed(() => dictStore.getLabel('wf_process_status', props.status))
|
||
```
|
||
|
||
---
|
||
|
||
### Phase 6: 清理残留引用与验证
|
||
|
||
#### Task 6.1: 清理所有 status-tag-registry 的 import
|
||
- [ ] 全局搜索 `status-tag-registry` 引用,确保已全部替换为 dict store
|
||
- [ ] 确认文件已删除后无残留 import
|
||
|
||
#### Task 6.2: 清理所有已删除 API 模块的 import
|
||
- [ ] 全局搜索已删除的 API 文件 import(如 `from '@/api/business'`, `from '@/api/cell-product'` 等)
|
||
- [ ] 清除所有残留引用
|
||
|
||
#### Task 6.3: 后端启动验证
|
||
- [ ] `cd backend && source venv/bin/activate && python -c "from app.main import app; print('OK')"`
|
||
- [ ] 修复任何 import 错误
|
||
|
||
#### Task 6.4: 前端构建验证
|
||
- [ ] `cd web-admin && pnpm build`
|
||
- [ ] 修复任何编译错误(TypeScript、模板引用等)
|
||
|
||
#### Task 6.5: 全局文本替换
|
||
- [ ] 搜索代码中残留的 "zkxw"、"中科兴皖"、"陇耘鲜达"、"叁强鲜配" 等旧项目名称
|
||
- [ ] 替换为 "shanxia2.0"、"山峡化工" 等新名称(注意:数据库字段 default 值中的 'zkxw' 暂时保留,等后续数据迁移时再处理)
|
||
|
||
#### Task 6.6: 更新 README 和项目描述
|
||
- [ ] 更新 `backend/README.md` 项目名称和描述
|
||
- [ ] 更新 `backend/app/main.py` 中的 title/description
|
||
- [ ] 更新 `.env.example` 中的 APP_NAME
|
||
|
||
---
|
||
|
||
## 执行顺序与并行策略
|
||
|
||
```
|
||
Phase 1 (DB) ──────────────────────────────── 串行,先执行
|
||
↓
|
||
Phase 2 (Backend) ── Task 2.1~2.4 可并行 ── Task 2.5~2.7 串行 ── Task 2.8 验证
|
||
↓
|
||
Phase 3 (Frontend cleanup) ── Task 3.1~3.3 可并行 ── Task 3.4~3.6 串行
|
||
↓ (可与 Phase 3 并行)
|
||
Phase 4 (Tag infrastructure) ── Task 4.1~4.4 串行
|
||
↓
|
||
Phase 5 (Tag migration) ── Task 5.1~5.9 可并行
|
||
↓
|
||
Phase 6 (验证 & 收尾) ── 串行
|
||
```
|
||
|
||
## 预估工作量
|
||
|
||
| Phase | 任务数 | 预估时间 |
|
||
|-------|--------|----------|
|
||
| Phase 1 (DB) | 3 | 0.5h |
|
||
| Phase 2 (Backend) | 8 | 2h |
|
||
| Phase 3 (Frontend cleanup) | 6 | 1.5h |
|
||
| Phase 4 (Tag infrastructure) | 5 | 2h |
|
||
| Phase 5 (Tag migration) | 9 | 1.5h |
|
||
| Phase 6 (验证) | 6 | 1h |
|
||
| **总计** | **37** | **~8.5h** |
|
||
|
||
使用 subagent 并行执行可压缩到 ~4-5h。
|
||
|
||
## 注意事项
|
||
|
||
1. **不自动执行 DROP TABLE** — 数据库业务表的删除需要用户手动确认执行
|
||
2. **保留 biz_attachment 表和模型** — 附件是通用基础设施
|
||
3. **保留 SysEthnic** — 民族码表可能在后续业务中使用
|
||
4. **保留 SysSite** — 站点管理属于系统管理模块
|
||
5. **后端 CRUD 的 `__init__.py`** — 删除文件后需同步清理该文件中的 import
|
||
6. **后端 Schemas 的 `__init__.py`** — 同上
|
||
7. **前端 chinaRegion.ts** 删除 — 地区数据属于旧业务
|
||
8. **字典 CRUD 的 `_row_to_dict`** 是字段一致性检查的 single source of truth,新增 tag_type 后需要同步更新对应 schema
|