routes.ts 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. /**
  2. * @name umi 的路由配置
  3. * @description 只支持 path,component,routes,redirect,wrappers,title 的配置
  4. * @param path path 只支持两种占位符配置,第一种是动态参数 :id 的形式,第二种是 * 通配符,通配符只能出现路由字符串的最后。
  5. * @param component 配置 location 和 path 匹配后用于渲染的 React 组件路径。可以是绝对路径,也可以是相对路径,如果是相对路径,会从 src/pages 开始找起。
  6. * @param routes 配置子路由,通常在需要为多个路径增加 layout 组件时使用。
  7. * @param redirect 配置路由跳转
  8. * @param wrappers 配置路由组件的包装组件,通过包装组件可以为当前的路由组件组合进更多的功能。 比如,可以用于路由级别的权限校验
  9. * @doc https://umijs.org/docs/guides/routes
  10. */
  11. export default [
  12. {
  13. path: '/passport',
  14. routes: [
  15. {
  16. name: '登录',
  17. path: '/passport/login',
  18. component: './passport/Login',
  19. },
  20. {
  21. path: '/passport',
  22. redirect: '/passport/login',
  23. },
  24. ],
  25. },
  26. {
  27. path: '/',
  28. name: '主界面',
  29. component: '../layouts/BaseLayout',
  30. routes: [
  31. {
  32. path: '/dashboard',
  33. name: '仪表板',
  34. component: './dashboard',
  35. access: 'canDashboard',
  36. },
  37. {
  38. path: '/customer',
  39. name: '客户查询',
  40. access: 'canCustomer',
  41. routes: [
  42. {
  43. path: '/customer/order',
  44. name: '订单查询',
  45. component: './customer/Order',
  46. },
  47. {
  48. path: '/customer/bill',
  49. name: '账单查询',
  50. component: './customer/Bill',
  51. },
  52. {
  53. path: '/customer/vehicle',
  54. name: '车辆查询',
  55. component: './customer/Vehicle',
  56. },
  57. {
  58. path: '/customer/battery',
  59. name: '电池查询',
  60. component: './customer/Battery',
  61. },
  62. {
  63. path: '/customer/driver',
  64. name: '司机查询',
  65. component: './customer/Driver',
  66. },
  67. {
  68. path: '/customer',
  69. redirect: '/customer/order',
  70. },
  71. ],
  72. },
  73. {
  74. path: '/station',
  75. name: '电站监控',
  76. access: 'canStation',
  77. routes: [
  78. {
  79. path: '/station/order',
  80. name: '订单查询',
  81. component: './station/Order',
  82. },
  83. {
  84. path: '/station/alarm',
  85. name: '设备告警',
  86. component: './station/Alarm',
  87. },
  88. {
  89. path: '/station/power',
  90. name: '机组充电',
  91. component: './station/Power',
  92. },
  93. {
  94. path: '/station/measure',
  95. name: '设备度量',
  96. component: './station/Measure',
  97. },
  98. {
  99. path: '/station/battery',
  100. name: '电站电池',
  101. component: './station/Battery',
  102. },
  103. {
  104. path: '/station/device',
  105. name: '电站设备',
  106. component: './station/Device',
  107. },
  108. {
  109. path: '/station',
  110. redirect: '/station/order',
  111. },
  112. ],
  113. },
  114. {
  115. path: '/operator',
  116. name: '运营管理',
  117. access: 'canOperator',
  118. routes: [
  119. {
  120. path: '/operator/order',
  121. name: '订单管理',
  122. component: './operator/Order',
  123. },
  124. {
  125. path: '/operator/bill',
  126. name: '账单管理',
  127. component: './operator/Bill',
  128. },
  129. {
  130. path: '/operator/customer',
  131. name: '客户管理',
  132. component: './operator/Customer',
  133. },
  134. {
  135. path: '/operator/customer/:id',
  136. name: '客户详情',
  137. component: './operator/Customer/Detail',
  138. },
  139. {
  140. path: '/operator/rule',
  141. name: '计费规则',
  142. component: './operator/Rule',
  143. },
  144. {
  145. path: '/operator/vehicle',
  146. name: '车辆管理',
  147. component: './operator/Vehicle',
  148. },
  149. {
  150. path: '/operator/battery',
  151. name: '电池管理',
  152. component: './operator/Battery',
  153. },
  154. {
  155. path: '/operator/device',
  156. name: '电站设备',
  157. component: './operator/Device',
  158. },
  159. {
  160. path: '/operator/station',
  161. name: '电站查询',
  162. component: './operator/Station',
  163. },
  164. {
  165. path: '/operator/price',
  166. name: '电网电价',
  167. component: './operator/Price',
  168. },
  169. {
  170. path: '/operator',
  171. redirect: '/operator/order',
  172. },
  173. ],
  174. },
  175. {
  176. path: '/admin',
  177. name: '平台管理',
  178. access: 'canAdmin',
  179. routes: [
  180. {
  181. path: '/admin/tenant',
  182. name: '运营商管理',
  183. component: './admin/Tenant',
  184. },
  185. {
  186. path: '/admin/station',
  187. name: '电站管理',
  188. component: './admin/Station',
  189. },
  190. {
  191. path: '/admin/station/:id',
  192. name: '电站详情',
  193. component: './admin/Device',
  194. },
  195. {
  196. path: '/admin',
  197. redirect: '/admin/tenant',
  198. },
  199. ],
  200. },
  201. {
  202. path: '/system',
  203. name: '系统管理',
  204. routes: [
  205. {
  206. path: '/system/account',
  207. name: '我的账号',
  208. component: './system/Account',
  209. },
  210. {
  211. path: '/system/user',
  212. name: '用户管理',
  213. component: './system/User',
  214. access: 'canCommon',
  215. },
  216. {
  217. path: '/system/setting',
  218. name: '系统设置',
  219. component: './system/Setting',
  220. access: 'canAdmin',
  221. },
  222. {
  223. path: '/system/dict',
  224. name: '数据字典',
  225. component: './system/Dict',
  226. access: 'canRoot',
  227. },
  228. {
  229. path: '/system',
  230. redirect: '/system/account',
  231. },
  232. ],
  233. },
  234. {
  235. path: '/welcome',
  236. name: '欢迎登录',
  237. component: './Welcome',
  238. },
  239. {
  240. path: '/',
  241. redirect: '/welcome',
  242. },
  243. ],
  244. },
  245. {
  246. path: '*',
  247. layout: false,
  248. component: './404',
  249. },
  250. ];