import Vue from 'vue' import Router from 'vue-router' Vue.use(Router) /* Layout */ import Layout from '@/layout' export const constantRoutes = [ { path: '/login', name: 'Login', component: () => import('@/views/login/index'), title: '登录', hidden: true }, { path: '/callback', name: 'Callback', component: () => import('@/views/callback/index'), title: '回调', hidden: true }, { path: '/404', name: '404', component: () => import('@/views/404'), title: '错误页面', hidden: true }, { path: '/', component: Layout, name: 'Dashboard', redirect: '/dashboard', tag: '工时统计', backgroundImage: require('@/assets/siemens/dashboard.jpg'), description: '页面显示DC各个团队的本周及未来几周的工作负荷曲线', children: [{ path: 'dashboard', name: 'Dashboard', component: () => import('@/views/dashboard'), meta: { title: '统计', icon: 'dashboard' } }] }, { path: '/user', component: Layout, name: 'PersonalPassword', redirect: '/user/personalPassword', tag: '个人信息', children: [{ path: 'personalPassword', name: 'PersonalPassword', component: () => import('@/views/personalPassword'), meta: { title: '个人信息', icon: 'dashboard' }, hidden: true }] }, { path: '/nav', name: 'Nav', tag: '导航页面', component: () => import('@/views/nav/nav2.vue'), hidden: true } // { // path: '/history', // component: Layout, // name: 'History', // redirect: '/history/orderHist', // tag: '预约历史查询', // backgroundImage: require('@/assets/siemens/task.jpg'), // description: '查看已预约历史', // children: [{ // path: 'orderHist', // name: 'OrderHist', // component: () => import('@/views/orderHist'), // meta: { title: '预约单查询', icon: 'el-icon-s-custom' } // }] // } ] export const asyncRoutes = [ { path: '/enginner', component: Layout, name: 'Record', redirect: '/enginner/record', tag: '工程师派工', backgroundImage: require('@/assets/siemens/task.jpg'), description: 'BD、工程师及主管可以在此登记本周的工作和未来的工作计划,同时还可以根据技能标签查找对应的工程师资源', children: [{ path: 'record', name: 'Record', component: () => import('@/views/record'), meta: { title: '工程师派工', icon: 'el-icon-s-custom' } }] }, { path: '/skill', name: 'Skill', component: Layout, redirect: '/skill/match', meta: { title: '工程师技能', icon: 'el-icon-reading' }, tag: '技能匹配', backgroundImage: require('@/assets/siemens/skill.jpeg'), description: '工程师及主管可以在此进行维护工程师的能力标签', children: [ { path: 'type', name: 'SkillType', component: () => import('@/views/skill/datatype'), meta: { title: '技能种类管理', icon: 'el-icon-tickets' } }, { path: 'manage', name: 'Management', component: () => import('@/views/skill/datamanage'), meta: { title: '技能库管理', icon: 'el-icon-document' } }, { path: 'match', name: 'Matching', component: () => import('@/views/skill/datamatch'), meta: { title: '技能匹配', icon: 'el-icon-document-add' } } ] }, { path: '/acl', name: 'Acl', component: Layout, redirect: '/acl/user', tag: '用户管理', backgroundImage: require('@/assets/siemens/user.jpeg'), description: '工程师主管和管理员可以在此维护用户基本信息', meta: { title: '用户管理', icon: 'el-icon-lock' }, children: [ { name: 'User', path: 'user', component: () => import('@/views/acl/user'), meta: { title: '用户' } }, { name: 'Role', path: 'role', component: () => import('@/views/acl/role'), meta: { title: '角色' } }, { name: 'Permission', path: 'permission', component: () => import('@/views/acl/permission'), meta: { title: '权限' } } ] } ] export const anyRoutes = { path: '*', redirect: '/404', hidden: true } const createRouter = () => new Router({ mode: 'history', 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