Files
shanxia2.0/openspec/changes/operation-audit-enhancement/tasks.md
T
2026-06-29 11:15:39 +08:00

43 lines
2.1 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.
## 1. 数据库
- [x] 1.1 创建 `docs/sql/migrations/2026-06-29-operation-audit.sql`(扩展 `sys_api_request_log` / `_his`:`tenant_no`、`business_title`、`business_type`、`business_id`、`oper_summary` + 索引)
- [x] 1.2 同步 `docs/sql/shanxia2.0.sql`
## 2. 后端 · 采集层
- [x] 2.1 扩展 `app/core/context.py`:`oper_log_meta` ContextVar(title/type/id/summary)→ `oper_log_context.py`
- [x] 2.2 新增 `app/core/oper_log_decorator.py`:`@oper_log(...)` 装饰器
- [x] 2.3 更新 `api_request_log_middleware.py`:解析 `real_name`、`tenant_no`;落库语义字段;推断兜底
- [x] 2.4 更新 `SysApiRequestLog` / `SysApiRequestLogHis` ORM
## 3. 后端 · 查询层
- [x] 3.1 更新 `oper_log.py`:优先读落库语义列;列表支持 `businessId`、`businessTitle`、`tenant_no` DB 筛选
- [x] 3.2 更新 `schemas/monitor/operlog.py` 与 `monitor.py` 请求体字段
- [x] 3.3 更新 `api_request_log_crud.py` 历史表字段(列表仍走 operlog API)
## 4. 后端 · 注解覆盖(首期)
- [x] 4.1 CRM 客户写接口 `@oper_log`(增删改、公海、转移等)
- [x] 4.2 CRM 合同写接口 `@oper_log`(新增/修改/删除/导出/作废)
- [x] 4.3 配置项预留 `API_REQUEST_LOG_EXCLUDE_PATHS`(默认空)
## 5. 前端
- [x] 5.1 `api/monitor/operlog` 类型与查询参数扩展
- [x] 5.2 操作日志列表页 `views/system/operlog/index.vue`(P01)+ 详情弹窗
- [x] 5.3 路由 `router/modules/sqxp.ts` + 菜单 SQL(`system:operlog:list`)
- [x] 5.4 CRM `CustomerDetailDialog`、`contract/detail` Tab 改为 `businessId` 查询
## 6. 验收与文档
- [ ] 6.1 冒烟:写操作落库姓名/语义/入参出参;管理页筛选;客户详情 Tab(需执行迁移并重启后端)
- [x] 6.2 默认配置 `API_REQUEST_LOG_ENABLED=true`(`config.py`)
- [x] 6.3 `./scripts/update-graph.sh backend`(frontend 待有 import 变更后可再跑)
## 7. 后续(非本期阻塞)
- [ ] 7.1 定时任务:热数据归档至 `sys_api_request_log_his`
- [ ] 7.2 运输计划 / 报销等模块 `@oper_log` 全覆盖
- [ ] 7.3 响应体 PII 扩展脱敏规则