import { createRouter, createWebHashHistory } from 'vue-router' import HomeView from '@/views/HomeView.vue' import login from '@/views/login.vue' import systemCenter from'@/views/SystemCenter.vue' const routes = [ { path: '/home', name: 'home', component: HomeView, redirect: '/stock', children: [ { path: '/stock', component: () => import('@/layout/stock.vue')},// 库存 { path: '/goodsIn', component: () => import('@/layout/goodsIn.vue') },// 入库 { path: '/goodsOut', component: () => import('@/layout/goodsOut.vue') },// 出库 { path: '/kitting', component: () => import('@/layout/kitting.vue') },// 配料 { path: '/inTaskRecord', component: () => import('@/layout/inTaskRecord.vue') },// 入库记录 { path: '/outTaskRecord', component: () => import('@/layout/outTaskRecord.vue') },// 出库记录 { path: '/location', component: () => import('@/layout/locationsTable.vue') },// 库位 { path: '/goods', component: () => import('@/layout/goods.vue') },// 物料 { path: '/standSettings', component: () => import('@/layout/standSettings.vue') },// 站台(库口)设置 { path: '/config', component: () => import('@/layout/wmsConfigNew.vue') },// 系统配置 { path: '/taskMonitor', component: () => import('@/layout/taskMonitor.vue') },// 任务监控 { path: '/vehicles', component: () => import('@/layout/vehicle.vue') },// 料箱监控 { path: '/inventory', component: () => import('@/layout/inventory.vue') },// 盘点 { path: '/inventoryRecord', component: () => import('@/layout/inventoryRecord.vue') },// 盘点记录 { path: '/wmsLog', component: () => import('@/layout/wmsLog.vue') },// 日志 { path: '/workFlow', component: () => import('@/layout/workFlow.vue') },// 工作流 { path: '/workSummary', component: () => import('@/layout/workSummary.vue') },// 工作总结 { path: '/pickTask', component: () => import('@/layout/pickTaskMonitor.vue') },// 拣选任务 { path: '/clcKanban', component: () => import('@/layout/clcKanban.vue') },// 需求看板 { path: '/stockUpdateRecord', component: () => import('@/layout/stockUpdateRecord.vue') },// 库存更新记录 { path: '/roleUser', component: () => import('@/layout/role_user.vue') },// 角色——用户列表 { path: '/rolePermission', component: () => import('@/layout/role_permission.vue') },// 角色——权限列表 { path: '/test', component: () => import('@/layout/testView.vue') },// 测试 { path: '/dbsList', component: () => import('@/layout/dbsList.vue') },// dbs计划 { path: '/kittingList', component: () => import('@/layout/kittingList.vue') },// 配料单 { path: '/kittingRelation', component: () => import('@/layout/kittingRelation.vue') },// 配料单 ] }, { path: '/', name: 'login', component: login }, { path: '/systemCenter', name: 'systemCenter', component: systemCenter }, { path: '/imageDisplay', name: 'imageDisplay', component: () => import('@/layout/imageDisplay.vue') }, { path: '/imageTable', name: 'imageTable', component: () => import('@/layout/imageTable.vue') }, { path: '/scanForImage', name: 'scanForImage', component: () => import('@/layout/scanForImage.vue') } ] const router = createRouter({ base: '/', history: createWebHashHistory(), routes }) // 挂载路由导航守卫 router.beforeEach((to, from, next) => { if (to.path === '/') return next() // 获取token const user = sessionStorage.getItem('user') if (!user) return next('/') next() }) export default router