menu.py 11 KB

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