import Vue from 'vue' import Router from 'vue-router' Vue.use(Router) /* Layout */ import Layout from '@/layout' /* 所有角色可以访问/没有权限要求的基页 */ import codemenu from './modules/codemenu' export const constantRoutes = [{ path: '/redirect', component: Layout, hidden: true, children: [{ path: '/redirect/:path(.*)', component: () => import('@/views/redirect/index.vue') }] }, { path: '/', redirect: 'login' }, { path: '/login', component: () => import('@/views/login/login.vue') }, { path: '/home', component: () => import('@/views/Home/Home.vue'), name: 'home' }, { path: '/index', component: Layout, redirect: '/index', children: [{ path: '/index', component: () => import('@/views/index.vue'), name: 'index', meta: { title: '主页', noCache: true, affix: true } }] }, { path: '/baseInfo', component: Layout, redirect: null, meta: { title: '基础信息' }, children: [{ path: '/baseInfo/materialType', component: () => import('@/views/baseInfo/materialType/index.vue'), name: 'index', meta: { title: '原料类型' } }, { path: '/baseInfo/materialInfo', component: () => import('@/views/baseInfo/materialInfo/index.vue'), name: 'index', meta: { title: '原料信息' } },{ path: '/baseInfo/packagType', component: () => import('@/views/baseInfo/packagType/index.vue'), name: 'index', meta: { title: '包装物类型' } }, { path: '/baseInfo/packagInfo', component: () => import('@/views/baseInfo/packagInfo/index.vue'), name: 'index', meta: { title: '包装物信息' } }, { path: '/baseInfo/oilType', component: () => import('@/views/baseInfo/oilType/index.vue'), name: 'index', meta: { title: '原油类型' } }, { path: '/baseInfo/oilTank', component: () => import('@/views/baseInfo/oilTank/index.vue'), name: 'index', meta: { title: '油罐信息' } }, { path: '/baseInfo/flowInstrument', component: () => import('@/views/baseInfo/flowInstrument/index.vue'), name: 'index', meta: { title: '流量仪器' } }, { path: '/baseInfo/supplier', component: () => import('@/views/baseInfo/supplier/index.vue'), name: 'index', meta: { title: '供应商信息' } }, ] }, { path: '/supervise', component: Layout, redirect: null, meta: { title: '库房登记' }, children: [{ path: '/supervise/recordOilTank', component: () => import('@/views/supervise/recordOilTank/index.vue'), name: 'index', meta: { title: '油罐库存登记' } }, { path: '/supervise/oilTypeInBound', component: () => import('@/views/supervise/oilTypeInBound/index.vue'), name: 'index', meta: { title: '原油入库登记' } }, { path: '/supervise/oilTypeOutBound', component: () => import('@/views/supervise/oilTypeOutBound/index.vue'), name: 'index', meta: { title: '原油出库登记' } }, ] }, { path: '/inventory', component: Layout, redirect: null, meta: { title: '库存管理' }, children: [ { path: '/inventory/oilTankList', component: () => import('@/views/inventory/oilTankList/index.vue'), name: 'index', meta: { title: '油罐库存记录' } },{ path: '/inventory/oilTypeInBoundList', component: () => import('@/views/inventory/oilTypeInBoundList/index.vue'), name: 'index', meta: { title: '原油入库记录' } }, { path: '/inventory/oilTypeOutBoundList', component: () => import('@/views/inventory/oilTypeOutBoundList/index.vue'), name: 'index', meta: { title: '原油出库记录' } }, { path: '/inventory/oilTankInfo', component: () => import('@/views/inventory/oilTankInfo/index.vue'), name: 'index', meta: { title: '库存信息' } }, ] }, // { // path: 'rawMaterialType', // component: Layout, // redirect: '/rawMaterialType', // children: [{ // path: '/rawMaterialType/index', // component: () => import('@/views/rawMaterialType/index.vue'), // name: 'index', // meta: { // title: '原料类型', // noCache: true // } // }] // }, { // path: 'rawMaterialInfo', // component: Layout, // redirect: '/rawMaterialInfo', // children: [{ // path: '/rawMaterialInfo/index', // component: () => import('@/views/rawMaterialInfo/index.vue'), // name: 'index', // meta: { // title: '原料信息', // noCache: true // } // }] // }, // { // path: 'oilType', // component: Layout, // redirect: '/oilType', // children: [{ // path: '/oilType/index', // component: () => import('@/views/oilType/index.vue'), // name: 'index', // meta: { // title: '原油类型', // noCache: true // } // }] // }, { // path: 'oilTank', // component: Layout, // redirect: '/oilTank', // children: [{ // path: '/oilTank/index', // component: () => import('@/views/oilTank/index.vue'), // name: 'index', // meta: { // title: '油罐信息', // noCache: true // } // }] // }, { // path: 'flowInstrument', // component: Layout, // redirect: '/flowInstrument', // children: [{ // path: '/flowInstrument/index', // component: () => import('@/views/flowInstrument/index.vue'), // name: 'index', // meta: { // title: '流程仪器', // noCache: true // } // }] // }, { // path: 'oilTypeInAndOutBound', // component: Layout, // redirect: '/oilTypeInAndOutBound', // children: [{ // path: '/oilTypeInAndOutBound/index', // component: () => import('@/views/oilTypeInAndOutBound/index.vue'), // name: 'index', // meta: { // title: '原油出入库记录', // noCache: true // } // }] // }, { // path: 'rawMaterialInAndOutBound', // component: Layout, // redirect: '/rawMaterialInAndOutBound', // children: [{ // path: '/rawMaterialInAndOutBound/index', // component: () => import('@/views/rawMaterialInAndOutBound/index.vue'), // name: 'index', // meta: { // title: '原料出入库记录', // noCache: true // } // }] // }, ...codemenu, { path: '/404', component: () => import('@/views/404'), hidden: true } // 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