1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- import { createRouter, createWebHistory, RouteRecordRaw, createWebHashHistory, Router } from 'vue-router';
- import { useStore } from 'vuex';
- import appSetting from '@/app-setting';
- import HomeView from '../views/index.vue';
- const constantRouterMap: RouteRecordRaw[] = [
- { path: '/login', component: () => import('@/views/auth/boxed-signin.vue'), meta: { layout: 'auth' } },
- ];
- const router = createRouter({
- history: createWebHashHistory(),
- scrollBehavior: () => ({ y: 0 }),
- routes: constantRouterMap
- })
- const asyncRouterMap: RouteRecordRaw[] = [
- {
- path: '/',
- redirect: '/dashboard',
- name: 'dashboard',
- children: [
- { path: 'dashboard', component: () => import('@/views/index.vue'), name: 'dashboard', meta: { title: 'home', icon: 'dashboard', layout: 'app' } }
- ]
- },
- {
- path: '/stock',
- redirect: '/stock',
- name: 'stock',
- children: [
- { path: 'warehouseList', component: () => import('@/views/stock/warehouseList.vue'), name: 'warehouseList', meta: { title: 'warehouseList', layout: 'app' } },
- { path: 'goodsLend', component: () => import('@/views/stock/goodsLend.vue'), name: 'goodsLend', meta: { title: 'goodsLend', layout: 'app' } },
- { path: 'goodsTransfer', component: () => import('@/views/stock/goodsTransfer.vue'), name: 'goodsTransfer', meta: { title: 'goodsTransfer', layout: 'app' } },
- { path: 'goodsExchange', component: () => import('@/views/stock/warehousing.vue'), name: 'goodsExchange', meta: { title: 'goodsExchange' } },
- { path: 'goodsOutBound', component: () => import('@/views/stock/outbound.vue'), name: 'goodsOutBound', meta: { title: 'goodsOutBound' } },
- ]
- },
- // 系统管理
- {
- path: '/package',
- redirect: '/package',
- name: 'package',
- children: [
- { path: 'packageList', component: () => import('@/views/package/packageList.vue'), name: 'packageList', meta: { title: 'packageList',layout: 'app' } },
- { path: 'packagePermissions', component: () => import('@/views/package/packagePermissions.vue'), name: 'packagePermissions', meta: { title: 'packagePermissions',layout: 'app' } },
- { path: 'packageAdd', component: () => import('@/views/package/packageAdd.vue'), name: 'packageAdd', meta: { title: 'packageAdd',layout: 'app' } },
- ]
- },
- // 系统管理
- {
- path: '/setting',
- redirect: '/setting',
- name: 'setting',
- meta: {
- title: 'setting',
- icon: 'setting-manage'
- },
- children: [
- { path: 'company', component: () => import('@/views/setting/company.vue'), name: 'company', meta: { title: 'company',layout: 'app' } },
- { path: 'roleManage', component: () => import('@/views/setting/roleManage.vue'), name: 'roleManage', meta: { title: 'roleManage',layout: 'app' } },
- { path: 'roleManageAdd', component: () => import('@/views/setting/roleManageAdd.vue'), name: 'roleManageAdd', meta: { title: 'roleManageAdd',layout: 'app' } },
- ]
- },
- ]
- asyncRouterMap.forEach(route => {
- router.addRoute(route);
- });
- /* router.beforeEach((to, from, next) => {package
- const store = useStore();
- //判断当前页面是否带有侧边栏及顶部
- if (to?.meta?.layout == 'auth') {
- store.dispatch("setMainLayout",'auth');
- } else {
- store.dispatch("setMainLayout",'app');
- }
- next(true);
- }); */
- export { constantRouterMap, asyncRouterMap };
- export default router;
|