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: 'login' }, { path: '/login', component: () => import('@/views/login/login.vue') }, // { // path: '/', // redirect: 'index' // }, // { // path: '/index', // component: () => import('@/views/index.vue'), // name: 'index' // }, { path: '/index', component: Layout, redirect: '/index', children: [{ path: '/index', component: () => import('@/views/index.vue'), name: 'index', meta: { title: '主页', noCache: true, affix: true } }] }, { path: '/inventory', component: Layout, redirect: '/inventory', meta: { title: '库存查询' }, children: [ { path: '/inventory/inventory', component: () => import('@/views/inventory/inventory.vue'), name: 'Inventory', meta: { title: '库存查询', noCache: true } } ] }, { path: '/storageage', component: Layout, redirect: '/storageage', meta: { title: '库龄查询' }, children: [ { path: '/storageage/storageage', component: () => import('@/views/storageage/storageage.vue'), name: 'StorageAge', meta: { title: '库龄查询', noCache: true } } ] }, { path: '/carryover', component: Layout, redirect: '/carryover', meta: { title: '结转查询' }, children: [ { path: '/carryover/carryforwardrecord', component: () => import('@/views/carryover/carryforwardrecord.vue'), name: 'CarryForwardRecord', meta: { title: '结转记录查询', noCache: true } }, { path: '/carryover/carryoverstock', component: () => import('@/views/carryover/carryoverstock.vue'), name: 'CarryoverStock', meta: { title: '结转库存查询', noCache: true } } ] }, { path: '/baseInfo', component: Layout, redirect: null, meta: { title: '基础信息' }, children: [ { path: 'warehouse', name: 'warehouse', component: () => import('@/views/baseInfo/warehouse/index'), meta: { title: '仓库管理', icon: 'product-add' }, hidden: true }, { path: 'warehouseArea', name: 'warehouseArea', component: () => import('@/views/baseInfo/warehouseArea/index'), meta: { title: '库区管理', icon: 'product-add' }, hidden: true }, { path: 'warehouseAreaType', name: 'warehouseAreaType', component: () => import('@/views/baseInfo/warehouseAreaType/index'), meta: { title: '库区类型管理', icon: 'product-add' }, hidden: true }, { path: 'goodsShelves', name: 'goodsShelves', component: () => import('@/views/baseInfo/goodsShelves/index'), meta: { title: '库位管理', icon: 'product-add' }, hidden: true } ] }, { path: '/warehouse', component: Layout, redirect: null, meta: { title: '库存信息' }, children: [ { path: 'inOutStorage', name: 'inOutStorage', component: () => import('@/views/warehouse/inOutStorage/index'), meta: { title: '出入库查询', icon: 'product-add' } }, { path: 'inStorage', name: 'inStorage', component: () => import('@/views/warehouse/inStorage/index'), meta: { title: '入库管理', icon: 'product-add' }, hidden: true }, { path: 'reservationInStorage', name: 'reservationInStorage', component: () => import('@/views/warehouse/reservationInStorage/index'), meta: { title: '预约入库', icon: 'product-add' }, hidden: true }, { path: 'outStorage', name: 'outStorage', component: () => import('@/views/warehouse/outStorage/index'), meta: { title: '出库管理', icon: 'product-add' }, hidden: true }, // { // path: 'distribution', // name: 'distribution', // component: () => import('@/views/warehouse/distribution/index'), // meta: { // title: '配货管理', // icon: 'product-add' // }, // hidden: true // }, { path: 'inventory', name: 'inventory', component: () => import('@/views/warehouse/inventory/index'), meta: { title: '库存查询', icon: 'product-add' } }, { path: 'stocktaking', name: 'stocktaking', component: () => import('@/views/warehouse/stocktaking/index'), meta: { title: '盘点管理', icon: 'product-add' } }, { path: 'allocation', name: 'allocation', component: () => import('@/views/warehouse/allocation/index'), meta: { title: '调拨管理', icon: 'product-add' } }, { path: 'deliveryNotice', name: 'deliveryNotice', component: () => import('@/views/deliveryNotice/index'), meta: { title: '到货单管理', icon: 'product-add' } }, { path: 'receivingGoods', name: 'receivingGoods', component: () => import('@/views/receivingGoods/index'), meta: { title: '收货单管理', icon: 'product-add' } }, { path: 'upShelf', name: 'upShelf', component: () => import('@/views/upShelf/index'), meta: { title: '上架单管理', icon: 'product-add' } }, { path: 'oldPartsFactory', name: 'oldPartsFactory', component: () => import('@/views/warehouse/oldPartsFactory/index'), meta: { title: '旧件返厂', icon: 'product-add' } }, { path: 'oldPartsCope', name: 'oldPartsCope', component: () => import('@/views/warehouse/oldPartsCope/index'), meta: { title: '旧件处理', icon: 'product-add' } }, { path: 'oldPartsRecovery', name: 'oldPartsRecovery', component: () => import('@/views/warehouse/oldPartsRecovery/index'), meta: { title: '旧件回收', icon: 'product-add' } }, { path: 'oldPartsInStorage', name: 'oldPartsInStorage', component: () => import('@/views/warehouse/oldPartsInStorage/index'), meta: { title: '旧件入库', icon: 'product-add' } }, { path: 'oldPartsInvertory', name: 'oldPartsInvertory', component: () => import('@/views/warehouse/oldPartsInvertory/index'), meta: { title: '旧件库存', icon: 'product-add' } }, { path: 'oldPartsInAndOutStorage', name: 'oldPartsInAndOutStorage', component: () => import('@/views/warehouse/oldPartsInAndOutStorage/index'), meta: { title: '旧件出入库查询', icon: 'product-add' } }, ] }, ...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