route.ts 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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: '/station',
  102. name: 'adminStation',
  103. component: () => import('/@/layout/routerView/parent.vue'),
  104. redirect: '/admin/station/list',
  105. meta: {
  106. title: '电站电桩',
  107. isLink: '',
  108. isHide: false,
  109. isKeepAlive: true,
  110. isAffix: false,
  111. isIframe: false,
  112. icon: 'ele-MapLocation',
  113. perm:"equipment.list,station.list",
  114. },
  115. children: [
  116. {
  117. path: '/station/list',
  118. name: 'adminStationList',
  119. component: () => import('/@/views/admin/station/list/index.vue'),
  120. meta: {
  121. title: '电站监控',
  122. isLink: '',
  123. isHide: false,
  124. isKeepAlive: true,
  125. isAffix: false,
  126. isIframe: false,
  127. perm:"station.list",
  128. icon: 'ele-OfficeBuilding',
  129. },
  130. },
  131. {
  132. path: '/station/endpoint/:id',
  133. name: 'adminStationEndpoint',
  134. component: () => import('/@/views/admin/station/endpoint/index.vue'),
  135. meta: {
  136. title: '电桩监控',
  137. isLink: '',
  138. isHide: false,
  139. isKeepAlive: true,
  140. isAffix: false,
  141. isIframe: false,
  142. perm:"equipment.list",
  143. icon: 'ele-User',
  144. },
  145. },
  146. /* {
  147. path: '/station/stat',
  148. name: 'adminStationStat',
  149. component: () => import('/@/views/admin/station/stat/index.vue'),
  150. meta: {
  151. title: '营收概览',
  152. isLink: '',
  153. isHide: false,
  154. isKeepAlive: true,
  155. isAffix: false,
  156. isIframe: false,
  157. icon: 'ele-Compass',
  158. },
  159. },*/
  160. ]
  161. },
  162. {
  163. path: '/banner',
  164. name: 'adminBanner',
  165. component: () => import('/@/views/admin/banner/index.vue'),
  166. meta: {
  167. title: '横幅广告',
  168. isLink: '',
  169. isHide: false,
  170. isKeepAlive: true,
  171. isAffix: false,
  172. isIframe: false,
  173. icon: 'ele-PictureRounded',
  174. perm:"banner.list",
  175. }
  176. },
  177. {
  178. path: '/activity',
  179. name: 'adminActivity',
  180. component: () => import('/@/views/admin/activity/index.vue'),
  181. meta: {
  182. title: '营销活动',
  183. isLink: '',
  184. isHide: false,
  185. isKeepAlive: true,
  186. isAffix: false,
  187. isIframe: false,
  188. icon: 'ele-PieChart',
  189. perm:"activity.list",
  190. }
  191. },
  192. {
  193. path: '/ordering',
  194. name: 'adminOrdering',
  195. component: () => import('/@/views/admin/ordering/index.vue'),
  196. meta: {
  197. title: '订单管理',
  198. isLink: '',
  199. isHide: false,
  200. isKeepAlive: true,
  201. isAffix: false,
  202. isIframe: false,
  203. icon: 'ele-Money',
  204. perm:"order.list",
  205. }
  206. },
  207. {
  208. path: '/account',
  209. name: 'adminAccount',
  210. component: () => import('/@/views/admin/account/index.vue'),
  211. meta: {
  212. title: '用户列表',
  213. isLink: '',
  214. isHide: false,
  215. isKeepAlive: true,
  216. isAffix: false,
  217. isIframe: false,
  218. icon: 'ele-User',
  219. perm:"account.list",
  220. }
  221. },
  222. {
  223. path: '/finance',
  224. name: 'adminFinance',
  225. component: () => import('/@/views/admin/finance/index.vue'),
  226. meta: {
  227. title: '充值记录',
  228. isLink: '',
  229. isHide: false,
  230. isKeepAlive: true,
  231. isAffix: false,
  232. isIframe: false,
  233. icon: 'ele-Wallet',
  234. perm:"recharge.list",
  235. },
  236. },
  237. {
  238. path: '/refund',
  239. name: 'adminRefund',
  240. component: () => import('/@/views/admin/refund/index.vue'),
  241. meta: {
  242. title: '退款记录',
  243. isLink: '',
  244. isHide: false,
  245. isKeepAlive: true,
  246. isAffix: false,
  247. isIframe: false,
  248. icon: 'ele-Cloudy',
  249. perm:"refund.list",
  250. },
  251. },
  252. {
  253. path: '/invoice',
  254. name: 'adminInvoice',
  255. component: () => import('/@/views/admin/invoice/index.vue'),
  256. meta: {
  257. title: '发票管理',
  258. isLink: '',
  259. isHide: false,
  260. isKeepAlive: true,
  261. isAffix: false,
  262. isIframe: false,
  263. icon: 'ele-Tickets',
  264. perm:"invoice.list",
  265. },
  266. },
  267. {
  268. path: '/org',
  269. name: 'adminOrg',
  270. component: () => import('/@/layout/routerView/parent.vue'),
  271. redirect: '/admin/org/department',
  272. meta: {
  273. title: '系统配置',
  274. isLink: '',
  275. isHide: false,
  276. isKeepAlive: true,
  277. isAffix: false,
  278. isIframe: false,
  279. icon: 'ele-Tools',
  280. perm:"user.list,role.list",
  281. },
  282. children: [
  283. {
  284. path: '/org/user',
  285. name: 'orgUser',
  286. component: () => import('/@/views/admin/user/index.vue'),
  287. meta: {
  288. title: '运维用户',
  289. isLink: '',
  290. isHide: false,
  291. isKeepAlive: true,
  292. isAffix: false,
  293. isIframe: false,
  294. perm:"user.list",
  295. icon: 'ele-User',
  296. },
  297. },
  298. {
  299. path: '/org/role',
  300. name: 'orgRole',
  301. component: () => import('/@/views/admin/role/index.vue'),
  302. meta: {
  303. title: '角色权限',
  304. isLink: '',
  305. isHide: false,
  306. isKeepAlive: true,
  307. isAffix: false,
  308. isIframe: false,
  309. perm:"role.list",
  310. icon: 'ele-Compass',
  311. },
  312. },
  313. ]
  314. },
  315. /* {
  316. path: '/optList',
  317. name: 'adminOptList',
  318. component: () => import('/@/views/admin/log/opt/index.vue'),
  319. meta: {
  320. title: '操作日志',
  321. isLink: '',
  322. isHide: false,
  323. isKeepAlive: true,
  324. isAffix: false,
  325. isIframe: false,
  326. icon: 'ele-Cpu',
  327. }
  328. },*/
  329. ],
  330. },
  331. ]