asyncRoutes.ts 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  1. import {RoutesAlias} from '../routesAlias'
  2. import {AppRouteRecord} from '@/types/router'
  3. import {WEB_LINKS} from '@/utils/constants'
  4. /**
  5. * 菜单列表、异步路由
  6. *
  7. * 支持两种模式:
  8. * 前端静态配置 - 直接使用本文件中定义的路由配置
  9. * 后端动态配置 - 后端返回菜单数据,前端解析生成路由
  10. *
  11. * 菜单标题(title):
  12. * 可以是 i18n 的 key,也可以是字符串,比如:'用户列表'
  13. *
  14. * 注意事项:
  15. * 1、RoutesAlias.Layout 指向的是布局容器,后端返回的菜单数据中,component 字段需要指向 /index/index
  16. * 2、path、name 不要和动态路由冲突,否则会导致路由冲突无法访问
  17. * 3、id没有设置或为0表示不需要权限,id 和 LewaimaiAdminPingtaiAuth.php 保持一致
  18. */
  19. export const asyncRoutes: AppRouteRecord[] = [
  20. // 主页一级菜单配置示例:
  21. {
  22. name: 'Home',
  23. path: '/dashboard/console',
  24. component: RoutesAlias.Dashboard,
  25. meta: {
  26. title: 'menus.dashboard.console',
  27. icon: '',
  28. keepAlive: false,
  29. fixedTab: true,
  30. }
  31. },
  32. {
  33. id: 12,
  34. path: '/school',
  35. name: 'SchoolManage',
  36. component: RoutesAlias.Layout,
  37. meta: {
  38. title: 'menus.school.list',
  39. icon: ''
  40. },
  41. children: [
  42. {
  43. id: 1201,
  44. path: 'list',
  45. name: 'school',
  46. component: RoutesAlias.SchoolList,
  47. meta: {
  48. title: 'menus.school.list',
  49. keepAlive: false,
  50. authList: [
  51. {
  52. id: 120100,
  53. title: '列表',
  54. },
  55. {
  56. id: 120101,
  57. title: '新增',
  58. },
  59. {
  60. id: 120102,
  61. title: '编辑',
  62. }
  63. ]
  64. }
  65. },
  66. {
  67. path: 'edit',
  68. name: 'SchoolEdit',
  69. component: RoutesAlias.SchoolEdit,
  70. meta: {
  71. title: 'menus.school.edit',
  72. isHide: true,
  73. keepAlive: false,
  74. activePath: '/school/list' // 激活菜单路径
  75. }
  76. },
  77. {
  78. path: 'info',
  79. name: 'SchoolInfo',
  80. component: RoutesAlias.SchoolInfo,
  81. meta: {
  82. title: 'menus.school.info',
  83. isHide: true,
  84. keepAlive: false,
  85. activePath: '/school/list' // 激活菜单路径
  86. }
  87. },
  88. {
  89. id: 1202,
  90. path: 'relation',
  91. name: 'schoolRelation',
  92. component: RoutesAlias.SchoolRelation,
  93. meta: {
  94. title: 'menus.school.relation',
  95. keepAlive: false,
  96. authList: [
  97. {
  98. id: 120200,
  99. title: '列表',
  100. },
  101. {
  102. id: 120201,
  103. title: '新增',
  104. },
  105. {
  106. id: 120202,
  107. title: '编辑',
  108. },
  109. {
  110. id: 120203,
  111. title: '删除',
  112. },
  113. ]
  114. }
  115. },
  116. {
  117. id: 1203,
  118. path: 'follow',
  119. name: 'schoolFollow',
  120. component: RoutesAlias.SchoolFollow,
  121. meta: {
  122. title: 'menus.school.follow',
  123. // keepAlive: true,
  124. authList: [
  125. {
  126. id: 120300,
  127. title: '列表',
  128. },
  129. {
  130. id: 120301,
  131. title: '编辑',
  132. }
  133. ]
  134. }
  135. },
  136. {
  137. path: 'follow/info',
  138. name: 'SchoolFollowInfo',
  139. component: RoutesAlias.SchoolFollowInfo,
  140. meta: {
  141. title: 'menus.school.followInfo',
  142. isHide: true,
  143. keepAlive: false,
  144. activePath: '/school/follow' // 激活菜单路径
  145. }
  146. },
  147. ]
  148. },
  149. {
  150. id: 13,
  151. path: '/canteen',
  152. name: 'CanteenManage',
  153. component: RoutesAlias.Layout,
  154. meta: {
  155. title: 'menus.canteen.list',
  156. icon: ''
  157. },
  158. children: [
  159. {
  160. id: 1301,
  161. path: 'list',
  162. name: 'canteen',
  163. component: RoutesAlias.CanteenList,
  164. meta: {
  165. title: 'menus.canteen.list',
  166. keepAlive: false,
  167. authList: [
  168. {
  169. id: 130100,
  170. title: '列表',
  171. },
  172. {
  173. id: 130101,
  174. title: '新增',
  175. },
  176. {
  177. id: 130102,
  178. title: '编辑',
  179. }
  180. ]
  181. }
  182. },
  183. {
  184. path: 'edit',
  185. name: 'canteenEdit',
  186. component: RoutesAlias.CanteenEdit,
  187. meta: {
  188. title: 'menus.canteen.edit',
  189. isHide: true,
  190. keepAlive: false,
  191. activePath: '/canteen/list' // 激活菜单路径
  192. }
  193. },
  194. {
  195. path: 'info',
  196. name: 'canteenInfo',
  197. component: RoutesAlias.CanteenInfo,
  198. meta: {
  199. title: 'menus.canteen.info',
  200. isHide: true,
  201. keepAlive: false,
  202. activePath: '/canteen/list' // 激活菜单路径
  203. },
  204. },
  205. {
  206. id: 1303,
  207. path: 'follow',
  208. name: 'canteenFollow',
  209. component: RoutesAlias.CanteenFollow,
  210. meta: {
  211. title: 'menus.canteen.follow',
  212. // keepAlive: true,
  213. authList: [
  214. {
  215. id: 130300,
  216. title: '列表',
  217. },
  218. {
  219. id: 130301,
  220. title: '编辑',
  221. }
  222. ]
  223. }
  224. },
  225. {
  226. path: 'follow/info',
  227. name: 'canteenFollowInfo',
  228. component: RoutesAlias.CanteenFollowInfo,
  229. meta: {
  230. title: 'menus.canteen.followInfo',
  231. isHide: true,
  232. keepAlive: false,
  233. activePath: '/canteen/follow' // 激活菜单路径
  234. }
  235. },
  236. ]
  237. },
  238. {
  239. id: 14,
  240. path: '/company',
  241. name: 'CompanyManage',
  242. component: RoutesAlias.Layout,
  243. meta: {
  244. title: 'menus.company.list',
  245. icon: ''
  246. },
  247. children: [
  248. {
  249. id: 1401,
  250. path: 'list',
  251. name: 'company',
  252. component: RoutesAlias.CompanyList,
  253. meta: {
  254. title: 'menus.company.list',
  255. keepAlive: false,
  256. authList: [
  257. {
  258. id: 140100,
  259. title: '列表',
  260. },
  261. {
  262. id: 140101,
  263. title: '新增',
  264. },
  265. {
  266. id: 140102,
  267. title: '编辑',
  268. },
  269. ]
  270. }
  271. },
  272. {
  273. path: 'edit',
  274. name: 'CompanyEdit',
  275. component: RoutesAlias.CompanyEdit,
  276. meta: {
  277. title: 'menus.company.edit',
  278. isHide: true,
  279. keepAlive: false,
  280. activePath: '/company/list' // 激活菜单路径
  281. }
  282. },
  283. {
  284. path: 'info',
  285. name: 'CompanyInfo',
  286. component: RoutesAlias.CompanyInfo,
  287. meta: {
  288. title: 'menus.company.info',
  289. isHide: true,
  290. keepAlive: false,
  291. activePath: '/company/list' // 激活菜单路径
  292. }
  293. },
  294. {
  295. id: 1402,
  296. path: 'relation',
  297. name: 'companyRelation',
  298. component: RoutesAlias.CompanyRelation,
  299. meta: {
  300. title: 'menus.company.relation',
  301. keepAlive: false,
  302. authList: [
  303. {
  304. id: 140200,
  305. title: '列表',
  306. },
  307. {
  308. id: 140201,
  309. title: '新增',
  310. },
  311. {
  312. id: 140202,
  313. title: '编辑',
  314. },
  315. {
  316. id: 140203,
  317. title: '删除',
  318. },
  319. ]
  320. }
  321. },
  322. {
  323. id: 1403,
  324. path: 'follow',
  325. name: 'companyFollow',
  326. component: RoutesAlias.CompanyFollow,
  327. meta: {
  328. title: 'menus.company.follow',
  329. // keepAlive: true,
  330. authList: [
  331. {
  332. id: 140300,
  333. title: '列表',
  334. },
  335. {
  336. id: 140301,
  337. title: '编辑',
  338. }
  339. ]
  340. }
  341. },
  342. {
  343. path: 'follow/info',
  344. name: 'CompanyFollowInfo',
  345. component: RoutesAlias.CompanyFollowInfo,
  346. meta: {
  347. title: 'menus.company.followInfo',
  348. isHide: true,
  349. keepAlive: false,
  350. activePath: '/company/follow' // 激活菜单路径
  351. }
  352. },
  353. ]
  354. },
  355. {
  356. id: 11,
  357. path: '/system',
  358. name: 'System',
  359. component: RoutesAlias.Layout,
  360. meta: {
  361. title: 'menus.system.title',
  362. icon: ''
  363. },
  364. children: [
  365. {
  366. id: 1101,
  367. path: 'user',
  368. name: 'User',
  369. component: RoutesAlias.User,
  370. meta: {
  371. title: 'menus.system.user',
  372. keepAlive: false,
  373. authList: [
  374. {
  375. id: 110100,
  376. title: '列表',
  377. },
  378. {
  379. id: 110101,
  380. title: '编辑',
  381. },
  382. {
  383. id: 110102,
  384. title: '删除',
  385. }
  386. ]
  387. }
  388. },
  389. {
  390. id: 1102,
  391. path: 'role',
  392. name: 'Role',
  393. component: RoutesAlias.Role,
  394. meta: {
  395. title: 'menus.system.role',
  396. keepAlive: false,
  397. authList: [
  398. {
  399. id: 110200,
  400. title: '列表',
  401. },
  402. {
  403. id: 110201,
  404. title: '分配权限',
  405. },
  406. {
  407. id: 110202,
  408. title: '编辑',
  409. },
  410. {
  411. id: 110203,
  412. title: '删除',
  413. }
  414. ]
  415. }
  416. }
  417. ]
  418. },
  419. {
  420. path: '/system/user-center',
  421. name: 'UserCenter',
  422. component: RoutesAlias.UserCenter,
  423. meta: {
  424. title: 'menus.system.userCenter',
  425. isHide: true,
  426. keepAlive: false,
  427. activePath: '/system/user' // 激活菜单路径
  428. }
  429. },
  430. ]