|
|
|
import Vue from 'vue'
|
|
|
|
import Router from 'vue-router'
|
|
|
|
/* Layout */
|
|
|
|
import Layout from '@/layout'
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
// 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
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
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
|