"""运营端菜单接口(与 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 一致:「Demo」参考页 +「系统管理」 STATIC_MENU_TREE = [ { "id": "10000000000000000000000000000002", "name": "Demo", "path": "/demo", "component": "/index/index", "meta": { "title": "Demo", "icon": "ri:layout-grid-line", "keepAlive": False, "roles": ["admin"], }, "children": [ { "id": "10000000000000000000000000000001_child", "name": "Console", "path": "console", "component": "/dashboard/console/index", "meta": { "title": "工作台", "icon": "ri:home-smile-2-line", "keepAlive": True, "fixedTab": True, "menuCode": "dashboard", }, }, { "id": "10000000000000000000000000000005", "name": "Unit", "path": "unit", "component": "/system/unit/index", "meta": {"title": "商品单位", "keepAlive": True}, }, { "id": "10000000000000000000000000000021", "name": "OrderList", "path": "order", "component": "/system/order/index", "meta": {"title": "订单列表", "keepAlive": True}, }, { "id": "10000000000000000000000000000006", "name": "Product", "path": "product", "component": "/system/product/index", "meta": {"title": "商品管理", "keepAlive": True}, }, { "id": "10000000000000000000000000000004", "name": "Category", "path": "category", "component": "/system/category/index", "meta": {"title": "商品分类", "keepAlive": True}, }, { "id": "10000000000000000000000000000007", "name": "User", "path": "user", "component": "/system/user/index", "meta": {"title": "用户管理", "keepAlive": True}, }, { "id": "10000000000000000000000000000008", "name": "UserDetail", "path": "user/detail", "component": "/system/user/detail", "meta": {"title": "用户详情", "isHide": True, "keepAlive": True}, }, ], }, { "id": "20000000000000000000000000000001", "name": "System", "path": "/system", "component": "/index/index", "meta": { "title": "系统管理", "icon": "ri:settings-3-line", "keepAlive": False, "roles": ["admin"], }, "children": [ { "id": "20000000000000000000000000000002", "name": "Tenant", "path": "tenant", "component": "/system/tenant/index", "meta": {"title": "租户管理", "keepAlive": True}, }, ], }, ] @router.get("/list") async def get_menu_list(_user: dict = Depends(require_admin_or_super_admin)): """获取菜单列表(与当前前端路由一致)""" return success_response({"menuList": STATIC_MENU_TREE})