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 commonRoutes = [ { 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: '系统首页', code: '1000', children: [{ path: 'index', name: 'index', component: () => import('@/views/xtsy/index'), meta: { title: '系统首页', icon: 'home', affix: true } }] }, { path: '/jcsz', component: Layout, redirect: '/jcsz/zzjg', name: '基础设置', code: '1001', meta: { title: '基础设置', icon: 'tree' }, children: [ { path: 'zzjg', name: '组织架构', code: '1010', component: () => import('@/views/jcsz/zzjg'), meta: { title: '组织架构', icon: '' } }, { path: 'yhqd', name: '用户清单', code: '1011', component: () => import('@/views/jcsz/yhqd'), meta: { title: '用户清单', icon: '' } }, { path: 'jsqd', name: '角色清单', code: '1012', component: () => import('@/views/jcsz/jsqd'), meta: { title: '角色清单', icon: '' } }, { path: 'wldw', name: '往来单位', code: '1013', component: () => import('@/views/jcsz/wldw'), meta: { title: '往来单位', icon: '' } }, { path: 'adsz', name: '安灯设置', code: '1014', component: () => import('@/views/jcsz/adsz'), meta: { title: '安灯设置', icon: '' } } ] }, { path: '/sbgl', component: Layout, redirect: '/sbgl/sblx', name: '设备管理', code: '1002', meta: { title: '设备管理', icon: 'example' }, children: [ { path: 'sblx', name: '设备类型', code: '1020', component: () => import('@/views/sbgl/sblx'), meta: { title: '设备类型', icon: '' } }, { path: 'wxjl', code: '1029', name: '维修记录', component: () => import('@/views/sbgl/wxjl'), meta: { title: '维修记录', icon: '' } }, { path: 'sbz', name: '设备组', code: '1021', component: () => import('@/views/sbgl/sbz'), meta: { title: '设备组', icon: '' } }, { path: 'sbqd', name: '设备清单', code: '1022', component: () => import('@/views/sbgl/sbqd'), meta: { title: '设备清单', icon: '' } }, { path: 'djbz', name: '点检标准', code: '1023', component: () => import('@/views/sbgl/djbz'), meta: { title: '点检标准', icon: '' } }, { path: 'djbw', name: '点检部位', code: '1024', component: () => import('@/views/sbgl/djbw'), meta: { title: '点检部位', icon: '' } }, { path: 'bybz', name: '保养标准', code: '1025', component: () => import('@/views/sbgl/bybz'), meta: { title: '保养标准', icon: '' } }, { path: 'bybw', name: '保养部位', code: '1026', component: () => import('@/views/sbgl/bybw'), meta: { title: '保养部位', icon: '' } }, { path: 'djjl', name: '点检记录', code: '1027', component: () => import('@/views/sbgl/djjl'), meta: { title: '点检记录', icon: '' } }, { path: 'byjl', name: '保养记录', code: '1028', component: () => import('@/views/sbgl/byjl'), meta: { title: '保养记录', icon: '' } } ] }, { path: '/gzgl', component: Layout, redirect: '/gzgl/gzlx', name: '工装管理', code: '1003', meta: { title: '工装管理', icon: 'component' }, children: [ { path: 'gzlx', name: '工装类型', code: '1030', component: () => import('@/views/gzgl/gzlx'), meta: { title: '工装类型', icon: '' } }, { path: 'sjxj', name: '上机下机', code: '1039', component: () => import('@/views/gzgl/sjxj'), meta: { title: '上机下机', icon: '' } }, { path: 'ckrk', name: '出库入库', code: '1040', component: () => import('@/views/gzgl/ckrk'), meta: { title: '出库入库', icon: '' } }, { path: 'gzqd', name: '工装清单', code: '1031', component: () => import('@/views/gzgl/gzqd'), meta: { title: '工装清单', icon: '' } }, { path: 'djbz', name: '点检标准', code: '1032', component: () => import('@/views/gzgl/djbz'), meta: { title: '点检标准', icon: '' } }, { path: 'djbw', name: '点检部位', code: '1033', component: () => import('@/views/gzgl/djbw'), meta: { title: '点检部位', icon: '' } }, { path: 'bybz', name: '保养标准', code: '1034', component: () => import('@/views/gzgl/bybz'), meta: { title: '保养标准', icon: '' } }, { path: 'bybw', name: '保养部位', code: '1035', component: () => import('@/views/gzgl/bybw'), meta: { title: '保养部位', icon: '' } }, { path: 'djjl', name: '点检记录', code: '1036', component: () => import('@/views/gzgl/djjl'), meta: { title: '点检记录', icon: '' } }, { path: 'byjl', name: '保养记录', code: '1037', component: () => import('@/views/gzgl/byjl'), meta: { title: '保养记录', icon: '' } }, { path: 'gzwx', name: '工装维修', code: '1038', component: () => import('@/views/gzgl/gzwx'), meta: { title: '工装维修', icon: '' } } ] }, { path: '/wlgl', component: Layout, redirect: '/wlgl/ckdy', name: '物料管理', code: '1004', meta: { title: '物料管理', icon: 'table' }, children: [ { path: 'ckdy', name: '仓库定义', code: '1050', component: () => import('@/views/wlgl/ckdy'), meta: { title: '仓库定义', icon: '' } }, { path: 'kwdy', name: '库位定义', code: '1051', component: () => import('@/views/wlgl/kwdy'), meta: { title: '库位定义', icon: '' } }, { path: 'rqlx', name: '容器类型', code: '1052', component: () => import('@/views/wlgl/rqlx'), meta: { title: '容器类型', icon: '' } }, { path: 'rqqd', name: '容器清单', code: '1053', component: () => import('@/views/wlgl/rqqd'), meta: { title: '容器清单', icon: '' } }, { path: 'crkjl', name: '出入库记录', code: '1054', component: () => import('@/views/wlgl/crkjl'), meta: { title: '出入库记录', icon: '' } }, { path: 'kccx', name: '库存查询', code: '1055', component: () => import('@/views/wlgl/kccx'), meta: { title: '库存查询', icon: '' } } ] }, { path: '/zzmx', component: Layout, redirect: '/zzmx/gylx', name: '制造模型', code: '1005', meta: { title: '制造模型', icon: 'icu' }, children: [ { path: 'wllx', name: '物料类型', code: '1060', component: () => import('@/views/zzmx/wllx'), meta: { title: '物料类型', icon: '' } }, { path: 'chda', name: '存货档案', code: '1061', component: () => import('@/views/zzmx/chda'), meta: { title: '存货档案', icon: '' } }, { path: 'wlqd', name: '物料清单', code: '1062', component: () => import('@/views/zzmx/wlqd'), meta: { title: '物料清单', icon: '' } }, { path: 'gylx', name: '工艺路线', code: '1063', component: () => import('@/views/zzmx/gylx'), meta: { title: '工艺路线', icon: '' } }, { path: 'gxdy', name: '工序定义', code: '1064', component: () => import('@/views/zzmx/gxdy'), meta: { title: '工序定义', icon: '' } }, { path: 'jpgj', name: '节拍工价', code: '1065', component: () => import('@/views/zzmx/jpgj'), meta: { title: '节拍工价', icon: '' } } ] }, { path: '/scgl', component: Layout, redirect: '/scgl/scdd', name: '生产管理', code: '1006', meta: { title: '生产管理', icon: 'production' }, children: [ { path: 'scdd', name: 'ERP生产订单', code: '1070', component: () => import('@/views/scgl/scdd'), meta: { title: 'ERP生产订单', icon: '' } }, { path: 'gd', name: 'MES工单', code: '1071', component: () => import('@/views/scgl/gd'), meta: { title: 'MES工单', icon: '' } }, { path: 'gdpg', name: '工单派工', code: '1072', component: () => import('@/views/scgl/gdpg'), meta: { title: '工单派工', icon: '' } }, { path: 'sckbg', name: '生产开报工', code: '1073', component: () => import('@/views/scgl/sckbg'), meta: { title: '生产开报工', icon: '' } } ] }, { path: '/zlgl', component: Layout, redirect: '/zlgl/zjbz', name: '质量管理', code: '1007', meta: { title: '质量管理', icon: 'quality' }, children: [ { path: 'zjbz', name: '质检标准', code: '1080', component: () => import('@/views/zlgl/zjbz'), meta: { title: '质检标准', icon: '' } }, { path: 'qxdy', name: '缺陷定义', code: '1081', component: () => import('@/views/zlgl/qxdy'), meta: { title: '缺陷定义', icon: '' } }, { path: 'gxjy', name: '工序检验', code: '1082', component: () => import('@/views/zlgl/gxjy'), meta: { title: '工序检验', icon: '' } }, { path: 'wljy', name: '物流检验', code: '1083', component: () => import('@/views/zlgl/wljy'), meta: { title: '物流检验', icon: '' } }, { path: 'qxsj', name: '缺陷统计', code: '1084', component: () => import('@/views/zlgl/qxsj'), meta: { title: '缺陷统计', icon: '' } } ] }, { path: '/xtsz', component: Layout, redirect: '/xtsz/bmgz', name: '系统设置', code: '1009', meta: { title: '系统设置', icon: 'xtsz' }, children: [ { path: 'bmgz', name: '编码规则', code: '1101', component: () => import('@/views/xtsz/bmgz'), meta: { title: '编码规则', icon: '' } }, { path: 'mmxg', name: '密码修改', code: '1102', component: () => import('@/views/xtsz/mmxg'), meta: { title: '密码修改', icon: '' } }, { path: 'xtrz', name: '系统日志', code: '1103', component: () => import('@/views/xtsz/xtrz'), meta: { title: '系统日志', icon: '' } }, { path: 'sc', name: 'SOP上传', code: '1104', component: () => import('@/views/xtsz/sc'), meta: { title: 'SOP上传', icon: '' } } ] }, { path: '*', redirect: '/404', hidden: true } ] // export const constantRoutesxxxxxx = [ // // { // 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: '/dashboard', // children: [{ // path: 'dashboard', // name: 'Dashboard', // component: () => import('@/views/dashboard/index') // }] // }, // { // path: '/xtsy', // component: Layout, // redirect: '/stxy/index', // children: [ // { // path: 'index', // name: 'Form', // component: () => import('@/views/xtsy/index'), // meta: { title: '系统首页', icon: 'form', affix: true } // } // ] // }, // { // path: '/jcsz', // component: Layout, // redirect: '/jcsz/zzjg', // name: 'jcsz', // meta: { title: '基础设置', icon: 'el-icon-s-help' }, // children: [ // { // path: 'zzjg', // name: 'Table', // component: () => import('@/views/jcsz/zzjg'), // meta: { title: '组织架构', icon: 'table' } // }, // { // path: 'rwgl', // name: 'rwgl', // component: () => import('@/views/jcsz/rwgl'), // meta: { title: '任务管理', icon: 'tree' } // } // ] // }, // { // path: '/zzmx', // component: Layout, // redirect: '/zzmx/gylx', // name: 'zzmx', // meta: { title: '制造模型', icon: 'el-icon-s-help' }, // children: [ // { // path: 'gylx', // name: 'gylx', // component: () => import('@/views/zzmx/gylx'), // meta: { title: '公益路线', icon: 'table' } // }, // { // path: 'jpgj', // name: 'jpgj', // component: () => import('@/views/zzmx/jpgj'), // meta: { title: '节拍工价', icon: 'tree' } // } // ] // }, // // 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: 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