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) seq:0,title: 'seq:0,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 commonRoutes = [ /* * 看板部分路由 * */ { path: '/zhkb', component: () => import('@/views/kanbanManager/zhkb'), hidden: true }, { path: '/cgdd', component: () => import('@/views/kanbanManager/cgdd'), hidden: true }, { path: '/ckgl', component: () => import('@/views/kanbanManager/ckgl'), hidden: true }, { path: '/login', component: () => import('@/views/login/index'), hidden: true }, { path: '/404', component: () => import('@/views/404'), hidden: true }, { path: '/redirect', component: Layout, hidden: true, children: [ { path: '/redirect/:path(.*)', component: () => import('@/views/redirect/index') } ] }, { path: '/', component: Layout, redirect: '/index', name: '系统首页', children: [{ path: 'index', name: 'index', component: () => import('@/views/systemHome/index'), meta: { seq: 0, title: '系统首页', icon: 'home', affix: true } }] } // { path: '*', redirect: '/404', hidden: true } ] export const asyncRoutes = [ { path: '/basicSettings', component: Layout, redirect: '/basicSettings/organizationList', name: '基础设置', code: '01', meta: { code: '01', seq: 0, title: '基础设置', icon: 'tree2' }, alwaysShow: true, // 当children只有一个时,也显示父菜单 children: [ { path: 'organizationList', name: 'organizationListCancel', code: '0101', component: () => import('@/views/basicSettings/organizationList'), meta: { code: '0101', seq: 0, title: '组织架构', icon: '', keepAlive: true } }, { path: 'postList', name: 'personListCancel', code: '0102', component: () => import('@/views/basicSettings/postList'), meta: { code: '0102', seq: 0, title: '岗位管理', icon: '', keepAlive: true } }, { path: 'groupList', name: 'groupListCancel', code: '0103', component: () => import('@/views/basicSettings/groupList'), meta: { code: '0103', seq: 0, title: '班组管理', icon: '', keepAlive: true } }, { path: 'personList', name: 'personListCancel', code: '0104', component: () => import('@/views/basicSettings/personList'), meta: { code: '0104', seq: 0, title: '人员管理', icon: '', keepAlive: true } }, { path: 'roleList', name: 'roleListCancel', code: '0105', component: () => import('@/views/basicSettings/roleList'), meta: { code: '0105', seq: 0, title: '角色管理', icon: '', keepAlive: true } }, { path: 'contactUnitList', name: 'contactUnitListCancel', code: '0106', component: () => import('@/views/basicSettings/contactUnitList'), meta: { code: '0106', seq: 0, title: '往来单位', icon: '', keepAlive: true } }, { path: 'warehouseList', name: 'warehouseListCancel', code: '0107', component: () => import('@/views/basicSettings/warehouseList'), meta: { code: '0107', seq: 0, title: '仓库设置', icon: '', keepAlive: true } }, { path: 'storageList', name: 'storageListCancel', code: '0108', component: () => import('@/views/basicSettings/storageList'), meta: { code: '0108', seq: 0, title: '库位设置', icon: '', keepAlive: true } }, { path: 'installLampList', name: 'installLampListCancel', code: '0109', component: () => import('@/views/basicSettings/installLampList'), meta: { code: '0109', seq: 0, title: '安灯设置', icon: '', keepAlive: true } }, { path: 'powerDivider', name: 'powerDividerCancel', code: '0110', component: () => import('@/views/basicSettings/powerDivider'), meta: { code: '0110', seq: 0, title: '权限分配', icon: '', keepAlive: true } }, { path: 'roleDivider', name: 'roleDividerCancel', code: '0111', hidden: true, component: () => import('@/views/basicSettings/roleDivider'), meta: { code: '0111', seq: 0, title: '角色分配', icon: '', keepAlive: true } }, { path: 'cronTime', name: 'cronTimeCancel', code: '0113', hidden: true, component: () => import('@/views/basicSettings/cronTime'), meta: { code: '0113', seq: 0, title: '定时任务', icon: '', keepAlive: true } } ] }, { path: '/materialManager', component: Layout, redirect: '/materialManager/unitList', name: '物料管理', code: '02', meta: { code: '02', seq: 0, title: '物料管理', icon: 'table' }, alwaysShow: true, // 当children只有一个时,也显示父菜单 children: [ { path: 'unitList', name: 'unitListCancel', code: '0201', component: () => import('@/views/materialManager/unitList'), meta: { code: '0201', seq: 0, title: '计量单位', icon: '', keepAlive: true } }, { path: 'inventoryList', name: 'inventoryListCancel', code: '0202', component: () => import('@/views/materialManager/inventoryList'), meta: { code: '0202', seq: 0, title: '存货档案', icon: '', keepAlive: true } }, { path: 'materialList', name: 'materialListCancel', code: '0203', component: () => import('@/views/materialManager/materialList'), meta: { code: '0203', seq: 0, title: '物料清单', icon: '', keepAlive: true } } ] }, { path: '/deviceManager', component: Layout, redirect: '/deviceManager/deviceType', name: '设备管理', code: '03', meta: { code: '03', seq: 0, title: '设备管理', icon: 'example' }, alwaysShow: true, children: [ { path: 'deviceList', name: 'deviceListCancel', code: '0301', component: () => import('@/views/deviceManager/deviceList'), meta: { code: '0301', seq: 0, title: '设备清单', icon: '', keepAlive: true } }, { path: 'checkStandard', name: 'checkStandardCancel', code: '0302', component: () => import('@/views/deviceManager/checkStandard'), meta: { code: '0302', seq: 0, title: '点检标准', icon: '', keepAlive: true } }, { path: 'checkPosition', name: 'checkPositionCancel', code: '0303', component: () => import('@/views/deviceManager/checkPosition'), meta: { code: '0303', seq: 0, title: '点检部位', icon: '', keepAlive: true } }, { path: 'maintainStandard', name: 'maintainStandardCancel', code: '0304', component: () => import('@/views/deviceManager/maintainStandard'), meta: { code: '0304', seq: 0, title: '保养标准', icon: '', keepAlive: true } }, { path: 'maintainPosition', name: 'maintainPositionCancel', code: '0305', component: () => import('@/views/deviceManager/maintainPosition'), meta: { code: '0305', seq: 0, title: '保养部位', icon: '', keepAlive: true } }, { path: 'checkRecord', name: 'checkRecordCancel', code: '0306', component: () => import('@/views/deviceManager/checkRecord'), meta: { code: '0306', seq: 0, title: '点检记录', icon: '', keepAlive: true } }, { path: 'maintainRecord', name: 'maintainRecordCancel', code: '0307', component: () => import('@/views/deviceManager/maintainRecord'), meta: { code: '0307', seq: 0, title: '保养记录', icon: '', keepAlive: true } }, { path: 'repairRecord', code: '0308', name: 'repairRecordCancel', component: () => import('@/views/deviceManager/repairRecord'), meta: { code: '0308', seq: 0, title: '维修记录', icon: '', keepAlive: true } } ] }, { path: '/qualityManager', component: Layout, redirect: '/qualityManager/defectDefine', name: '质量管理', code: '04', meta: { code: '04', seq: 0, title: '质量管理', icon: 'quality' }, alwaysShow: true, children: [ { path: 'defectDefine', name: 'defectDefineCancel', code: '0401', component: () => import('@/views/qualityManager/defectDefine'), meta: { code: '0401', seq: 0, title: '缺陷定义', icon: '', keepAlive: true } }, { path: 'processCheckItem', name: 'processCheckItemCancel', code: '0402', component: () => import('@/views/qualityManager/processCheckItem'), meta: { code: '0402', seq: 0, title: '检验项设置', icon: '', keepAlive: true } }, { path: 'qualityPlaning', name: 'qualityPlaningCancel', code: '0403', component: () => import('@/views/qualityManager/qualityPlaning'), meta: { code: '0403', seq: 0, title: '质检方案', icon: '', keepAlive: true } }, { path: 'processCheck', name: 'processCheckCancel', code: '0404', component: () => import('@/views/qualityManager/processCheck'), meta: { code: '0404', seq: 0, title: '工序检验', icon: '', keepAlive: true } }, { path: 'processCheckRecord', name: 'processCheckRecordCancel', code: '0405', component: () => import('@/views/qualityManager/processCheckRecord'), meta: { code: '0405', seq: 0, title: '工序检验', icon: '', keepAlive: true } } ] }, { path: '/workOrder', component: Layout, redirect: '/workOrder/workOrderList', name: '工单管理', code: '05', meta: { code: '05', seq: 0, title: '工单管理', icon: 'bbgl' }, alwaysShow: true, // 当children只有一个时,也显示父菜单 children: [ { path: 'produceOrderList', name: 'produceOrderListCancel', code: '0501', component: () => import('@/views/workOrder/produceOrderList'), meta: { code: '0501', seq: 0, title: 'ERP订单', icon: '', keepAlive: true } }, { path: 'workOrderList', name: 'workOrderListCancel', code: '0502', component: () => import('@/views/workOrder/workOrderList'), meta: { code: '0502', seq: 0, title: 'MES工单', icon: '', keepAlive: true } }, { path: 'workOrderSend', name: 'workOrderSendCancel', code: '0503', component: () => import('@/views/workOrder/workOrderSend'), meta: { code: '0503', seq: 0, title: '工单派发', icon: '', keepAlive: true } }, { path: 'workOrderClose', name: 'workOrderCloseCancel', code: '0504', component: () => import('@/views/workOrder/workOrderClose'), meta: { code: '0504', seq: 0, title: '工单关闭', icon: '', keepAlive: true } } ] }, { path: '/produce', component: Layout, redirect: '/produce/stepReport', name: '生产执行', code: '06', meta: { code: '06', seq: 0, title: '生产执行', icon: 'component' }, alwaysShow: true, // 当children只有一个时,也显示父菜单 children: [ { path: 'stepReport', name: 'stepReportCancel', code: '0601', component: () => import('@/views/produce/stepReport'), meta: { code: '0601', seq: 0, title: '工序报工', icon: '', keepAlive: true } }, { path: 'reportCorrect', name: 'reportCorrectCancel', code: '0602', component: () => import('@/views/produce/reportCorrect'), meta: { code: '0602', seq: 0, title: '报工调整', icon: '', keepAlive: true } }, { path: 'reportVerify', name: 'reportVerifyCancel', code: '0603', component: () => import('@/views/produce/reportVerify'), meta: { code: '0603', seq: 0, title: '报工审核', icon: '', keepAlive: true } } ] }, // { // path: '/statistic', // component: Layout, // redirect: '/statistic/reportList', // name: '统计报表', // code: '1004', // meta: { code: '1004', seq:0,title: '统计报表', icon: 'quality' }, // alwaysShow: true, // 当children只有一个时,也显示父菜单 // children: [ // { // path: 'reportList', // name: 'reportListCancel', // code: '1040', // component: () => import('@/views/statistic/reportList'), // meta: { code: '1040', seq:0,title: '报工记录', icon: '', keepAlive: true } // }, // { // path: 'monthReport', // name: 'monthReportCancel', // code: '1041', // component: () => import('@/views/statistic/monthReport'), // meta: { code: '1041', seq:0,title: '月度统计', icon: '', keepAlive: true } // }, { // path: 'workOrderProcess', // name: 'workOrderProcessCancel', // code: '1042', // component: () => import('@/views/statistic/workOrderProcess'), // meta: { code: '1042', seq:0,title: '工单进度', icon: '', keepAlive: true } // }, { // path: 'inProcessList', // name: 'inProcessListCancel', // code: '1043', // component: () => import('@/views/statistic/inProcessList'), // meta: { code: '1043', seq:0,title: '在制列表', icon: '', keepAlive: true } // } // // ] // }, { path: '/systemSetting', component: Layout, redirect: '/systemSetting/encodingRules', name: '系统设置', code: '08', meta: { code: '08', seq: 0, title: '系统设置', icon: 'xtsz' }, alwaysShow: true, // 当children只有一个时,也显示父菜单 children: [ { path: 'menuList', name: 'menuListCancel', code: '0801', component: () => import('@/views/systemSetting/menuList'), meta: { code: '0801', seq: 0, title: '菜单管理', icon: '', keepAlive: true } }, { path: 'reportList', name: 'reportListCancel', code: '0802', component: () => import('@/views/systemSetting/encodingRules'), meta: { code: '0802', seq: 0, title: '编码规则', icon: '', keepAlive: true } } ] } ] const createRouter = () => new Router({ // mode: 'history', // require service support scrollBehavior: () => ({ y: 0 }), routes: commonRoutes }) 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