index.js 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. import Vue from 'vue'
  2. import Router from 'vue-router'
  3. /* Layout */
  4. import Layout from '@/layout'
  5. Vue.use(Router)
  6. /**
  7. * Note: sub-menu only appear when route children.length >= 1
  8. * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
  9. *
  10. * hidden: true if set true, item will not show in the sidebar(default is false)
  11. * alwaysShow: true if set true, will always show the root menu
  12. * if not set alwaysShow, when item has more than one children route,
  13. * it will becomes nested mode, otherwise not show the root menu
  14. * redirect: noRedirect if set noRedirect will no redirect in the breadcrumb
  15. * name:'router-name' the name is used by <keep-alive> (must set!!!)
  16. * meta : {
  17. roles: ['admin','editor'] control the page roles (you can set multiple roles)
  18. title: 'title' the name show in sidebar and breadcrumb (recommend set)
  19. icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
  20. breadcrumb: false if set false, the item will hidden in breadcrumb(default is true)
  21. activeMenu: '/example/list' if set path, the sidebar will highlight the path you set
  22. }
  23. */
  24. /**
  25. * constantRoutes
  26. * a base page that does not have permission requirements
  27. * all roles can be accessed
  28. */
  29. export const asyncRoutes = [
  30. {
  31. path: '/passenger',
  32. component: Layout,
  33. name: 'Passenger',
  34. meta: { icon: 'el-icon-pie-chart', authorities: ['bz.passenger.equipment.find'] },
  35. children: [
  36. {
  37. path: 'equipment',
  38. name: 'PassengerEquipment',
  39. component: () => import('@/views/passenger/equipment'),
  40. meta: { title: '客流数据采集', authorities: ['bz.passenger.equipment.find'] }
  41. },
  42. {
  43. path: 'equipment/detail/:id',
  44. name: 'PassengerEquipmentDetail',
  45. hidden: true,
  46. component: () => import('@/views/passenger/equipment/Detail'),
  47. meta: { title: '客流数据采集详情' }
  48. }
  49. ]
  50. },
  51. {
  52. path: '/category',
  53. component: Layout,
  54. name: 'CulturalTourism',
  55. meta: {
  56. title: '文旅资源目录管理',
  57. icon: 'el-icon-goods',
  58. authorities: ['category.organization.find', 'category.occupation.find', 'category.material.find']
  59. },
  60. children: [
  61. {
  62. path: 'organization',
  63. name: 'CulturalTourismOrganization',
  64. component: () => import('@/views/category/organization'),
  65. meta: { title: '机构目录管理', authorities: ['category.organization.find'] }
  66. },
  67. {
  68. path: 'occupation',
  69. name: 'CulturalTourismOccupation',
  70. component: () => import('@/views/category/occupation'),
  71. meta: { title: '岗位目录管理', authorities: ['category.occupation.find'] }
  72. },
  73. {
  74. path: 'material',
  75. name: 'CulturalTourismMaterial',
  76. component: () => import('@/views/category/material'),
  77. meta: { title: '物务资源目录管理', authorities: ['category.material.find'] }
  78. }
  79. ]
  80. },
  81. {
  82. path: '/place',
  83. component: Layout,
  84. name: 'place',
  85. meta: {
  86. title: '文旅场所管理',
  87. icon: 'el-icon-receiving',
  88. authorities: ['place.category.find', 'place.base.info.find']
  89. },
  90. redirect: '/place/baseInfo',
  91. children: [
  92. {
  93. path: 'baseInfo',
  94. name: 'PlaceBaseInfo',
  95. component: () => import('@/views/place/baseInfo'),
  96. meta: { title: '文旅场所管理', authorities: ['place.category.find'] }
  97. },
  98. {
  99. path: 'category',
  100. name: 'PlaceCategory',
  101. component: () => import('@/views/place/category'),
  102. meta: { title: '文旅场所分类管理', authorities: ['place.base.info.find'] }
  103. }
  104. // {
  105. // path: 'venue',
  106. // name: 'BzBaseVenue',
  107. // component: () => import('@/views/bz/base/venue/index'),
  108. // meta: { title: '场馆', authorities: ['bz.base.venue.find'] }
  109. // },
  110. // {
  111. // path: 'scenery',
  112. // name: 'BzBaseScenery',
  113. // component: () => import('@/views/bz/base/scenery/index'),
  114. // meta: { title: '景区', authorities: ['bz.base.scenery.find'] }
  115. // },
  116. // {
  117. // path: 'holidayVillage',
  118. // name: 'BzBaseHolidayVillage',
  119. // component: () => import('@/views/bz/base/holidayVillage/index'),
  120. // meta: { title: '度假村', authorities: ['bz.base.holiday.village.find'] }
  121. // },
  122. // {
  123. // path: 'hotel',
  124. // name: 'BzBaseHotel',
  125. // component: () => import('@/views/bz/base/hotel/index'),
  126. // meta: { title: '酒店', authorities: ['bz.base.hotel.find'] }
  127. // },
  128. // {
  129. // path: 'homeStay',
  130. // name: 'BzBaseHomeStay',
  131. // component: () => import('@/views/bz/base/homeStay/index'),
  132. // meta: { title: '民宿', authorities: ['bz.base.home.stay.find'] }
  133. // },
  134. // {
  135. // path: 'tourist',
  136. // name: 'BzBaseTourist',
  137. // component: () => import('@/views/bz/base/tourist/index'),
  138. // meta: { title: '旅行社', authorities: ['bz.base.tourist.find'] }
  139. // }
  140. ]
  141. },
  142. {
  143. path: '/statistics',
  144. component: Layout,
  145. name: 'Statistics',
  146. meta: { title: '数据统计分析', icon: 'el-icon-s-data', authorities: ['statistics.complaint', 'statistics.file.manage', 'statistics.gis.map.base'] },
  147. redirect: '/statistics/index',
  148. children: [
  149. {
  150. path: 'complaint',
  151. name: 'StatisticsComplaint',
  152. component: () => import('@/views/statistics/complaint'),
  153. meta: { title: '客诉信息管理', authorities: ['statistics.complaint'] }
  154. },
  155. {
  156. path: 'file',
  157. name: 'StatisticsFile',
  158. component: () => import('@/views/statistics/file'),
  159. meta: { title: '多媒体信息管理', authorities: ['statistics.file.manage'] }
  160. },
  161. {
  162. path: 'gis',
  163. name: 'BzBaseGis',
  164. component: () => import('@/views/bz/gis'),
  165. meta: { title: 'GIS地图分布', authorities: ['statistics.gis.map.base'] }
  166. }
  167. ]
  168. },
  169. {
  170. path: '/appKey',
  171. component: Layout,
  172. name: 'AppKey',
  173. meta: { title: '接口', icon: 'el-icon-eleme', authorities: ['app.key.find', 'app.key.request.logs'] },
  174. redirect: '/appKey/index',
  175. children: [
  176. {
  177. path: 'index',
  178. name: 'AppKeyIndex',
  179. component: () => import('@/views/appKey/index'),
  180. meta: { title: 'AppKey管理', authorities: ['app.key.find'] }
  181. },
  182. {
  183. path: 'requestLogs',
  184. name: 'AppKeyRequestLogs',
  185. component: () => import('@/views/appKey/requestLogs'),
  186. meta: { title: '调用日志', authorities: ['app.key.request.logs'] }
  187. }
  188. ]
  189. },
  190. {
  191. path: '/user',
  192. component: Layout,
  193. name: 'User',
  194. meta: {
  195. title: '用户',
  196. icon: 'el-icon-user',
  197. authorities: ['oauth.user.find', 'oauth.role.find', 'oauth.role.find', 'oauth.user.find.operate.log', 'oauth.user.find.login.log']
  198. },
  199. children: [
  200. {
  201. path: 'info',
  202. name: 'UserInfo',
  203. component: () => import('@/views/user/info'),
  204. meta: { title: '用户管理', authorities: ['oauth.user.find'] }
  205. },
  206. {
  207. path: 'role',
  208. name: 'UserRole',
  209. component: () => import('@/views/user/role'),
  210. meta: { title: '角色管理', authorities: ['oauth.role.find'] }
  211. },
  212. {
  213. path: 'operateLog',
  214. name: 'UserOperateLog',
  215. component: () => import('@/views/user/operateLog'),
  216. meta: { title: '操作日志', authorities: ['oauth.user.find.operate.log'] }
  217. },
  218. {
  219. path: 'loginLog',
  220. name: 'UserLoginLog',
  221. component: () => import('@/views/user/loginLog'),
  222. meta: { title: '登录日志', authorities: ['oauth.user.find.login.log'] }
  223. }
  224. ]
  225. },
  226. {
  227. path: '/setting',
  228. component: Layout,
  229. name: 'Setting',
  230. meta: { title: '设置', icon: 'el-icon-setting', authorities: ['system.config.find'] },
  231. children: [
  232. {
  233. path: 'systemConfig',
  234. name: 'SettingSystemConfig',
  235. component: () => import('@/views/setting/systemConfig'),
  236. meta: { title: '系统设置', authorities: ['system.config.find'] }
  237. }
  238. ]
  239. },
  240. // 404 page must be placed at the end !!!
  241. { path: '*', redirect: '/404', hidden: true }
  242. ]
  243. export const constantRoutes = [
  244. {
  245. path: '/login',
  246. component: () => import('@/views/login/index'),
  247. hidden: true
  248. },
  249. {
  250. path: '/api/docs',
  251. component: () => import('@/views/apidocs/index'),
  252. hidden: true
  253. },
  254. {
  255. path: '/404',
  256. component: () => import('@/views/404'),
  257. hidden: true
  258. },
  259. {
  260. path: '/',
  261. component: Layout,
  262. redirect: '/dashboard',
  263. children: [
  264. {
  265. path: 'dashboard',
  266. component: () => import('@/views/dashboard/index'),
  267. name: 'Dashboard',
  268. meta: { title: '控制面片', icon: 'dashboard', affix: true }
  269. }
  270. ]
  271. }
  272. ]
  273. const createRouter = () => new Router({
  274. mode: 'hash', // require service support
  275. scrollBehavior: () => ({ y: 0 }),
  276. routes: constantRoutes
  277. })
  278. const router = createRouter()
  279. // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
  280. export function resetRouter() {
  281. const newRouter = createRouter()
  282. router.matcher = newRouter.matcher // reset router
  283. }
  284. export default router