route.ts 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450
  1. import {RouteRecordRaw} from 'vue-router';
  2. /**
  3. * 建议:路由 path 路径与文件夹名称相同,找文件可浏览器地址找,方便定位文件位置
  4. *
  5. * 路由meta对象参数说明
  6. * meta: {
  7. * title: 菜单栏及 tagsView 栏、菜单搜索名称(国际化)
  8. * isLink: 是否超链接菜单,开启外链条件,`1、isLink: 链接地址不为空 2、isIframe:false`
  9. * isHide: 是否隐藏此路由
  10. * isKeepAlive: 是否缓存组件状态
  11. * isAffix: 是否固定在 tagsView 栏上
  12. * isIframe: 是否内嵌窗口,开启条件,`1、isIframe:true 2、isLink:链接地址不为空`
  13. * roles: 当前路由权限标识,取角色管理。控制路由显示、隐藏。超级管理员:admin 普通角色:common
  14. * icon: 菜单、tagsView 图标,阿里:加 `iconfont xxx`,fontawesome:加 `fa xxx`
  15. * }
  16. */
  17. // 扩展 RouteMeta 接口
  18. declare module 'vue-router' {
  19. interface RouteMeta {
  20. title?: string;
  21. isLink?: string;
  22. isHide?: boolean;
  23. isKeepAlive?: boolean;
  24. isAffix?: boolean;
  25. isIframe?: boolean;
  26. roles?: string[];
  27. icon?: string;
  28. }
  29. }
  30. /**
  31. * 定义404、401界面
  32. * @link 参考:https://next.router.vuejs.org/zh/guide/essentials/history-mode.html#netlify
  33. */
  34. export const notFoundAndNoPower = [
  35. {
  36. path: '/:path(.*)*',
  37. name: 'notFound',
  38. component: () => import('/@/views/error/404.vue'),
  39. meta: {
  40. title: 'message.staticRoutes.notFound',
  41. isHide: true,
  42. },
  43. },
  44. {
  45. path: '/401',
  46. name: 'noPower',
  47. component: () => import('/@/views/error/401.vue'),
  48. meta: {
  49. title: 'message.staticRoutes.noPower',
  50. isHide: true,
  51. },
  52. },
  53. ];
  54. /**
  55. * 前端路由
  56. * 此路由不要动,前端添加路由的话,请在 `dynamicRoutes 数组` 中添加
  57. * @description 前端控制直接改 dynamicRoutes 中的路由,后端控制不需要修改,请求接口路由数据时,会覆盖 dynamicRoutes 第一个顶级 children 的内容(全屏,不包含 layout 中的路由出口)
  58. * @returns 返回路由菜单数据
  59. */
  60. export const staticRoutes: Array<RouteRecordRaw> = [
  61. {
  62. path: '/login',
  63. name: 'login',
  64. component: () => import('/@/views/login/index.vue'),
  65. meta: {
  66. title: '登录',
  67. },
  68. },
  69. ];
  70. /**
  71. * 管理后台的路由 },
  72. */
  73. export const adminRoutes: Array<RouteRecordRaw> = [
  74. {
  75. path: '/',
  76. name: 'admin',
  77. component: () => import('/@/layout/index.vue'),
  78. redirect: '/home',
  79. meta: {
  80. isKeepAlive: true,
  81. title: '管理后台'
  82. },
  83. children: [
  84. {
  85. path: '/home',
  86. name: 'adminHome1',
  87. component: () => import('/@/views/admin/index.vue'),
  88. meta: {
  89. title: '信息总览',
  90. isLink: '',
  91. isHide: false,
  92. isKeepAlive: true,
  93. isAffix: false,
  94. isIframe: false,
  95. icon: 'ele-Monitor',
  96. color: 'yellow'
  97. // perm:'admin'
  98. }
  99. },
  100. {
  101. path: '/kanban',
  102. name: 'adminKanban',
  103. component: () => import('/@/views/admin/kanban/index.vue'),
  104. meta: {
  105. title: '数据看板',
  106. isLink: '',
  107. isHide: false,
  108. isKeepAlive: true,
  109. isAffix: false,
  110. isIframe: false,
  111. icon: 'ele-PictureRounded',
  112. perm:"kanban.list",
  113. }
  114. },
  115. {
  116. path: '/station',
  117. name: 'adminStation',
  118. component: () => import('/@/layout/routerView/parent.vue'),
  119. redirect: '/admin/station/list',
  120. meta: {
  121. title: '电站电桩',
  122. isLink: '',
  123. isHide: false,
  124. isKeepAlive: true,
  125. isAffix: false,
  126. isIframe: false,
  127. icon: 'ele-MapLocation',
  128. perm:"equipment.list,station.list,stationStatMonth.list,statement.list",
  129. },
  130. children: [
  131. {
  132. path: '/station/list',
  133. name: 'adminStationList',
  134. component: () => import('/@/views/admin/station/list/index.vue'),
  135. meta: {
  136. title: '电站监控',
  137. isLink: '',
  138. isHide: false,
  139. isKeepAlive: true,
  140. isAffix: false,
  141. isIframe: false,
  142. perm:"station.list",
  143. icon: 'ele-OfficeBuilding',
  144. },
  145. },
  146. {
  147. path: '/station/endpoint/:id',
  148. name: 'adminStationEndpoint',
  149. component: () => import('/@/views/admin/station/endpoint/index.vue'),
  150. meta: {
  151. title: '电桩监控',
  152. isLink: '',
  153. isHide: false,
  154. isKeepAlive: true,
  155. isAffix: false,
  156. isIframe: false,
  157. perm:"equipment.list",
  158. icon: 'ele-User',
  159. },
  160. },
  161. {
  162. path: '/station/statMonth',
  163. name: 'adminStationStatMonth',
  164. component: () => import('/@/views/admin/station/stat/index.vue'),
  165. meta: {
  166. title: '站点月表',
  167. isLink: '',
  168. isHide: false,
  169. isKeepAlive: true,
  170. isAffix: false,
  171. isIframe: false,
  172. perm:"stationStatMonth.list",
  173. icon: 'ele-Histogram',
  174. },
  175. },
  176. {
  177. path: '/station/statement',
  178. name: 'adminStatement',
  179. component: () => import('/@/views/admin/station/statment/index.vue'),
  180. meta: {
  181. title: '对账单',
  182. isLink: '',
  183. isHide: false,
  184. isKeepAlive: true,
  185. isAffix: false,
  186. isIframe: false,
  187. perm:"statement.list",
  188. icon: 'ele-CreditCard',
  189. },
  190. },
  191. ]
  192. },
  193. {
  194. path: '/investor',
  195. name: 'adminInvestor',
  196. component: () => import('/@/views/admin/investor/index.vue'),
  197. meta: {
  198. title: '投资者/物业',
  199. isLink: '',
  200. isHide: false,
  201. isKeepAlive: true,
  202. isAffix: false,
  203. isIframe: false,
  204. icon: 'ele-Avatar',
  205. perm:"investor.list",
  206. }
  207. },
  208. {
  209. path: '/banner',
  210. name: 'adminBanner',
  211. component: () => import('/@/views/admin/banner/index.vue'),
  212. meta: {
  213. title: '横幅广告',
  214. isLink: '',
  215. isHide: false,
  216. isKeepAlive: true,
  217. isAffix: false,
  218. isIframe: false,
  219. icon: 'ele-PictureRounded',
  220. perm:"banner.list",
  221. }
  222. },
  223. {
  224. path: '/activity',
  225. name: 'activity',
  226. component: () => import('/@/layout/routerView/parent.vue'),
  227. redirect: '/activity/list',
  228. meta: {
  229. title: '营销活动',
  230. isLink: '',
  231. isHide: false,
  232. isKeepAlive: true,
  233. isAffix: false,
  234. isIframe: false,
  235. icon: 'ele-Tools',
  236. perm: "activity.list,coupon.list",
  237. },
  238. children: [
  239. {
  240. path: '/activity/list',
  241. name: 'adminActivity',
  242. component: () => import('/@/views/admin/activity/index.vue'),
  243. meta: {
  244. title: '活动列表',
  245. isLink: '',
  246. isHide: false,
  247. isKeepAlive: true,
  248. isAffix: false,
  249. isIframe: false,
  250. icon: 'ele-PieChart',
  251. perm:"activity.list",
  252. }
  253. },
  254. {
  255. path: '/activity/coupon',
  256. name: 'adminCoupon',
  257. component: () => import('/@/views/admin/activity/coupon/index.vue'),
  258. meta: {
  259. title: '优惠券列表',
  260. isLink: '',
  261. isHide: false,
  262. isKeepAlive: true,
  263. isAffix: false,
  264. isIframe: false,
  265. icon: 'ele-PieChart',
  266. // perm:"coupon.list",
  267. }
  268. },
  269. {
  270. path: '/activity/userCoupon',
  271. name: 'adminUserCoupon',
  272. component: () => import('/@/views/admin/activity/userCoupon/index.vue'),
  273. meta: {
  274. title: '用户优惠券',
  275. isLink: '',
  276. isHide: false,
  277. isKeepAlive: true,
  278. isAffix: false,
  279. isIframe: false,
  280. icon: 'ele-PieChart',
  281. // perm:"coupon.list",
  282. }
  283. },
  284. ]
  285. },
  286. {
  287. path: '/ordering',
  288. name: 'adminOrdering',
  289. component: () => import('/@/views/admin/ordering/index.vue'),
  290. meta: {
  291. title: '订单管理',
  292. isLink: '',
  293. isHide: false,
  294. isKeepAlive: true,
  295. isAffix: false,
  296. isIframe: false,
  297. icon: 'ele-Money',
  298. perm:"order.list",
  299. }
  300. },
  301. {
  302. path: '/account',
  303. name: 'adminAccount',
  304. component: () => import('/@/views/admin/account/index.vue'),
  305. meta: {
  306. title: '用户列表',
  307. isLink: '',
  308. isHide: false,
  309. isKeepAlive: true,
  310. isAffix: false,
  311. isIframe: false,
  312. icon: 'ele-User',
  313. perm:"account.list",
  314. }
  315. },
  316. {
  317. path: '/finance',
  318. name: 'adminFinance',
  319. component: () => import('/@/views/admin/finance/index.vue'),
  320. meta: {
  321. title: '充值记录',
  322. isLink: '',
  323. isHide: false,
  324. isKeepAlive: true,
  325. isAffix: false,
  326. isIframe: false,
  327. icon: 'ele-Wallet',
  328. perm:"recharge.list",
  329. },
  330. },
  331. {
  332. path: '/refund',
  333. name: 'adminRefund',
  334. component: () => import('/@/views/admin/refund/index.vue'),
  335. meta: {
  336. title: '退款记录',
  337. isLink: '',
  338. isHide: false,
  339. isKeepAlive: true,
  340. isAffix: false,
  341. isIframe: false,
  342. icon: 'ele-Cloudy',
  343. perm:"refund.list",
  344. },
  345. },
  346. {
  347. path: '/invoice',
  348. name: 'adminInvoice',
  349. component: () => import('/@/views/admin/invoice/index.vue'),
  350. meta: {
  351. title: '发票管理',
  352. isLink: '',
  353. isHide: false,
  354. isKeepAlive: true,
  355. isAffix: false,
  356. isIframe: false,
  357. icon: 'ele-Tickets',
  358. perm:"invoice.list",
  359. },
  360. },
  361. {
  362. path: '/org',
  363. name: 'adminOrg',
  364. component: () => import('/@/layout/routerView/parent.vue'),
  365. redirect: '/admin/org/department',
  366. meta: {
  367. title: '系统配置',
  368. isLink: '',
  369. isHide: false,
  370. isKeepAlive: true,
  371. isAffix: false,
  372. isIframe: false,
  373. icon: 'ele-Tools',
  374. perm:"user.list,role.list,dict.list",
  375. },
  376. children: [
  377. {
  378. path: '/org/user',
  379. name: 'orgUser',
  380. component: () => import('/@/views/admin/user/index.vue'),
  381. meta: {
  382. title: '运维用户',
  383. isLink: '',
  384. isHide: false,
  385. isKeepAlive: true,
  386. isAffix: false,
  387. isIframe: false,
  388. perm:"user.list",
  389. icon: 'ele-User',
  390. },
  391. },
  392. {
  393. path: '/org/role',
  394. name: 'orgRole',
  395. component: () => import('/@/views/admin/role/index.vue'),
  396. meta: {
  397. title: '角色权限',
  398. isLink: '',
  399. isHide: false,
  400. isKeepAlive: true,
  401. isAffix: false,
  402. isIframe: false,
  403. perm:"role.list",
  404. icon: 'ele-Compass',
  405. },
  406. },
  407. {
  408. path: '/org/dict',
  409. name: 'orgDict',
  410. component: () => import('/@/views/admin/dict/index.vue'),
  411. meta: {
  412. title: '数据字典',
  413. isLink: '',
  414. isHide: false,
  415. isKeepAlive: true,
  416. isAffix: false,
  417. isIframe: false,
  418. perm:"dict.list",
  419. icon: 'ele-Collection',
  420. },
  421. },
  422. ]
  423. },
  424. /* {
  425. path: '/optList',
  426. name: 'adminOptList',
  427. component: () => import('/@/views/admin/log/opt/index.vue'),
  428. meta: {
  429. title: '操作日志',
  430. isLink: '',
  431. isHide: false,
  432. isKeepAlive: true,
  433. isAffix: false,
  434. isIframe: false,
  435. icon: 'ele-Cpu',
  436. }
  437. },*/
  438. ],
  439. },
  440. ]