| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- import Vue from 'vue'
- import Router from 'vue-router'
- Vue.use(Router)
- /* Layout */
- import Layout from '@/layout'
- /**
- * Note: sub-menu only appear when route children.length >= 1
- * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
- *
- * hidden: true if set true, item will not show in the sidebar(default is false)
- * alwaysShow: true if set true, will always show the root menu
- * if not set alwaysShow, when item has more than one children route,
- * it will becomes nested mode, otherwise not show the root menu
- * redirect: noRedirect if set noRedirect will no redirect in the breadcrumb
- * name:'router-name' the name is used by <keep-alive> (must set!!!)
- * meta : {
- roles: ['admin','editor'] control the page roles (you can set multiple roles)
- title: 'title' the name show in sidebar and breadcrumb (recommend set)
- icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
- breadcrumb: false if set false, the item will hidden in breadcrumb(default is true)
- activeMenu: '/example/list' if set path, the sidebar will highlight the path you set
- }
- */
- /**
- * constantRoutes
- * a base page that does not have permission requirements
- * all roles can be accessed
- */
- export const constantRoutes = [
- {
- path: '/redirect',
- component: Layout,
- hidden: true,
- children: [
- {
- path: '/redirect/:path(.*)',
- component: () => import('@/views/redirect/index')
- }
- ]
- },
- {
- path: '/login',
- component: () => import('@/views/login/index'),
- hidden: true
- },
- {
- path: '/',
- component: Layout,
- redirect: '/index',
- children: [{
- path: 'index',
- name: 'index',
- component: () => import('@/views/dashboard/index'),
- meta: { title: '首页', icon: 'dashboard' }
- }]
- },
- {
- path: '/catenary',
- component: Layout,
- redirect: '/catenary/fault',
- name: 'catenary',
- meta: {
- title: '接触网管理',
- icon: 'el-icon-film'
- },
- children: [
- {
- path: 'fault',
- component: () => import('@/views/catenary/fault/index'), // Parent router-view
- name: 'fault',
- meta: { title: '故障数据管理', icon: 'el-icon-collection-tag' }
- },
- {
- path: 'checklist',
- component: () => import('@/views/catenary/checklist/index'),
- name: 'checklist',
- meta: { title: '检查表管理', icon: 'el-icon-collection-tag' }
- },
- {
- path: 'record',
- component: () => import('@/views/catenary/record/index'),
- name: 'record',
- meta: { title: '检测记录管理', icon: 'el-icon-collection-tag' }
- },
- {
- path: 'stand',
- component: () => import('@/views/catenary/stand/index'),
- name: 'stand',
- meta: { title: '九防台账数据管理', icon: 'el-icon-collection-tag' }
- }
- ]
- },
- {
- path: '/basics',
- component: Layout,
- redirect: '/basics/pillar',
- name: 'basics',
- meta: {
- title: '基础数据管理',
- icon: 'el-icon-document'
- },
- children: [
- {
- path: 'line',
- component: () => import('@/views/basics/line/index'), // Parent router-view
- name: 'line',
- meta: { title: '线路数据', icon: 'el-icon-collection-tag' }
- },
- {
- path: 'section',
- component: () => import('@/views/basics/section/index'), // Parent router-view
- name: 'section',
- meta: { title: '区间站场数据', icon: 'el-icon-collection-tag' }
- },
- {
- path: 'pillar',
- component: () => import('@/views/basics/pillar/index'), // Parent router-view
- name: 'pillar',
- meta: { title: '支柱数据', icon: 'el-icon-collection-tag' }
- },
- {
- path: 'suoting',
- component: () => import('@/views/basics/suoting/index'), // Parent router-view
- name: 'suoting',
- meta: { title: '所亭数据', icon: 'el-icon-collection-tag' }
- },
- {
- path: 'tunnel',
- component: () => import('@/views/basics/tunnel/index'), // Parent router-view
- name: 'tunnel',
- meta: { title: '隧道数据', icon: 'el-icon-collection-tag' }
- },
- {
- path: 'add',
- component: () => import('@/views/basics/add/index'), // Parent router-view
- name: 'add',
- meta: { title: '附加悬挂锚段数据', icon: 'el-icon-collection-tag' }
- },
- {
- path: 'check',
- component: () => import('@/views/basics/check/index'), // Parent router-view
- name: 'check',
- meta: { title: '检查表数据', icon: 'el-icon-collection-tag' }
- }
- ]
- },
- // {
- // path: 'external-link',
- // component: Layout,
- // children: [
- // {
- // path: 'https://baidu.com',
- // meta: { title: '外链', icon: 'link' }
- // }
- // ]
- // },
- // 404 page must be placed at the end !!!
- {
- path: '/404',
- component: () => import('@/views/404'),
- hidden: true
- }
- ]
- export const asyncRoutes = [
- {
- path: '/sys',
- component: Layout,
- redirect: '/sys/dept',
- name: 'sys',
- meta: {
- title: '系统管理',
- // pages: ['pc:sys'],
- icon: 'el-icon-setting'
- },
- children: [
- {
- path: 'dept',
- component: () => import('@/views/sys/dept/index'), // Parent router-view
- name: 'dept',
- meta: { title: '部门数据', pages: ['pc:system:dept:list'], icon: 'el-icon-collection-tag' }
- },
- {
- path: 'role',
- component: () => import('@/views/sys/role/index'), // Parent router-view
- name: 'role',
- meta: { title: '职务管理', pages: ['pc:system:role:list'], icon: 'el-icon-collection-tag' }
- },
- {
- path: 'user',
- component: () => import('@/views/sys/user/index'), // Parent router-view
- name: 'user',
- meta: { title: '职工管理', pages: ['pc:system:user:list'], icon: 'el-icon-collection-tag' }
- },
- {
- path: 'dict',
- component: () => import('@/views/sys/dict/index'), // Parent router-view
- name: 'dict',
- meta: { title: '字典管理', pages: ['pc:system:dict:list'], icon: 'el-icon-collection-tag' }
- },
- {
- path: 'menu',
- component: () => import('@/views/sys/menu/index'), // Parent router-view
- name: 'menu',
- meta: { title: '菜单管理', pages: ['pc:system:menu:list'], icon: 'el-icon-collection-tag' }
- },
- {
- path: 'log',
- component: () => import('@/views/sys/log/index'), // Parent router-view
- name: 'log',
- meta: { title: '日志管理', pages: ['pc:system:operlog:list'], icon: 'el-icon-collection-tag' }
- }
- ]
- },
- {
- path: '*',
- redirect: '/404',
- hidden: true
- }
- ]
- const createRouter = () => new Router({
- mode: 'history', // require service support
- scrollBehavior: () => ({ y: 0 }),
- routes: constantRoutes
- })
- const router = createRouter()
- // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
- export function resetRouter() {
- const newRouter = createRouter()
- router.matcher = newRouter.matcher // reset router
- }
- export default router
|