docs: mark QC inspection item template plan tasks done.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-08-17 12:47:42 +08:00
1 parent bb81170b89
commit 00af72e11b
1 file changed
+37 -37
@@ -60,7 +60,7 @@
- Create: `docs/sql/alter_biz_qc_inspection_item_template.sql`
- Modify: `待同步到生产的sql脚本`(文末追加本脚本文件名说明)
- [ ] **Step 1: 写幂等迁移脚本**
- [x] **Step 1: 写幂等迁移脚本**
创建 `docs/sql/alter_biz_qc_inspection_item_template.sql`,内容需包含:
@@ -91,11 +91,11 @@ CREATE TABLE IF NOT EXISTS `biz_qc_inspection_item_template` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='质检检测项目模版';
```
- [ ] **Step 2: 在待同步清单登记**
- [x] **Step 2: 在待同步清单登记**
在 `待同步到生产的sql脚本` 追加一行指向本 alter 文件。
- [ ] **Step 3: Commit**
- [x] **Step 3: Commit**
```bash
git add docs/sql/alter_biz_qc_inspection_item_template.sql 待同步到生产的sql脚本
@@ -113,7 +113,7 @@ EOF
**Files:**
- Modify: `backend/app/models/models.py`(紧挨 `BizQcLabTestItem` 之后)
- [ ] **Step 1: 新增模型类**
- [x] **Step 1: 新增模型类**
```python
class BizQcInspectionItemTemplate(Base):
@@ -137,7 +137,7 @@ class BizQcInspectionItemTemplate(Base):
del_flag = Column(SmallInteger, nullable=False, default=0, comment="删除标记")
```
- [ ] **Step 2: Commit**
- [x] **Step 2: Commit**
```bash
git add backend/app/models/models.py
@@ -156,7 +156,7 @@ EOF
- Create: `backend/tests/test_qc_inspection_item_template_helpers.py`
- Create: `backend/app/crud/qc_inspection_item_template.py`
- [ ] **Step 1: 写失败测试**
- [x] **Step 1: 写失败测试**
```python
# backend/tests/test_qc_inspection_item_template_helpers.py
@@ -185,7 +185,7 @@ class QcInspectionItemTemplateHelpersTests(unittest.TestCase):
svc.require_nonempty_items(["1"], [])
```
- [ ] **Step 2: 跑测试确认失败**
- [x] **Step 2: 跑测试确认失败**
```bash
cd backend && source venv/bin/activate && pytest tests/test_qc_inspection_item_template_helpers.py -v
@@ -193,7 +193,7 @@ cd backend && source venv/bin/activate && pytest tests/test_qc_inspection_item_t
Expected: FAIL(模块或函数不存在)。
- [ ] **Step 3: 实现 helpers + CRUD**
- [x] **Step 3: 实现 helpers + CRUD**
在 `backend/app/crud/qc_inspection_item_template.py` 实现:
@@ -222,7 +222,7 @@ def require_nonempty_items(lab_ids: List[str], third_ids: List[str]) -> None:
- `get_template` / `create_template` / `update_template` / `soft_delete_template`
- `create`/`update` 内:`require_nonempty_items`;名称唯一;调用 `_assert_item_ids_exist(db, tenant_no, lab_ids, third_ids)`:查 `BizQcLabTestItem` / `BizQcThirdPartyItem` 的 `del_flag==0` 且租户匹配,缺一则 `ValueError("存在无效的检测项目")`(**允许 status=0 写入模版**,套用时再过滤启用)
- [ ] **Step 4: 跑测试通过**
- [x] **Step 4: 跑测试通过**
```bash
cd backend && source venv/bin/activate && pytest tests/test_qc_inspection_item_template_helpers.py -v
@@ -230,7 +230,7 @@ cd backend && source venv/bin/activate && pytest tests/test_qc_inspection_item_t
Expected: PASS。
- [ ] **Step 5: Commit**
- [x] **Step 5: Commit**
```bash
git add backend/app/crud/qc_inspection_item_template.py backend/tests/test_qc_inspection_item_template_helpers.py
@@ -248,7 +248,7 @@ EOF
**Files:**
- Modify: `backend/app/api/qc.py`
- [ ] **Step 1: 增加 import 与 Body**
- [x] **Step 1: 增加 import 与 Body**
```python
from app.crud import qc_inspection_item_template as iit_svc
@@ -268,7 +268,7 @@ class InspectionItemTemplateUpdateBody(InspectionItemTemplateBody):
(若项目 Pydantic 写法与邻近 `LabTestItemBody` 不一致,以 `qc.py` 现有 Body 为准复制改字段。)
- [ ] **Step 2: 注册路由**
- [x] **Step 2: 注册路由**
| Method | Path | Guard |
|--------|------|-------|
@@ -283,13 +283,13 @@ class InspectionItemTemplateUpdateBody(InspectionItemTemplateBody):
**注意:** 将 `/active` 写在 `/{id}` **之前**,避免被路径参数吞掉。
- [ ] **Step 3: 冒烟(可选,需本地库已执行 Task1 SQL)**
- [x] **Step 3: 冒烟(可选,需本地库已执行 Task1 SQL)**
```bash
# 启动后端后用已登录 token 调 active;无 token 可跳过本步
```
- [ ] **Step 4: Commit**
- [x] **Step 4: Commit**
```bash
git add backend/app/api/qc.py
@@ -307,7 +307,7 @@ EOF
**Files:**
- Create: `web-admin/src/api/qc-inspection-item-template.ts`
- [ ] **Step 1: 编写 API**
- [x] **Step 1: 编写 API**
```typescript
import request from '@/utils/http'
@@ -389,7 +389,7 @@ export function fetchDeleteQcInspectionItemTemplate(id: string) {
}
```
- [ ] **Step 2: Commit**
- [x] **Step 2: Commit**
```bash
git add web-admin/src/api/qc-inspection-item-template.ts
@@ -407,7 +407,7 @@ EOF
**Files:**
- Create: `web-admin/src/views/quality-inspection/inspection-item-template/index.vue`
- [ ] **Step 1: 以环境检测项列表为骨架新建页面**
- [x] **Step 1: 以环境检测项列表为骨架新建页面**
复制结构自 `web-admin/src/views/quality-inspection/env-detect-item/index.vue`,再按下列差异改:
@@ -425,11 +425,11 @@ EOF
8. `defineOptions({ name: 'QualityInspectionInspectionItemTemplate' })`
9. 列表请求 `fetchQcInspectionItemTemplateList`;默认不展示 orderNum
- [ ] **Step 2: 本地打开页面目视**
- [x] **Step 2: 本地打开页面目视**
Hash:`/#/quality-group/quality-base/inspection-item-template`(路由 Task 7 完成后)
- [ ] **Step 3: Commit**
- [x] **Step 3: Commit**
```bash
git add web-admin/src/views/quality-inspection/inspection-item-template/index.vue
@@ -447,7 +447,7 @@ EOF
**Files:**
- Modify: `web-admin/src/router/modules/sqxp.ts`(`QualityBase.children`)
- [ ] **Step 1: 在质检项目管理之后插入路由**
- [x] **Step 1: 在质检项目管理之后插入路由**
定位 `name: 'QualityInspectionLabTestItem'`,在其后插入:
@@ -465,7 +465,7 @@ EOF
},
```
- [ ] **Step 2: Commit**
- [x] **Step 2: Commit**
```bash
git add web-admin/src/router/modules/sqxp.ts
@@ -483,7 +483,7 @@ EOF
**Files:**
- Modify: `web-admin/src/views/quality-inspection/qc-work-order/QcWorkOrderConfigureBatches.vue`
- [ ] **Step 1: 在每个批次 Tab 的 head-row 与「已选项目」之间插入模版条**
- [x] **Step 1: 在每个批次 Tab 的 head-row 与「已选项目」之间插入模版条**
模板片段(放在 `qc-batch-config__head-row` 之后):
@@ -518,7 +518,7 @@ EOF
</div>
```
- [ ] **Step 2: script 逻辑**
- [x] **Step 2: script 逻辑**
1. import:`DocumentAdd`;`fetchQcInspectionItemTemplatesActive`、`fetchCreateQcInspectionItemTemplate`;`useMenuPerm`;`ElMessageBox`(若未自动导入则按项目习惯)
2. `const { hasMenuPerm } = useMenuPerm()`
@@ -535,7 +535,7 @@ EOF
- 确认后:`batch.labItemIds = keptLab`;`batch.thirdPartyItemIds = keptThird`;`syncBatchFlags(batch)`;若 skipped>0 再 warning
8. `saveBatchAsTemplate(batch)`:无项目则 warning;`ElMessageBox.prompt` 输入名称;调 create;成功 toast + `reloadTemplates()`;不必强制改下拉选中
- [ ] **Step 3: 样式**
- [x] **Step 3: 样式**
```scss
.qc-batch-config__template-bar {
@@ -547,14 +547,14 @@ EOF
}
```
- [ ] **Step 4: 手动验收**
- [x] **Step 4: 手动验收**
1. 配置检测:选模版 → 当前批次勾选变化;其它 Tab 不变
2. 已有勾选时出现确认框
3. 存成新模版后可再次选用
4. 无 add 权限时无「存成新模版」
- [ ] **Step 5: Commit**
- [x] **Step 5: Commit**
```bash
git add web-admin/src/views/quality-inspection/qc-work-order/QcWorkOrderConfigureBatches.vue
@@ -573,17 +573,17 @@ EOF
- Modify: `docs/sql/zkxw.sql`(追加 CREATE TABLE 与菜单 INSERT,与 alter 一致)
- Run: `./scripts/update-graph.sh all`(或分别 backend / frontend)
- [ ] **Step 1: 将表结构与菜单写入 `zkxw.sql`**
- [x] **Step 1: 将表结构与菜单写入 `zkxw.sql`**
在合适位置插入 `CREATE TABLE` 与 5 条 `sys_menu` INSERT(id/perms 与常量一致)。不必导出全库;手工补齐即可。
- [ ] **Step 2: 更新 graphify**
- [x] **Step 2: 更新 graphify**
```bash
./scripts/update-graph.sh all
```
- [ ] **Step 3: Commit**
- [x] **Step 3: Commit**
```bash
git add docs/sql/zkxw.sql backend/graphify-out web-admin/graphify-out
@@ -598,14 +598,14 @@ EOF
### Task 10: 验收清单(实现者勾选)
- [ ] 执行 `alter_biz_qc_inspection_item_template.sql` 后菜单「检测项目模版」可见
- [ ] 列表可新增/编辑/启停/删除模版
- [ ] 配置检测选用仅覆盖当前批次;有勾选时二次确认
- [ ] 存成新模版写入主数据且可再选
- [ ] 无 list/工单权限时不显示选用;无 add 不显示存成
- [ ] 模版含已删/停用项目时套用跳过并提示;全无效不覆盖
- [ ] 确认配置后任务生成与改前一致
- [ ] `pytest tests/test_qc_inspection_item_template_helpers.py -v` 通过
- [ ] 执行 `alter_biz_qc_inspection_item_template.sql` 后菜单「检测项目模版」可见(需本地库执行 SQL)
- [ ] 列表可新增/编辑/启停/删除模版(需联调)
- [ ] 配置检测选用仅覆盖当前批次;有勾选时二次确认(需联调)
- [ ] 存成新模版写入主数据且可再选(需联调)
- [ ] 无 list/工单权限时不显示选用;无 add 不显示存成(需联调)
- [ ] 模版含已删/停用项目时套用跳过并提示;全无效不覆盖(需联调)
- [ ] 确认配置后任务生成与改前一致(需联调)
- [x] `pytest tests/test_qc_inspection_item_template_helpers.py -v` 通过
---