Files
zkxw/backend/app/api/menu.py
T
2026-05-20 18:06:21 +08:00

263 lines
11 KiB
Python

"""运营端菜单接口(与 web-admin 前端静态路由 sqxp.ts 对齐,供后端菜单模式联调)"""
from fastapi import APIRouter, Depends
from app.core.menu_guard import require_admin_or_super_admin
from app.core.response import success_response
router = APIRouter(prefix="/web/menu", tags=["菜单管理"])
# 与 web-admin/src/router/modules/sqxp.ts 一致:系统管理、基础信息管理 等
STATIC_MENU_TREE = [
{
"id": "100",
"name": "System",
"path": "/system",
"component": "/index/index",
"meta": {
"title": "系统管理",
"icon": "ri:settings-3-line",
"keepAlive": False,
"roles": ["admin"],
},
"children": [
{
"id": "101",
"name": "Tenant",
"path": "tenant",
"component": "/system/tenant/index",
"meta": {"title": "租户管理", "keepAlive": True, "menuCode": "system:tenant:list"},
},
{
"id": "102",
"name": "Dict",
"path": "dict",
"component": "/system/dict/index",
"meta": {"title": "字典管理", "keepAlive": True, "menuCode": "system:dict:list"},
},
{
"id": "103",
"name": "Dept",
"path": "dept",
"component": "/system/dept/index",
"meta": {"title": "组织管理", "keepAlive": True, "menuCode": "system:dept:list"},
},
{
"id": "104",
"name": "User",
"path": "user",
"component": "/system/user/index",
"meta": {"title": "用户管理", "keepAlive": True, "menuCode": "system:user:list"},
},
{
"id": "10000000000000000000000000000008",
"name": "UserDetail",
"path": "user/detail",
"component": "/system/user/detail",
"meta": {"title": "用户详情", "isHide": True, "keepAlive": True},
},
{
"id": "105",
"name": "Role",
"path": "role",
"component": "/system/role/index",
"meta": {"title": "角色管理", "keepAlive": True, "menuCode": "system:role:list"},
},
{
"id": "106",
"name": "Menu",
"path": "menu",
"component": "/system/menu/index",
"meta": {"title": "菜单管理", "keepAlive": True, "menuCode": "system:menu:list"},
},
{
"id": "107",
"name": "Site",
"path": "site",
"component": "/system/site/index",
"meta": {"title": "站点管理", "keepAlive": True, "menuCode": "system:site:list"},
},
{
"id": "108",
"name": "Post",
"path": "post",
"component": "/system/post/index",
"meta": {"title": "职位管理", "keepAlive": True, "menuCode": "system:post:list"},
},
{
"id": "109",
"name": "Unit",
"path": "unit",
"component": "/system/unit/index",
"meta": {"title": "物品单位管理", "keepAlive": True, "menuCode": "system:unit:list"},
},
{
"id": "110",
"name": "Express",
"path": "express",
"component": "/system/express/index",
"meta": {"title": "快递公司", "keepAlive": True, "menuCode": "system:express:list"},
},
],
},
{
"id": "40000000000000000000000000000001",
"name": "BasicInfo",
"path": "/basic-info",
"component": "/index/index",
"meta": {
"title": "基础信息管理",
"icon": "ri:folder-user-line",
"keepAlive": False,
"roles": ["admin"],
},
"children": [
{
"id": "40000000000000000000000000000002",
"name": "BizCustomer",
"path": "customer",
"component": "/basic-info/customer/index",
"meta": {"title": "客户管理", "keepAlive": True, "menuCode": "biz:customer:list"},
},
{
"id": "40000000000000000000000000000003",
"name": "BizCellSampleType",
"path": "cell-sample-type",
"component": "/basic-info/cell-sample-type/index",
"meta": {"title": "细胞样本类型管理", "keepAlive": True, "menuCode": "biz:cellSampleType:list"},
},
{
"id": "40000000000000000000000000000004",
"name": "BizCollectionRegion",
"path": "collection-region",
"component": "/basic-info/collection-region/index",
"meta": {"title": "采集地区及医院管理", "keepAlive": True, "menuCode": "biz:collectionRegion:list"},
},
{
"id": "40000000000000000000000000000005",
"name": "BizCollectionProtocolNo",
"path": "collection-protocol-no",
"component": "/basic-info/collection-protocol-no/index",
"meta": {"title": "采集协议号管理", "keepAlive": True, "menuCode": "biz:collectionProtocolNo:list"},
},
{
"id": "40000000000000000000000000000006",
"name": "BizSampleCode",
"path": "sample-code",
"component": "/basic-info/sample-code/index",
"meta": {"title": "样本编码管理", "keepAlive": True, "menuCode": "biz:sampleCode:list"},
},
],
},
{
"id": "50000000000000000000000000000001",
"name": "CellStorage",
"path": "/cell-storage",
"component": "/index/index",
"meta": {
"title": "细胞存储管理",
"icon": "ri:test-tube-line",
"keepAlive": False,
"roles": ["admin"],
},
"children": [
{
"id": "50000000000000000000000000000002",
"name": "CellStorageProtocol",
"path": "protocol",
"component": "/cell-storage/protocol/index",
"meta": {"title": "采集协议单录入", "keepAlive": True},
},
{
"id": "50000000000000000000000000000003",
"name": "CellStorageProtocolAudit",
"path": "protocol-audit",
"component": "/cell-storage/protocol-audit/index",
"meta": {"title": "采集协议单管理", "keepAlive": True},
},
{
"id": "50000000000000000000000000000007",
"name": "CellStoragePaymentInfo",
"path": "payment-info",
"component": "/cell-storage/payment-info/index",
"meta": {"title": "缴费信息", "keepAlive": True},
},
{
"id": "50000000000000000000000000000004",
"name": "CellStoragePaymentConfirm",
"path": "payment-confirm",
"component": "/cell-storage/payment-confirm/index",
"meta": {"title": "缴费确认(财务)", "keepAlive": True},
},
{
"id": "50000000000000000000000000000005",
"name": "CellStorageRefundConfirm",
"path": "refund-confirm",
"component": "/cell-storage/refund-confirm/index",
"meta": {"title": "退费确认(财务)", "keepAlive": True},
},
],
},
{
"id": "70000000000000000000000000000001",
"name": "QualityInspection",
"path": "/quality-inspection",
"component": "/index/index",
"meta": {
"title": "质量检测",
"icon": "ri:shield-check-line",
"keepAlive": False,
"roles": ["admin"],
},
"children": [
{
"id": "70000000000000000000000000000002",
"name": "QualityInspectionSampleReception",
"path": "sample-reception",
"component": "/quality-inspection/sample-reception/index",
"meta": {"title": "样本接收", "keepAlive": True},
},
{
"id": "70000000000000000000000000000003",
"name": "QualityInspectionSampleReceptionCheckItem",
"path": "sample-reception-check-item",
"component": "/quality-inspection/sample-reception-check-item/index",
"meta": {"title": "接收检查项配置", "keepAlive": True},
},
{
"id": "70000000000000000000000000000004",
"name": "QualityInspectionThirdPartyCompany",
"path": "third-party-company",
"component": "/quality-inspection/third-party-company/index",
"meta": {"title": "第三方检测公司及项目", "keepAlive": True, "menuCode": "biz:qcThirdPartyCompany:list"},
},
{
"id": "70000000000000000000000000000006",
"name": "QualityInspectionLabTestItem",
"path": "lab-test-item",
"component": "/quality-inspection/lab-test-item/index",
"meta": {"title": "实验室自检项目", "keepAlive": True, "menuCode": "biz:qcLabTestItem:list"},
},
{
"id": "70000000000000000000000000000007",
"name": "QualityInspectionQcWorkOrder",
"path": "qc-work-order",
"component": "/quality-inspection/qc-work-order/index",
"meta": {"title": "入库质检工单", "keepAlive": True, "menuCode": "biz:qcWorkOrder:list"},
},
{
"id": "70000000000000000000000000000008",
"name": "QualityInspectionQcTask",
"path": "qc-task",
"component": "/quality-inspection/qc-task/index",
"meta": {"title": "质检任务", "keepAlive": True, "menuCode": "biz:qcTask:list"},
},
],
},
]
@router.get("/list")
async def get_menu_list(_user: dict = Depends(require_admin_or_super_admin)):
"""获取菜单列表(与当前前端路由一致)"""
return success_response({"menuList": STATIC_MENU_TREE})