import Vue from 'vue' import Router from 'vue-router' /* Layout */ import Layout from '@/layout' // import codemenu from './codemenu.js' Vue.use(Router) /* 所有角色可以访问/没有权限要求的基页 */ export const constantRoutes = [{ path: '/redirect', component: Layout, hidden: true, children: [{ path: '/redirect/:path(.*)', component: () => import('@/views/redirect/index.vue') }] }, { path: '/', redirect: 'index' }, { path: '/login', component: () => import('@/views/login/login.vue') }, { path: '/home', component: () => import('@/views/Home/Home.vue'), name: 'home' }, { path: '/index', component: Layout, redirect: '/index', meta: { title: '首页' }, children: [{ path: '/index', component: () => import('@/views/index.vue'), name: 'index', meta: { title: '主页', noCache: true, affix: true } }] }, // 客户中心 { path: '/customer', component: Layout, meta: { title: '客户中心' }, children: [{ path: 'cgsq', component: () => import('@/views/customer/index.vue'), meta: { title: '采购申请' }, children: [{ path: 'kfpurchaserequisitionAdd', component: () => import('@/views/supervise/kfpurchaserequisition/kfpurchaserequisitionAdd.vue'), name: 'KfPurchaseRequisitionAdd', meta: { title: '采购订单上传', noCache: true } }, { path: 'kfpurchaserequisitionInfo', component: () => import('@/views/supervise/kfpurchaserequisition/kfpurchaserequisitionInfo.vue'), name: 'KfPurchaseRequisitionInfo', meta: { title: '采购申请回执', noCache: true } }] }, { path: 'crksq', component: () => import('@/views/customer/index.vue'), meta: { title: '出入库申请' }, children: [{ path: 'rksq', component: () => import('@/views/xiaoshou/xstj/tj.vue'), name: 'KfPurchaseRequisitionAdd', meta: { title: '入库申请', noCache: true } }, { path: 'cksq', component: () => import('@/views/xiaoshou/xstj/tj.vue'), name: 'KfPurchaseRequisitionInfo', meta: { title: '出库申请', noCache: true } }] }, { path: 'sjsb', component: () => import('@/views/customer/index.vue'), meta: { title: '数据上报' }, children: [{ path: 'rkmxsq', component: () => import('@/views/xiaoshou/xstj/tj.vue'), name: 'KfPurchaseRequisitionAdd', meta: { title: '入库明细上传', noCache: true } }, { path: 'xsbbsq', component: () => import('@/views/xiaoshou/xstj/tj.vue'), name: 'KfPurchaseRequisitionInfo', meta: { title: '销售报表上传', noCache: true } }] }, { path: 'gysgl', component: () => import('@/views/customer/index.vue'), meta: { title: '供应商管理' }, children: [{ path: 'xzgys', component: () => import('@/views/supervise/supplierbankinfo/supplierbankinfo.vue'), name: 'SupplierBankInfoIndex', meta: { title: '新增供应商', noCache: true } }, { path: 'htsq', component: () => import('@/views/xiaoshou/xstj/tj.vue'), name: 'KfPurchaseRequisitionInfo', meta: { title: '合同上传', noCache: true } }] }] }, // 1销售统计 { path: '/xiaoshou', component: Layout, meta: { title: '销售统计' }, children: [{ path: 'xstj/index', component: () => import('@/views/xiaoshou/xstj/index.vue'), name: 'XiaoshouXstjIndex', meta: { title: '销售数据导入', noCache: true } }, { path: 'xstj/tj', component: () => import('@/views/xiaoshou/xstj/tj.vue'), name: 'XiaoshouXstjTj', meta: { title: '销售数据统计', noCache: true } }] }, // 2库存信息 { path: '/kucun', component: Layout, meta: { title: '库存信息' }, children: [{ path: 'kcxxcx', component: () => import('@/views/kucun/kcxxcx/index.vue'), name: 'KucunKcxxcxIndex', meta: { title: '库存数据导入', noCache: true } }, { path: 'rkmx', component: () => import('@/views/kucun/rkmx/index.vue'), name: 'KucunRkmxIndex', meta: { title: '入库明细', noCache: true } }, { path: 'ckmx', component: () => import('@/views/kucun/ckmx/index.vue'), name: 'KucunCkmxIndex', 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