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 (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: '/login', component: () => import('@/views/login/index'), hidden: true }, { path: '/approval', component: () => import('@/views/approval/index'), hidden: true }, // { // path: '/details', // component: () => import('@/views/record/details'), // hidden: true // }, { path: '/index', component: () => import('@/views/index'), hidden: true }, { path: '/404', component: () => import('@/views/404'), hidden: true }, { path: '/', component: Layout, redirect: '/frontPage', children: [{ path: 'frontPage', name: 'frontPage', component: () => import('@/views/frontPage/index'), meta: { title: '首页'} }] }, // { // path: '/', // component: Layout, // redirect: '/dashboard', // children: [{ // path: 'dashboard', // name: 'Dashboard', // component: () => import('@/views/approval/index'), // meta: { title: '测试'} // }] // }, // { // path: '/aaa', // component: Layout, // redirect: '/aaa', // children: [{ // path: 'aaa', // name: 'aaa', // component: () => import('@/views/approval/aaa'), // meta: { title: '测试1'} // }] // }, // { // path: '/bbb', // component: Layout, // redirect: '/bbb', // children: [{ // path: 'bbb', // name: 'bbb', // component: () => import('@/views/approval/bbb'), // meta: { title: 'table编辑测试'} // }] // }, // { // path: '/bbb', // component: Layout, // redirect: '/bbb', // children: [{ // path: 'bbb', // name: 'bbb', // component: () => import('@/views/basicInfo/assessmentDimension'), // meta: { title: '测试b'} // }] // }, // { // path: '/dataReporting', // component: Layout, // redirect: '/dataReporting/departmentKpi', // name: 'Example', // meta: { title: '数据提报', icon: 'el-icon-s-help' }, // children: [ // { // path: 'departmentKpi', // name: 'departmentKpi', // component: () => import('@/views/dataReporting/departmentKpi'), // meta: { title: '部门KPI', icon: 'table' } // }, // { // path: 'personalKpi', // name: 'personalKpi', // component: () => import('@/views/dataReporting/personalKpi'), // meta: { title: '个人KPI', icon: 'tree' } // }, // { // path: 'operationalEvaluation', // name: 'operationalEvaluation', // component: () => import('@/views/dataReporting/operationalEvaluation'), // meta: { title: '运营评价', icon: 'tree' } // } // ] // }, { path: '/assessmentProgram', component: Layout, redirect: '/assessmentProgram/departmentalAssessment', name: 'Example', meta: { title: '考核方案', icon: 'el-icon-s-help' }, children: [ { path: 'departmentalAssessment', name: 'departmentalAssessment', component: () => import('@/views/assessmentProgram/departmentalAssessment'), meta: { title: '部门考核', icon: 'table' } }, // { // path: 'jobAssessment', // name: 'jobAssessment', // component: () => import('@/views/assessmentProgram/jobAssessment'), // meta: { title: '岗位考核', icon: 'tree' } // }, { path: 'qualitativeIndicators', name: 'qualitativeIndicators', component: () => import('@/views/assessmentProgram/qualitativeIndicators'), meta: { title: '定性考核', icon: 'tree' } }, // { // path: 'quantitativeIndicators', // name: 'quantitativeIndicators', // component: () => import('@/views/assessmentProgram/quantitativeIndicators'), // meta: { title: '定量考核', icon: 'tree' } // }, // { // path: 'subSection', // name: 'subSection', // component: () => import('@/views/assessmentProgram/subSection'), // meta: { title: '定性考核子栏目', icon: 'tree' } // },{ // path: 'rules', // name: 'rules', // component: () => import('@/views/assessmentProgram/rules'), // meta: { title: '考核细则', icon: 'tree' } // } ] }, { path: '/basicInfo', component: Layout, redirect: '/basicInfo/assessmentDimension', name: 'Example', meta: { title: '基础信息', icon: 'el-icon-s-help' }, children: [ { path: 'assessmentDimension', name: 'assessmentDimension', component: () => import('@/views/basicInfo/assessmentDimension.vue'), meta: { title: '考核维度', icon: 'table' } }, // { // path: 'quantitativeIndicators', // name: 'quantitativeIndicators', // component: () => import('@/views/basicInfo/quantitativeIndicators'), // meta: { title: '定量指标', icon: 'tree' } // }, // { // path: 'qualitativeIndicators', // name: 'qualitativeIndicators', // component: () => import('@/views/basicInfo/qualitativeIndicators'), // meta: { title: '定性指标', icon: 'tree' } // }, { path: 'project', name: 'project', component: () => import('@/views/basicInfo/project'), meta: { title: '考核指标', icon: 'tree' } }, { path: 'Target', name: 'Target', component: () => import('@/views/basicInfo/target'), meta: { title: '指标目标', icon: 'tree' } }, // { // path: 'jobEntry', // name: 'jobEntry', // component: () => import('@/views/basicInfo/jobEntry'), // meta: { title: '岗位录入', icon: 'tree' } // } ] }, // { // path: '/record', // component: Layout, // redirect: '/record', // children: [{ // path: 'record', // name: 'Record', // component: () => import('@/views/record/index'), // meta: { title: '考核记录'} // }] // }, { path: '/details', component: Layout, redirect: '/details', children: [{ path: 'details', name: 'Details', component: () => import('@/views/record/details'), // meta: { title: '考核记录详情'} }] }, // 404 page must be placed at the end !!! { 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