route.ts 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  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: '/marketing',
  164. name: 'adminMarketing',
  165. component: () => import('/@/views/admin/marketing/index.vue'),
  166. meta: {
  167. title: '营销活动',
  168. isLink: '',
  169. isHide: false,
  170. isKeepAlive: true,
  171. isAffix: false,
  172. isIframe: false,
  173. icon: 'ele-PieChart',
  174. }
  175. },*/
  176. {
  177. path: '/ordering',
  178. name: 'adminOrdering',
  179. component: () => import('/@/views/admin/ordering/index.vue'),
  180. meta: {
  181. title: '订单管理',
  182. isLink: '',
  183. isHide: false,
  184. isKeepAlive: true,
  185. isAffix: false,
  186. isIframe: false,
  187. icon: 'ele-Money',
  188. perm:"order.list",
  189. }
  190. },
  191. {
  192. path: '/account',
  193. name: 'adminAccount',
  194. component: () => import('/@/views/admin/account/index.vue'),
  195. meta: {
  196. title: '用户列表',
  197. isLink: '',
  198. isHide: false,
  199. isKeepAlive: true,
  200. isAffix: false,
  201. isIframe: false,
  202. icon: 'ele-User',
  203. perm:"account.list",
  204. }
  205. },
  206. {
  207. path: '/finance',
  208. name: 'adminFinance',
  209. component: () => import('/@/views/admin/finance/index.vue'),
  210. meta: {
  211. title: '充值记录',
  212. isLink: '',
  213. isHide: false,
  214. isKeepAlive: true,
  215. isAffix: false,
  216. isIframe: false,
  217. icon: 'ele-Wallet',
  218. perm:"recharge.list",
  219. },
  220. },
  221. {
  222. path: '/refund',
  223. name: 'adminRefund',
  224. component: () => import('/@/views/admin/refund/index.vue'),
  225. meta: {
  226. title: '退款记录',
  227. isLink: '',
  228. isHide: false,
  229. isKeepAlive: true,
  230. isAffix: false,
  231. isIframe: false,
  232. icon: 'ele-Cloudy',
  233. perm:"refund.list",
  234. },
  235. },
  236. {
  237. path: '/org',
  238. name: 'adminOrg',
  239. component: () => import('/@/layout/routerView/parent.vue'),
  240. redirect: '/admin/org/department',
  241. meta: {
  242. title: '系统配置',
  243. isLink: '',
  244. isHide: false,
  245. isKeepAlive: true,
  246. isAffix: false,
  247. isIframe: false,
  248. icon: 'ele-Tools',
  249. perm:"user.list,role.list",
  250. },
  251. children: [
  252. {
  253. path: '/org/user',
  254. name: 'orgUser',
  255. component: () => import('/@/views/admin/user/index.vue'),
  256. meta: {
  257. title: '运维用户',
  258. isLink: '',
  259. isHide: false,
  260. isKeepAlive: true,
  261. isAffix: false,
  262. isIframe: false,
  263. perm:"user.list",
  264. icon: 'ele-User',
  265. },
  266. },
  267. {
  268. path: '/org/role',
  269. name: 'orgRole',
  270. component: () => import('/@/views/admin/role/index.vue'),
  271. meta: {
  272. title: '角色权限',
  273. isLink: '',
  274. isHide: false,
  275. isKeepAlive: true,
  276. isAffix: false,
  277. isIframe: false,
  278. perm:"role.list",
  279. icon: 'ele-Compass',
  280. },
  281. },
  282. ]
  283. },
  284. /* {
  285. path: '/optList',
  286. name: 'adminOptList',
  287. component: () => import('/@/views/admin/log/opt/index.vue'),
  288. meta: {
  289. title: '操作日志',
  290. isLink: '',
  291. isHide: false,
  292. isKeepAlive: true,
  293. isAffix: false,
  294. isIframe: false,
  295. icon: 'ele-Cpu',
  296. }
  297. },*/
  298. ],
  299. },
  300. ]