import Vue from 'vue' import Router from 'vue-router' Vue.use(Router) /* Layout */ import Layout from '@/layout' import LayoutLogin from '@/layoutLogin' /** * hidden: true 当设置 true 的时候该路由不会在侧边栏出现 如401,login等页面,或者如一些编辑页面/edit/1 (默认 false) * * 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面 * 只有一个时,会将那个子路由当做根路由显示在侧边栏--如引导页面 * 若你想不管路由下面的 children 声明的个数都显示你的根路由 * 你可以设置 alwaysShow: true,这样它就会忽略之前定义的规则,一直显示根路由 * alwaysShow: true * * redirect: noRedirect 当设置 noRedirect 的时候该路由在面包屑导航中不可被点击 * name:'router-name' 设定路由的名字,一定要填写不然使用时会出现各种问题 * meta : { roles: ['admin','editor'] 设置该路由进入的权限,支持多个权限叠加 title: 'title' 设置该路由在侧边栏和面包屑中展示的名字 icon: 'svg-name' 设置该路由的图标 breadcrumb: false 如果设置为false,则不会在breadcrumb面包屑中显示(默认 true) activeMenu: '/example/list' 当路由设置了该属性,则会高亮相对应的侧边栏 } showFather: 'true' or 'false' 是否一定显示父节点 */ /** * 不需要动态判断权限的路由 * 基础页面,所有人可以访问 */ export const constantRoutes = [ { path: '/', redirect: '/login', hidden: true }, { path: '/login', component: (resolve) => require(['@/views/login/login.vue'], resolve), hidden: true }, // { // path: '/forgetPwd', // component: LayoutLogin, // redirect: '/forgetPwd/index', // hidden: true, // children: [ // { // path: '/forgetPwd/index', // component: (resolve) => require(['@/views/login/forgetPwd'], resolve), // name: '忘记密码', // meta: { title: '忘记密码', icon: 'dashboard', noCache: true, affix: true } // }, // { // path: '/forgetPwd/reSet', // component: (resolve) => require(['@/views/login/setPwd'], resolve), // name: '重置密码', // meta: { title: '重置密码', icon: 'dashboard', noCache: true, affix: true } // } // ] // }, { path: '/404', component: () => import('@/views/404'), hidden: true }, { path: '/reSetPsw', component: Layout, name: 'reSetPsw', hidden: true, redirect: '/reSetPsw/index', children: [{ path: '/reSetPsw/index', name: 'reSetPswDetail', component: () => import('@/views/reSetPsw.vue'), meta: { title: '修改密码', icon: 'dashboard' } }] }, /* { path: '/', component: Layout, redirect: '/uiStandard/info' },*/ { path: '/welcome', component: Layout, name: 'welcome', hidden: true, meta: { title: '欢迎', icon: 'dashboard' } }, { path: '/dict', component: Layout, hidden: true, children: [ { path: 'type/data/:dictId(\\d+)', component: (resolve) => require(['@/views/system/dict/data'], resolve), name: 'Data', meta: { title: '字典数据', icon: '' } } ] } // { // path: '/old', // component: Layout, // redirect: '/old/oldConfig', // hidden: true, // children: [{ // path: '/old/oldConfig', // name: 'OldConfig', // component: () => import('@/views/mesCenter/msgConfigOld.vue'), // meta: { title: '消息配置旧的', icon: 'dashboard' } // }, // { // path: '/old/addMes', // name: 'AddMes', // component: () => import('@/views/mesCenter/addMes.vue'), // meta: { title: '新增消息', icon: 'dashboard' } // }, // { // path: '/old/editMes', // name: 'EditMes', // component: () => import('@/views/mesCenter/editMes.vue'), // meta: { title: '修改消息', icon: 'dashboard' } // } // ] // } /*, { path: '/log', component: Layout, redirect: '/log/operLog', children: [{ path: '/log/operLog', name: 'Operlog', component: () => import('@/views/monitor/operLog/index.vue'), meta: { title: '操作日志', icon: 'dashboard' } }] }*/ // 系统管理 /* { path: '/sysManage', component: Layout, name: 'sysManage', redirect: '/sysManage/userManage', meta: { title: '系统管理', icon: 'dashboard' }, showFather: 'true', children: [{ path: '/sysManage/userManage', name: 'UserManage', component: () => import('@/views/system/user'), meta: { title: '用户管理', icon: 'dashboard' } }, { path: '/sysManage/roleManage', name: 'RoleManage', component: () => import('@/views/system/role'), meta: { title: '角色管理', icon: 'dashboard' } }, { path: '/sysManage/deptManage', name: 'DeptManage', component: () => import('@/views/system/dept'), meta: { title: '部门管理', icon: 'dashboard' } }, { path: '/sysManage/menuManage', name: 'MenuManage', component: () => import('@/views/system/menu'), meta: { title: '菜单管理', icon: 'dashboard' } }, { path: '/sysManage/dictionary', name: 'Dictionary', component: () => import('@/views/system/menu'), meta: { title: '数据字典', icon: 'dashboard' } } ] },*/ // 消息中心 /* { path: '/mesCenter', component: Layout, name: 'MesCenter', redirect: '/mesCenter/bussinessMes', meta: { title: '消息中心', icon: 'dashboard' }, showFather: 'true', children: [{ path: '/mesCenter/bussinessMes', name: 'BussinessMes', component: () => import('@/views/operationCenter'), meta: { title: '业务消息', icon: 'dashboard' } }, { path: '/mesCenter/mailMes', name: 'MailMes', component: () => import('@/views/operationCenter'), meta: { title: '邮件消息', icon: 'dashboard' } }, { path: '/mesCenter/mobileMes', name: 'MobileMes', component: () => import('@/views/operationCenter'), meta: { title: '短信消息', icon: 'dashboard' } } ] },*/ // 集成管理 // { // path: '/integratedManagement', // component: Layout, // name: 'IntegratedManagement', // redirect: '/integratedManagement/dataIntegrated', // meta: { title: '集成管理', icon: 'dashboard' }, // showFather: 'true', // children: [{ // path: '/integratedManagement/dataIntegrated', // name: 'DataIntegrated', // component: () => import('@/views/operationCenter'), // meta: { title: '数据集成', icon: 'dashboard' } // } // ] // }, // 移动集成 // { // path: '/mobileIntegrated', // component: Layout, // name: 'MobileIntegrated', // redirect: '/mobileIntegrated/appManage', // meta: { title: '移动集成', icon: 'dashboard' }, // showFather: 'true', // children: [{ // path: '/mobileIntegrated/appManage', // name: 'AppManage', // component: () => import('@/views/operationCenter'), // meta: { title: '应用管理', icon: 'dashboard' } // } // ] // }, // 流程设计 /* { path: '/workflow', component: Layout, name: 'Workflow', redirect: '/workflow/group', meta: { title: '流程设计', icon: 'dashboard' }, showFather: 'true', children: [{ path: '/workflow/group', name: 'Group', component: () => import('@/views/workflow/group/index.vue'), meta: { title: '业务分组', icon: 'dashboard' } }, { path: '/workflow/formTemplate', name: 'FormTemplate', component: () => import('@/views/workflow/formTemplate/list.vue'), meta: { title: '表单模板', icon: 'dashboard' } }, { path: '/workflow/formTemplate/add', name: 'FormTemplateAdd', hidden: true, component: () => import('@/views/workflow/formTemplate/add.vue'), meta: { title: '表单添加', icon: 'dashboard' } }, { path: '/workflow/workFlowManage', name: 'WorkFlowManage', component: () => import('@/views/workflow/processLIst/ProcessList.vue'), meta: { title: '流程定义', icon: 'dashboard' } }, { path: '/workflow/workFlowManage/edit', name: 'WorkFlowEdit', hidden: true, component: () => import('@/views/workflow/processLIst/EditProcessList.vue'), meta: { title: '流程编辑', icon: 'dashboard' } }, { path: '/workflow/workFlowInstance', name: 'WorkFlowInstance', component: () => import('@/views/workflow/workFlowInstance/index.vue'), meta: { title: '流程实例', icon: 'dashboard' } } ] },*/ // { // path: '/uiStandard', // component: Layout, // redirect: '/uiStandard/info', // children: [{ // path: '/uiStandard/info', // name: 'uiStandardInfo', // component: () => import('@/views/uiStandard/index.vue'), // meta: { title: 'ui标准', icon: 'dashboard' } // }] // }, // 业务管理 /* { path: '/businessManage', component: Layout, name: 'businessManage', redirect: '/businessManage/todolist', meta: { title: '业务管理', icon: 'dashboard' }, showFather: 'true', children: [ { path: '/businessManage/todolist', name: 'bmTodoList', component: () => import('@/views/instance/TodoList'), meta: { title: '待办事项', pageType: 1, icon: 'dashboard' } }, { path: '/businessManage/personal/todolist', name: 'bmDoneList', component: () => import('@/views/instance/doneList'), meta: { title: '已办事项', pageType: 2, icon: 'dashboard' } }, { path: '/businessManage/taskDetail/:param', name: 'bmTaskDetail', component: () => import('@/views/instance/TaskDetail'), hidden: true, meta: { title: '任务详情页', icon: 'dashboard' } }, { path: '/businessManage/template', name: 'bmTemplate', component: () => import('@/views/instance/Template'), meta: { title: '模板渲染展示', icon: 'dashboard' } }, { path: '/businessManage/instance/listDetail', name: 'ListDetail', component: () => import('@/views/instance/ListDetail'), meta: { title: '流程详情', icon: 'dashboard' } }, { path: '/businessManage/instance/list', name: 'InstanceList', component: () => import('@/views/instance/InstanceList'), meta: { title: '流程启动列表', icon: 'dashboard' } } ] }*/ ] /** * 有权限的路由 * 需要动态判断权限并通过 addRoutes 动态添加的页面。 */ export const asyncRoutes = [ // 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