menu.py 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. """运营端菜单接口(与 web-admin 前端静态路由 sqxp.ts 对齐,供后端菜单模式联调)"""
  2. from fastapi import APIRouter, Depends
  3. from app.core.menu_guard import require_admin_or_super_admin
  4. from app.core.response import success_response
  5. router = APIRouter(prefix="/web/menu", tags=["菜单管理"])
  6. # 与 web-admin/src/router/modules/sqxp.ts 一致:工作台、系统管理、基础信息管理 等
  7. STATIC_MENU_TREE = [
  8. {
  9. "id": "10000000000000000000000000000001_child",
  10. "name": "Console",
  11. "path": "/console",
  12. "component": "/dashboard/console/index",
  13. "meta": {
  14. "title": "工作台",
  15. "keepAlive": True,
  16. "fixedTab": True,
  17. "menuCode": "dashboard",
  18. },
  19. },
  20. {
  21. "id": "100",
  22. "name": "System",
  23. "path": "/system",
  24. "component": "/index/index",
  25. "meta": {
  26. "title": "系统管理",
  27. "icon": "ri:settings-3-line",
  28. "keepAlive": False,
  29. "roles": ["admin"],
  30. },
  31. "children": [
  32. {
  33. "id": "101",
  34. "name": "Tenant",
  35. "path": "tenant",
  36. "component": "/system/tenant/index",
  37. "meta": {"title": "租户管理", "keepAlive": True, "menuCode": "system:tenant:list"},
  38. },
  39. {
  40. "id": "102",
  41. "name": "Dict",
  42. "path": "dict",
  43. "component": "/system/dict/index",
  44. "meta": {"title": "字典管理", "keepAlive": True, "menuCode": "system:dict:list"},
  45. },
  46. {
  47. "id": "103",
  48. "name": "Dept",
  49. "path": "dept",
  50. "component": "/system/dept/index",
  51. "meta": {"title": "组织管理", "keepAlive": True, "menuCode": "system:dept:list"},
  52. },
  53. {
  54. "id": "104",
  55. "name": "User",
  56. "path": "user",
  57. "component": "/system/user/index",
  58. "meta": {"title": "用户管理", "keepAlive": True, "menuCode": "system:user:list"},
  59. },
  60. {
  61. "id": "10000000000000000000000000000008",
  62. "name": "UserDetail",
  63. "path": "user/detail",
  64. "component": "/system/user/detail",
  65. "meta": {"title": "用户详情", "isHide": True, "keepAlive": True},
  66. },
  67. {
  68. "id": "105",
  69. "name": "Role",
  70. "path": "role",
  71. "component": "/system/role/index",
  72. "meta": {"title": "角色管理", "keepAlive": True, "menuCode": "system:role:list"},
  73. },
  74. {
  75. "id": "106",
  76. "name": "Menu",
  77. "path": "menu",
  78. "component": "/system/menu/index",
  79. "meta": {"title": "菜单管理", "keepAlive": True, "menuCode": "system:menu:list"},
  80. },
  81. {
  82. "id": "107",
  83. "name": "Site",
  84. "path": "site",
  85. "component": "/system/site/index",
  86. "meta": {"title": "站点管理", "keepAlive": True, "menuCode": "system:site:list"},
  87. },
  88. {
  89. "id": "108",
  90. "name": "Post",
  91. "path": "post",
  92. "component": "/system/post/index",
  93. "meta": {"title": "职位管理", "keepAlive": True, "menuCode": "system:post:list"},
  94. },
  95. {
  96. "id": "109",
  97. "name": "Unit",
  98. "path": "unit",
  99. "component": "/system/unit/index",
  100. "meta": {"title": "物品单位", "keepAlive": True, "menuCode": "system:unit:list"},
  101. },
  102. {
  103. "id": "110",
  104. "name": "Express",
  105. "path": "express",
  106. "component": "/system/express/index",
  107. "meta": {"title": "快递公司", "keepAlive": True, "menuCode": "system:express:list"},
  108. },
  109. ],
  110. },
  111. {
  112. "id": "40000000000000000000000000000001",
  113. "name": "BasicInfo",
  114. "path": "/basic-info",
  115. "component": "/index/index",
  116. "meta": {
  117. "title": "基础信息管理",
  118. "icon": "ri:folder-user-line",
  119. "keepAlive": False,
  120. "roles": ["admin"],
  121. },
  122. "children": [
  123. {
  124. "id": "40000000000000000000000000000002",
  125. "name": "BizCustomer",
  126. "path": "customer",
  127. "component": "/basic-info/customer/index",
  128. "meta": {"title": "客户管理", "keepAlive": True},
  129. },
  130. {
  131. "id": "40000000000000000000000000000003",
  132. "name": "BizCellSampleType",
  133. "path": "cell-sample-type",
  134. "component": "/basic-info/cell-sample-type/index",
  135. "meta": {"title": "细胞样本类型管理", "keepAlive": True},
  136. },
  137. {
  138. "id": "40000000000000000000000000000004",
  139. "name": "BizCollectionRegion",
  140. "path": "collection-region",
  141. "component": "/basic-info/collection-region/index",
  142. "meta": {"title": "采集地区及医院管理", "keepAlive": True},
  143. },
  144. {
  145. "id": "40000000000000000000000000000005",
  146. "name": "BizCollectionProtocolNo",
  147. "path": "collection-protocol-no",
  148. "component": "/basic-info/collection-protocol-no/index",
  149. "meta": {"title": "采集协议号管理", "keepAlive": True},
  150. },
  151. {
  152. "id": "40000000000000000000000000000006",
  153. "name": "BizSampleCode",
  154. "path": "sample-code",
  155. "component": "/basic-info/sample-code/index",
  156. "meta": {"title": "样本编码管理", "keepAlive": True},
  157. },
  158. ],
  159. },
  160. {
  161. "id": "50000000000000000000000000000001",
  162. "name": "CellStorage",
  163. "path": "/cell-storage",
  164. "component": "/index/index",
  165. "meta": {
  166. "title": "细胞存储管理",
  167. "icon": "ri:test-tube-line",
  168. "keepAlive": False,
  169. "roles": ["admin"],
  170. },
  171. "children": [
  172. {
  173. "id": "50000000000000000000000000000002",
  174. "name": "CellStorageProtocol",
  175. "path": "protocol",
  176. "component": "/cell-storage/protocol/index",
  177. "meta": {"title": "采集协议单录入", "keepAlive": True},
  178. },
  179. {
  180. "id": "50000000000000000000000000000003",
  181. "name": "CellStorageProtocolAudit",
  182. "path": "protocol-audit",
  183. "component": "/cell-storage/protocol-audit/index",
  184. "meta": {"title": "采集协议单管理", "keepAlive": True},
  185. },
  186. {
  187. "id": "50000000000000000000000000000007",
  188. "name": "CellStoragePaymentInfo",
  189. "path": "payment-info",
  190. "component": "/cell-storage/payment-info/index",
  191. "meta": {"title": "缴费信息", "keepAlive": True},
  192. },
  193. {
  194. "id": "50000000000000000000000000000004",
  195. "name": "CellStoragePaymentConfirm",
  196. "path": "payment-confirm",
  197. "component": "/cell-storage/payment-confirm/index",
  198. "meta": {"title": "缴费确认(财务)", "keepAlive": True},
  199. },
  200. {
  201. "id": "50000000000000000000000000000005",
  202. "name": "CellStorageRefundConfirm",
  203. "path": "refund-confirm",
  204. "component": "/cell-storage/refund-confirm/index",
  205. "meta": {"title": "退费确认(财务)", "keepAlive": True},
  206. },
  207. ],
  208. },
  209. {
  210. "id": "70000000000000000000000000000001",
  211. "name": "QualityInspection",
  212. "path": "/quality-inspection",
  213. "component": "/index/index",
  214. "meta": {
  215. "title": "质量检测",
  216. "icon": "ri:shield-check-line",
  217. "keepAlive": False,
  218. "roles": ["admin"],
  219. },
  220. "children": [
  221. {
  222. "id": "70000000000000000000000000000002",
  223. "name": "QualityInspectionSampleReception",
  224. "path": "sample-reception",
  225. "component": "/quality-inspection/sample-reception/index",
  226. "meta": {"title": "样本接收", "keepAlive": True},
  227. },
  228. {
  229. "id": "70000000000000000000000000000003",
  230. "name": "QualityInspectionSampleReceptionCheckItem",
  231. "path": "sample-reception-check-item",
  232. "component": "/quality-inspection/sample-reception-check-item/index",
  233. "meta": {"title": "接收检查项配置", "keepAlive": True},
  234. },
  235. {
  236. "id": "70000000000000000000000000000004",
  237. "name": "QualityInspectionThirdPartyCompany",
  238. "path": "third-party-company",
  239. "component": "/quality-inspection/third-party-company/index",
  240. "meta": {"title": "第三方检测公司及项目", "keepAlive": True, "menuCode": "biz:qcThirdPartyCompany:list"},
  241. },
  242. {
  243. "id": "70000000000000000000000000000006",
  244. "name": "QualityInspectionLabTestItem",
  245. "path": "lab-test-item",
  246. "component": "/quality-inspection/lab-test-item/index",
  247. "meta": {"title": "实验室自检项目", "keepAlive": True, "menuCode": "biz:qcLabTestItem:list"},
  248. },
  249. {
  250. "id": "70000000000000000000000000000007",
  251. "name": "QualityInspectionQcWorkOrder",
  252. "path": "qc-work-order",
  253. "component": "/quality-inspection/qc-work-order/index",
  254. "meta": {"title": "入库质检工单", "keepAlive": True, "menuCode": "biz:qcWorkOrder:list"},
  255. },
  256. {
  257. "id": "70000000000000000000000000000008",
  258. "name": "QualityInspectionQcTask",
  259. "path": "qc-task",
  260. "component": "/quality-inspection/qc-task/index",
  261. "meta": {"title": "质检任务", "keepAlive": True, "menuCode": "biz:qcTask:list"},
  262. },
  263. ],
  264. },
  265. ]
  266. @router.get("/list")
  267. async def get_menu_list(_user: dict = Depends(require_admin_or_super_admin)):
  268. """获取菜单列表(与当前前端路由一致)"""
  269. return success_response({"menuList": STATIC_MENU_TREE})