Files
zkxw/docs/superpowers/plans/2026-05-17-pilot-service-management.md
T
2026-05-18 16:21:38 +08:00

29 KiB
Raw Blame History

中试服务管理 6 模块实现计划

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.

Goal: 实现中试服务管理下 6 个基础数据 CRUD 模块(后端 API + 前端页面 + 路由 + 菜单),覆盖细胞产品类型/规格/价格体系/项目价格、渠道信息、体检机构。

Architecture: 后端单文件 pilot_service.py(CRUD + Route),Model 追加到 models.py;前端 6 个 Vue 页面 + API 函数追加到 admin.ts;菜单 SQL 独立文件。所有模块严格复制现有 customer.py / item_unit.py / basic_info.py 模式。

Tech Stack: Python 3.9 / FastAPI / SQLAlchemy / Pydantic v2(后端);Vue 3 / TypeScript / Element Plus / Tailwind CSS 4(前端);MySQL 5.7

Design Spec: docs/superpowers/specs/2026-05-17-pilot-service-management-design.md


File Structure

# 文件 操作 职责
1 backend/app/models/models.py 追加 13 个 SQLAlchemy Model
2 backend/app/crud/pilot_service.py 新建 全部 6 模块 CRUD 函数
3 backend/app/api/pilot_service.py 新建 全部 6 模块路由 + Pydantic Body
4 backend/app/api/__init__.py 追加 import + all
5 backend/app/main.py 追加 include_router
6 web-admin/src/api/admin.ts 追加 API 函数
7-12 web-admin/src/views/pilot-service/{module}/index.vue 新建 ×6 前端页面
13 web-admin/src/router/modules/sqxp.ts 追加 路由配置
14 docs/sql/sys_menu_pilot_service.sql 新建 菜单 INSERT

Task 1: 后端 — 新增 13 个 SQLAlchemy Model

Files:

  • Modify: backend/app/models/models.py (在 L1354 BizExhibitionAppointment 之后、L1356 qc_param import 之前追加)

  • Step 1: 在 models.py 末尾(qc_param import 行之前)追加 13 个 Model 类

在 BizExhibitionAppointment 类定义之后、from app.models.qc_param import ... 行之前,追加以下 13 个 Model。每个 Model 严格遵循 id → 业务字段 → 公共字段 顺序,列定义与 zkxw.sql 中 CREATE TABLE 语句一一对应。

需要追加的 13 个类:

# 2.3.1 细胞产品类型
BizCellProductType(biz_cell_product_type)
  id, product_type_code, product_type_name → 公共字段

# 2.3.2 细胞产品规格
BizCellProductSpec(biz_cell_product_spec)
  id, spec_code, spec_name → 公共字段

# 2.3.3 细胞产品价格体系
BizCellProductPrice(biz_cell_product_price)
  id, project_name, project_code, cell_type_code, cell_type_name, spec_text, spec_id, cell_product_type_id, unit_price(Numeric(18,2)) → 公共字段

# 2.3.4 细胞产品项目价格体系(主表)
BizCellProductProjectSystem(biz_cell_product_project_system)
  id, system_name, system_code, status(CHAR(1), default="1") → 公共字段

# 2.3.4 细胞产品项目价格体系(明细子表)
BizCellProductProjectSystemItem(biz_cell_product_project_system_item)
  id, project_system_id, source_price_id, project_name, project_code, cell_type_code, cell_type_name, spec_text, spec_id, cell_product_type_id, unit_price(Numeric(18,2)) → 公共字段

# 2.3.5 渠道信息(主表)
BizChannel(biz_channel)
  id, channel_name, credit_code, channel_type, contact_name, contact_phone, contact_email, protocol_attachments(String(4000)) → 公共字段

# 2.3.5 渠道协议
BizChannelAgreement(biz_channel_agreement)
  id, channel_id, agreement_type, business_type, settle_mode, credit_limit_amount(Numeric(18,2)), effective_date(CHAR(8)), expire_date(CHAR(8)), agreement_status(default="sxz") → 公共字段

# 2.3.5 渠道协议-产品价格
BizChannelAgreementProductPrice(biz_channel_agreement_product_price)
  id, channel_agreement_id, project_name, project_code, cell_type_code, cell_type_name, spec_text, original_price(Numeric(18,2)), agreement_price(Numeric(18,2)) → 公共字段

# 2.3.5 渠道开票信息
BizChannelInvoice(biz_channel_invoice)
  id, channel_id, company_name, tax_no, company_address, company_phone, bank_name, bank_account → 公共字段

# 2.3.5 渠道邮寄地址
BizChannelMailAddress(biz_channel_mail_address)
  id, channel_id, mail_address, mail_contact, mail_phone → 公共字段

# 2.3.6 体检机构
BizCheckupInstitution(biz_checkup_institution)
  id, institution_name, institution_address, contact_name, contact_phone, status(CHAR(1), default="1") → 公共字段

# 2.3.6 体检机构开票信息
BizCheckupInstitutionInvoice(biz_checkup_institution_invoice)
  id, checkup_institution_id, company_name, tax_no, company_address, company_phone, bank_name, bank_account → 公共字段

# 2.3.6 体检机构项目及价格
BizCheckupInstitutionProject(biz_checkup_institution_project)
  id, checkup_institution_id, project_name, project_fee(Numeric(18,2)) → 公共字段

每个类的公共字段(从 tenant_no 到 del_flag)完全复制 BizExhibitionAppointment 的模式。

  • Step 2: 验证 Model 无语法错误

Run: cd backend && source venv/bin/activate && python -c "from app.models.models import BizCellProductType, BizCellProductSpec, BizCellProductPrice, BizCellProductProjectSystem, BizCellProductProjectSystemItem, BizChannel, BizChannelAgreement, BizChannelAgreementProductPrice, BizChannelInvoice, BizChannelMailAddress, BizCheckupInstitution, BizCheckupInstitutionInvoice, BizCheckupInstitutionProject; print('All 13 models imported OK')" Expected: All 13 models imported OK

  • Step 3: Commit
git add backend/app/models/models.py
git commit -m "feat: add 13 SQLAlchemy models for pilot service management (2.3.1-2.3.6)"

Task 2: 后端 — 创建 CRUD 文件

Files:

  • Create: backend/app/crud/pilot_service.py

  • Step 1: 创建 backend/app/crud/pilot_service.py

单文件,按模块分段组织。文件结构:

"""中试服务管理 CRUD(细胞产品类型/规格/价格体系/项目价格、渠道信息、体检机构)"""
from __future__ import annotations
import math
from datetime import datetime
from typing import Any, Dict, List, Optional, Tuple
from sqlalchemy import and_, func, or_
from sqlalchemy.orm import Session
from app.core.utils import generate_uuid
from app.models.models import (
    BizCellProductType, BizCellProductSpec, BizCellProductPrice,
    BizCellProductProjectSystem, BizCellProductProjectSystemItem,
    BizChannel, BizChannelAgreement, BizChannelAgreementProductPrice,
    BizChannelInvoice, BizChannelMailAddress,
    BizCheckupInstitution, BizCheckupInstitutionInvoice, BizCheckupInstitutionProject,
)

每个实体遵循 customer.py 的完整模式:

  1. _row_to_dict_xxx() — camelCase 转换
  2. list_xxx() — 分页 + keyword + tenant_no 过滤
  3. get_xxx() — 单条查询
  4. xxx_code_exists() — 编码唯一性校验(有编码字段的实体)
  5. create_xxx() — 新增(generate_uuid, validate, commit+refresh)
  6. update_xxx() — 更新(validate, commit+refresh)
  7. soft_delete_xxx() — 软删除(del_flag=1)

简单实体(复制 customer.py 模式,字段替换):

  • BizCellProductType — keyword 搜索 product_type_code / product_type_name
  • BizCellProductSpec — keyword 搜索 spec_code / spec_name
  • BizCellProductPrice — keyword 搜索 project_name / project_code / cell_type_name;额外接受 cell_type_code 过滤参数

主子表实体(主表 CRUD + 子表 CRUD):

BizCellProductProjectSystem + BizCellProductProjectSystemItem:

  • 主表:标准 7 函数
  • 子表:list_project_system_items(db, project_system_id, tenant_no) + create_project_system_item() + update_project_system_item() + soft_delete_project_system_item()
  • _row_to_dict_project_system_item() 中包含完整字段

BizChannel + 4 张子表:

  • 主表 BizChannel:标准 7 函数,keyword 搜索 channel_name / credit_code / contact_name
  • 子表 BizChannelInvoice:标准子表 CRUD(by channel_id)
  • 子表 BizChannelMailAddress:标准子表 CRUD(by channel_id)
  • 子表 BizChannelAgreement:标准子表 CRUD(by channel_id)+ activate_channel_agreement() (设置 agreement_status="sxz") + void_channel_agreement() (设置 agreement_status="yzf")
  • 子表 BizChannelAgreementProductPrice:标准子表 CRUD(by channel_agreement_id)

BizCheckupInstitution + 2 张子表:

  • 主表 BizCheckupInstitution:标准 7 函数
  • 子表 BizCheckupInstitutionInvoice:标准子表 CRUD(by checkup_institution_id)
  • 子表 BizCheckupInstitutionProject:标准子表 CRUD(by checkup_institution_id)

末尾提供 total_pages(total, page_size) 工具函数(与 customer.py 一致)。

  • Step 2: 验证 CRUD 文件可导入

Run: cd backend && source venv/bin/activate && python -c "from app.crud import pilot_service; print('CRUD imported OK')" Expected: CRUD imported OK

  • Step 3: Commit
git add backend/app/crud/pilot_service.py
git commit -m "feat: add CRUD functions for pilot service management (6 modules, 13 entities)"

Task 3: 后端 — 创建路由文件 + 注册

Files:

  • Create: backend/app/api/pilot_service.py

  • Modify: backend/app/api/__init__.py

  • Modify: backend/app/main.py

  • Step 1: 创建 backend/app/api/pilot_service.py

复制 basic_info.py 的头部模式:

"""中试服务管理 API(细胞产品类型/规格/价格体系/项目价格、渠道信息、体检机构)"""
from typing import Any, List, Optional
from fastapi import APIRouter, Depends, Query
from pydantic import BaseModel, ConfigDict, Field
from sqlalchemy.orm import Session
from app.core.database import get_db
from app.core.menu_guard import require_admin_or_super_admin, require_menu_code
from app.core.response import error_response, success_response
from app.crud import pilot_service as ps_svc
from app.models.models import SysUser

router = APIRouter(prefix="/web/admin", tags=["中试服务管理"])

def _get_tenant_no(db: Session, user: dict) -> str:
    user_id = user.get("user_id")
    if not user_id:
        raise PermissionError("用户身份信息缺失")
    sys_user = db.query(SysUser).filter(SysUser.id == user_id).first()
    if not sys_user or not sys_user.tenant_no:
        raise PermissionError("用户租户信息缺失")
    return sys_user.tenant_no

每个简单实体提供 4 个端点(GET list / POST create / PUT update / DELETE),完全复制 basic_info.py 中客户管理的模式。

端点清单:

简单实体(4 端点 × 3):

  • /cell-product-types — 2.3.1
  • /cell-product-specs — 2.3.2
  • /cell-product-prices — 2.3.3(CreateBody 额外含 cell_type_code, cell_type_name, spec_id, spec_text, cell_product_type_id, unit_price)

主子表实体(主表 4 端点 + 子表 4 端点):

  • /project-price-systems — 2.3.4 主表
  • /project-price-systems/{id}/items GET — 列出子表
  • /project-price-systems/{id}/items POST — 新增子表行
  • /project-system-items/{id} PUT — 更新子表行
  • /project-system-items/{id} DELETE — 删除子表行

渠道(主表 4 端点 + 各子表端点):

  • /channels — 2.3.5 主表 CRUD
  • /channels/{id}/invoices GET/POST — 开票信息
  • /channel-invoices/{id} PUT/DELETE — 开票信息
  • /channels/{id}/mail-addresses GET/POST — 邮寄地址
  • /channel-mail-addresses/{id} PUT/DELETE — 邮寄地址
  • /channels/{id}/agreements GET/POST — 协议
  • /channel-agreements/{id} PUT/DELETE — 协议
  • /channel-agreements/{id}/activate PUT — 协议生效
  • /channel-agreements/{id}/void PUT — 协议作废
  • /channel-agreements/{id}/product-prices GET/POST — 协议产品价格
  • /channel-agreement-product-prices/{id} PUT/DELETE — 协议产品价格

体检机构(主表 4 端点 + 子表端点):

  • /checkup-institutions — 2.3.6 主表 CRUD
  • /checkup-institutions/{id}/invoices GET/POST — 开票信息
  • /checkup-institution-invoices/{id} PUT/DELETE — 开票信息
  • /checkup-institutions/{id}/projects GET/POST — 项目及价格
  • /checkup-institution-projects/{id} PUT/DELETE — 项目及价格

Pydantic Body Models 定义在路由文件内部(与 basic_info.py 一致),使用 Field(..., alias="camelCase") 映射。

List 端点暂时使用 require_admin_or_super_admin(与 admin.py 中物品单位管理一致),不引入 menu_code。后续菜单配置完成后再按需调整。

  • Step 2: 注册路由到 __init__.py

在 backend/app/api/__init__.py 中追加:

from app.api.pilot_service import router as pilot_service_router

并在 __all__ 列表中追加 "pilot_service_router"。

  • Step 3: 注册路由到 main.py

在 backend/app/main.py 中:

  • import 行追加 from app.api import ..., pilot_service_router

  • 在已有的 app.include_router(...) 行之后追加: app.include_router(pilot_service_router, prefix=settings.API_V1_PREFIX)

  • Step 4: 验证路由注册成功

Run: cd backend && source venv/bin/activate && python -c "from app.main import app; routes = [r.path for r in app.routes]; print(any('cell-product-types' in str(r) for r in routes))" Expected: True

  • Step 5: 启动服务验证无报错

Run: cd backend && source venv/bin/activate && timeout 5 python -c "import uvicorn; from app.main import app; print('App loads OK')" 2>&1 Expected: App loads OK

  • Step 6: Commit
git add backend/app/api/pilot_service.py backend/app/api/__init__.py backend/app/main.py
git commit -m "feat: add pilot service API routes + registration (6 modules, 13 entities)"

Task 4: 前端 — API 函数

Files:

  • Modify: web-admin/src/api/admin.ts

  • Step 1: 在 admin.ts 末尾追加所有 API 函数

每个实体 4 个函数(fetchXxxList / fetchCreateXxx / fetchUpdateXxx / fetchDeleteXxx),遵循现有模式:

// URL 模式: GET /web/admin/cell-product-types, POST /web/admin/cell-product-types, 等
// request.post 使用 params 而非 data(HTTP client 自动处理)

需要追加的函数组:

2.3.1 细胞产品类型 (4 函数) 2.3.2 细胞产品规格 (4 函数) 2.3.3 细胞产品价格体系 (4 函数,list 额外支持 cellTypeCode 过滤参数) 2.3.4 项目价格体系主表 (4 函数) 2.3.4 项目价格体系子表 (4 函数 + fetchProjectSystemItems) 2.3.5 渠道主表 (4 函数) 2.3.5 渠道开票信息子表 (4 函数 + fetchChannelInvoices) 2.3.5 渠道邮寄地址子表 (4 函数 + fetchChannelMailAddresses) 2.3.5 渠道协议子表 (4 函数 + fetchChannelAgreements + fetchActivateChannelAgreement + fetchVoidChannelAgreement) 2.3.5 渠道协议价格子表 (4 函数 + fetchChannelAgreementPrices) 2.3.6 体检机构主表 (4 函数) 2.3.6 体检机构开票信息子表 (4 函数 + fetchCheckupInstitutionInvoices) 2.3.6 体检机构项目子表 (4 函数 + fetchCheckupInstitutionProjects)

总计约 50+ API 函数。

  • Step 2: 验证 TypeScript 无报错

Run: cd web-admin && npx tsc --noEmit src/api/admin.ts 2>&1 | head -20 Expected: 无错误输出(或仅与本次修改无关的已有警告)

  • Step 3: Commit
git add web-admin/src/api/admin.ts
git commit -m "feat: add frontend API functions for pilot service management (6 modules)"

Task 5: 前端 — 细胞产品类型管理页面 (2.3.1)

Files:

  • Create: web-admin/src/views/pilot-service/cell-product-type/index.vue

  • Step 1: 创建页面文件

复制 web-admin/src/views/system/unit/index.vue 作为模板,修改为:

  • defineOptions({ name: 'PilotCellProductType' })

  • API 调用替换为 fetchCellProductTypeList / fetchCreateCellProductType / fetchUpdateCellProductType / fetchDeleteCellProductType

  • import 来源 @/api/admin

  • 列表列:序号、类型编码(productTypeCode)、类型名称(productTypeName)、备注(remark)、创建时间(createTime)、操作

  • 表单字段:类型编码(必填)、类型名称(必填)、备注

  • 搜索:keyword 搜索编码/名称

  • 标题:细胞产品类型管理

  • 保持 unit/index.vue 的所有 CSS 类和布局结构不变

  • 操作列按钮:查看、编辑、删除

  • 不展示排序字段(按 AGENTS.md 约定)

  • Step 2: 验证页面可正常加载(dev server)

Run: cd web-admin && npx vue-tsc --noEmit src/views/pilot-service/cell-product-type/index.vue 2>&1 | head -10 Expected: 无错误

  • Step 3: Commit
git add web-admin/src/views/pilot-service/cell-product-type/index.vue
git commit -m "feat: add cell product type management page (2.3.1)"

Task 6: 前端 — 细胞产品规格管理页面 (2.3.2)

Files:

  • Create: web-admin/src/views/pilot-service/cell-product-spec/index.vue

  • Step 1: 创建页面文件

复制 Task 5 的 cell-product-type/index.vue,修改为:

  • defineOptions({ name: 'PilotCellProductSpec' })

  • API 调用替换为 fetchCellProductSpecList / fetchCreateCellProductSpec / ...

  • 列表列:序号、规格编码(specCode)、规格名称(specName)、备注、创建时间、操作

  • 表单字段:规格编码(必填)、规格名称(必填)、备注

  • 标题:细胞产品规格管理

  • Step 2: Commit

git add web-admin/src/views/pilot-service/cell-product-spec/index.vue
git commit -m "feat: add cell product spec management page (2.3.2)"

Task 7: 前端 — 细胞产品价格体系管理页面 (2.3.3)

Files:

  • Create: web-admin/src/views/pilot-service/cell-product-price/index.vue

  • Step 1: 创建页面文件

复制 Task 5 的 cell-product-type/index.vue,扩展为:

  • defineOptions({ name: 'PilotCellProductPrice' })

  • API 调用替换为对应函数

  • 列表列:序号、项目名称(projectName)、项目编码(projectCode)、细胞类型名称(cellTypeName)、规格(specText)、单价(unitPrice)、备注、创建时间、操作

  • 新增/编辑弹窗增加下拉关联:

    • 细胞产品类型:el-select 调用 fetchCellProductTypeList({ page: 1, pageSize: 999 }) 获取选项,选择后填充 cellTypeCode + cellTypeName + cellProductTypeId
    • 规格:el-select 调用 fetchCellProductSpecList({ page: 1, pageSize: 999 }) 获取选项,选择后填充 specId + specText
    • 单价:el-input-number (precision=2, min=0)
  • 表单字段:项目名称(必填)、项目编码(必填)、细胞产品类型(下拉)、规格(下拉)、单价(元)、备注

  • import 新增:fetchCellProductTypeList, fetchCellProductSpecList

  • 标题:细胞产品价格体系管理

  • Step 2: Commit

git add web-admin/src/views/pilot-service/cell-product-price/index.vue
git commit -m "feat: add cell product price system page with dropdown relations (2.3.3)"

Task 8: 前端 — 细胞产品项目价格管理页面 (2.3.4)

Files:

  • Create: web-admin/src/views/pilot-service/project-price-system/index.vue

  • Step 1: 创建页面文件

参考 web-admin/src/views/system/category/index.vue 主子表模式,构建:

  • defineOptions({ name: 'PilotProjectPriceSystem' })

  • 列表区:主表分页列表

    • 列:序号、体系名称(systemName)、体系编码(systemCode)、状态(tag: 正常/停用)、备注、创建时间、操作
    • 操作按钮:查看、编辑、删除
  • 新增/编辑弹窗:

    • 上半部分:主表字段(体系名称必填、体系编码必填、状态下拉、备注)
    • 下半部分:el-table 明细表(可编辑)
      • 列:项目名称、项目编码、细胞类型名称、规格、单价(可编辑 el-input-number)、操作(删除)
      • 底部按钮:"从价格体系添加" — 弹出 el-dialog 选择价格体系(2.3.3)的行,选择后自动填充明细行数据
      • 支持手动修改 unitPrice
    • 保存时:先 save 主表 → 获取 id → 逐行 save 子表
  • import:fetchProjectSystemList, fetchCreateProjectSystem, ... 以及 fetchCellProductPriceList(用于选择添加)

  • 标题:细胞产品项目价格管理

  • Step 2: Commit

git add web-admin/src/views/pilot-service/project-price-system/index.vue
git commit -m "feat: add project price system page with master-detail table (2.3.4)"

Task 9: 前端 — 渠道信息管理页面 (2.3.5)

Files:

  • Create: web-admin/src/views/pilot-service/channel/index.vue

  • Step 1: 创建页面文件

参考 web-admin/src/views/system/product/index.vue 多 section 模式,构建:

  • defineOptions({ name: 'PilotChannel' })

  • 列表区:渠道分页列表

    • 列:序号、渠道名称(channelName)、统一社会信用代码(creditCode)、渠道类型(tag: yy医院/hzjg合作机构/zs诊所/zfjg政府机构/qt其他)、联系人(contactName)、联系电话(contactPhone)、创建时间、操作
  • 新增/编辑弹窗(宽度 1000px,使用 el-tabs):

    • Tab 1 基础信息:渠道名称(必填)、统一社会信用代码、渠道类型(下拉)、联系人姓名、联系电话、联系邮箱、渠道协议附件(上传)、备注
    • Tab 2 开票信息:el-table 子表 + 新增/编辑/删除按钮
      • 弹窗表单:单位名称(必填)、税号、单位地址、电话、开户银行、银行账号
    • Tab 3 邮寄地址:el-table 子表 + 新增/编辑/删除按钮
      • 弹窗表单:邮寄地址(必填)、邮寄联系人、邮寄联系电话
    • Tab 4 协议信息:el-table 子表 + 新增/编辑/删除按钮
      • 弹窗表单:协议类型(必填,下拉 kyxy/zsxy/lcxy)、结算方式(下拉)、授信额度、生效日期、到期日期
      • 每行操作按钮:查看价格明细、生效、作废
      • 价格明细子弹窗:el-table 显示协议价格
        • 底部按钮:"从价格体系添加"、"从项目价格体系添加"
        • 选择后自动填充项目名称/编码/细胞类型/规格/原价,协议价需手动输入
        • 支持编辑协议价、删除行
  • import:渠道相关 API + fetchCellProductPriceList + fetchProjectSystemList + fetchProjectSystemItems

  • 标题:渠道信息管理

  • Step 2: Commit

git add web-admin/src/views/pilot-service/channel/index.vue
git commit -m "feat: add channel management page with multi-tab sub-tables (2.3.5)"

Task 10: 前端 — 体检机构及项目价格页面 (2.3.6)

Files:

  • Create: web-admin/src/views/pilot-service/checkup-institution/index.vue

  • Step 1: 创建页面文件

参考 category/index.vue 主子表模式 + Task 9 的 tab 模式:

  • defineOptions({ name: 'PilotCheckupInstitution' })

  • 列表区:分页列表

    • 列:序号、机构名称(institutionName)、机构地址(institutionAddress)、联系人(contactName)、联系电话(contactPhone)、状态(tag)、创建时间、操作
  • 新增/编辑弹窗(宽度 900px,el-tabs):

    • Tab 1 基础信息:机构名称(必填)、机构地址、联系人、联系电话、状态(正常/停用)、备注
    • Tab 2 开票信息:el-table 子表 + 新增/编辑/删除
      • 弹窗表单:单位名称(必填)、税号、单位地址、电话、开户银行、银行账号
    • Tab 3 项目及价格:el-table 子表 + 新增/编辑/删除
      • 弹窗表单:项目名称(必填)、项目费用(元, el-input-number)
  • 标题:体检机构及项目价格

  • Step 2: Commit

git add web-admin/src/views/pilot-service/checkup-institution/index.vue
git commit -m "feat: add checkup institution management page with sub-tables (2.3.6)"

Task 11: 前端路由 + 菜单 SQL

Files:

  • Modify: web-admin/src/router/modules/sqxp.ts

  • Create: docs/sql/sys_menu_pilot_service.sql

  • Step 1: 在 sqxp.ts 中追加中试服务管理路由块

在 CellStorage 路由块之后追加新的路由组:

{
  id: '80000000000000000000000000000001',
  name: 'PilotService',
  path: '/pilot-service',
  component: '/index/index',
  meta: {
    title: '中试服务管理',
    icon: 'ri:flask-line',
    keepAlive: false,
    roles: ['admin']
  },
  children: [
    {
      id: '80000000000000000000000000000002',
      name: 'CellProductType',
      path: 'cell-product-type',
      component: '/pilot-service/cell-product-type/index',
      meta: { title: '细胞产品类型管理', keepAlive: true }
    },
    {
      id: '80000000000000000000000000000003',
      name: 'CellProductSpec',
      path: 'cell-product-spec',
      component: '/pilot-service/cell-product-spec/index',
      meta: { title: '细胞产品规格管理', keepAlive: true }
    },
    {
      id: '80000000000000000000000000000004',
      name: 'CellProductPrice',
      path: 'cell-product-price',
      component: '/pilot-service/cell-product-price/index',
      meta: { title: '细胞产品价格体系管理', keepAlive: true }
    },
    {
      id: '80000000000000000000000000000005',
      name: 'ProjectPriceSystem',
      path: 'project-price-system',
      component: '/pilot-service/project-price-system/index',
      meta: { title: '细胞产品项目价格管理', keepAlive: true }
    },
    {
      id: '80000000000000000000000000000006',
      name: 'Channel',
      path: 'channel',
      component: '/pilot-service/channel/index',
      meta: { title: '渠道信息管理', keepAlive: true }
    },
    {
      id: '80000000000000000000000000000007',
      name: 'CheckupInstitution',
      path: 'checkup-institution',
      component: '/pilot-service/checkup-institution/index',
      meta: { title: '体检机构及项目价格', keepAlive: true }
    }
  ]
}

注意:追加在 sqxpAdminRoutes 数组中 CellStorage 路由块之后。

  • Step 2: 创建 docs/sql/sys_menu_pilot_service.sql
-- 中试服务管理菜单 (Web端,parent_id=2 为 Web 端根菜单)
INSERT INTO sys_menu (id, menu_name, parent_id, order_num, path, component, menu_type, visible, status, perms, icon, create_time, update_time)
VALUES ('80000000000000000000000000000001', '中试服务管理', 2, 5, '/pilot-service', NULL, 'D', '1', '1', NULL, 'ri:flask-line', NOW(), NOW());

INSERT INTO sys_menu (id, menu_name, parent_id, order_num, path, component, menu_type, visible, status, perms, icon, create_time, update_time)
VALUES ('80000000000000000000000000000002', '细胞产品类型管理', '80000000000000000000000000000001', 1, 'cell-product-type', 'pilot-service/cell-product-type/index', 'C', '1', '1', NULL, NULL, NOW(), NOW());

INSERT INTO sys_menu (id, menu_name, parent_id, order_num, path, component, menu_type, visible, status, perms, icon, create_time, update_time)
VALUES ('80000000000000000000000000000003', '细胞产品规格管理', '80000000000000000000000000000001', 2, 'cell-product-spec', 'pilot-service/cell-product-spec/index', 'C', '1', '1', NULL, NULL, NOW(), NOW());

INSERT INTO sys_menu (id, menu_name, parent_id, order_num, path, component, menu_type, visible, status, perms, icon, create_time, update_time)
VALUES ('80000000000000000000000000000004', '细胞产品价格体系管理', '80000000000000000000000000000001', 3, 'cell-product-price', 'pilot-service/cell-product-price/index', 'C', '1', '1', NULL, NULL, NOW(), NOW());

INSERT INTO sys_menu (id, menu_name, parent_id, order_num, path, component, menu_type, visible, status, perms, icon, create_time, update_time)
VALUES ('80000000000000000000000000000005', '细胞产品项目价格管理', '80000000000000000000000000000001', 4, 'project-price-system', 'pilot-service/project-price-system/index', 'C', '1', '1', NULL, NULL, NOW(), NOW());

INSERT INTO sys_menu (id, menu_name, parent_id, order_num, path, component, menu_type, visible, status, perms, icon, create_time, update_time)
VALUES ('80000000000000000000000000000006', '渠道信息管理', '80000000000000000000000000000001', 5, 'channel', 'pilot-service/channel/index', 'C', '1', '1', NULL, NULL, NOW(), NOW());

INSERT INTO sys_menu (id, menu_name, parent_id, order_num, path, component, menu_type, visible, status, perms, icon, create_time, update_time)
VALUES ('80000000000000000000000000000007', '体检机构及项目价格', '80000000000000000000000000000001', 6, 'checkup-institution', 'pilot-service/checkup-institution/index', 'C', '1', '1', NULL, NULL, NOW(), NOW());
  • Step 3: Commit
git add web-admin/src/router/modules/sqxp.ts docs/sql/sys_menu_pilot_service.sql
git commit -m "feat: add pilot service routes and menu SQL (6 modules)"

Task 12: 最终验证

  • Step 1: 后端启动验证

Run: cd backend && source venv/bin/activate && timeout 8 python -c "from app.main import app; print('Backend loads OK')" 2>&1 Expected: Backend loads OK

  • Step 2: 前端构建验证

Run: cd web-admin && pnpm build 2>&1 | tail -5 Expected: 构建成功,无错误

  • Step 3: LSP 诊断检查

对以下文件运行 lsp_diagnostics:

  • backend/app/api/pilot_service.py
  • backend/app/crud/pilot_service.py
  • web-admin/src/views/pilot-service/channel/index.vue

Expected: 无 error 级别诊断

  • Step 4: Final commit (if any fixes needed)
git add -A
git commit -m "fix: address final verification issues for pilot service management"