2026-08-28 15:06:01 +08:00
|
|
|
import { createRouter, createWebHistory } from 'vue-router'
|
|
|
|
|
import MainLayout from '../layouts/MainLayout.vue'
|
|
|
|
|
|
|
|
|
|
const routes = [
|
|
|
|
|
{ path: '/login', name: 'Login', component: () => import('../pages/Login.vue'), meta: { title: '登录' } },
|
|
|
|
|
// 免登录大屏:全屏无侧栏
|
|
|
|
|
{ path: '/display', name: 'Display', component: () => import('../pages/Display.vue'), meta: { title: '库存大屏' } },
|
|
|
|
|
{
|
|
|
|
|
path: '/',
|
|
|
|
|
component: MainLayout,
|
|
|
|
|
children: [
|
2026-09-03 14:20:37 +08:00
|
|
|
{ path: '', name: 'Dashboard', component: () => import('../pages/Dashboard.vue'), meta: { title: '工作台', keepAlive: true, componentName: 'Dashboard' } },
|
|
|
|
|
{ path: 'inbound', name: 'Inbound', component: () => import('../pages/Inbound.vue'), meta: { title: '入库管理', keepAlive: true, componentName: 'Inbound' } },
|
2026-10-05 20:15:38 +08:00
|
|
|
{ path: 'finished-inbound', name: 'FinishedInbound', component: () => import('../pages/FinishedInbound.vue'), meta: { title: '成品入库', keepAlive: true, componentName: 'FinishedInbound' } },
|
2026-09-03 14:20:37 +08:00
|
|
|
{ path: 'outbound', name: 'Outbound', component: () => import('../pages/Outbound.vue'), meta: { title: '出库管理', keepAlive: true, componentName: 'Outbound' } },
|
2026-09-15 16:37:39 +08:00
|
|
|
{ path: 'return-order', name: 'ReturnOrder', component: () => import('../pages/ReturnOrder.vue'), meta: { title: '退库确认', keepAlive: true, componentName: 'ReturnOrder' } },
|
2026-09-03 14:20:37 +08:00
|
|
|
{ path: 'inventory', name: 'Inventory', component: () => import('../pages/Inventory.vue'), meta: { title: '库存查询', keepAlive: true, componentName: 'Inventory' } },
|
2026-09-10 16:59:15 +08:00
|
|
|
{ path: 'inspection-incoming', name: 'InspectionIncoming', component: () => import('../pages/Inspection.vue'), meta: { title: '来料检验', keepAlive: true, componentName: 'InspectionIncoming', inspectionType: 'incoming' } },
|
2026-09-03 14:20:37 +08:00
|
|
|
{ path: 'stocktake', name: 'Stocktake', component: () => import('../pages/Stocktake.vue'), meta: { title: '库存盘点', keepAlive: true, componentName: 'Stocktake' } },
|
2026-09-04 14:18:53 +08:00
|
|
|
{ path: 'semi', name: 'Semi', component: () => import('../pages/Semi.vue'), meta: { title: '半成品管理', keepAlive: true, componentName: 'Semi' } },
|
|
|
|
|
{ path: 'ledger', name: 'Ledger', component: () => import('../pages/Ledger.vue'), meta: { title: '工单备料台账', keepAlive: true, componentName: 'Ledger' } },
|
|
|
|
|
{ path: 'agv', name: 'Agv', component: () => import('../pages/Agv.vue'), meta: { title: 'AGV配送', keepAlive: true, componentName: 'Agv' } },
|
2026-09-03 14:20:37 +08:00
|
|
|
{ path: 'zone', name: 'Zone', component: () => import('../pages/BaseData.vue'), props: { mode: 'zone' }, meta: { title: '区域维护', keepAlive: true, componentName: 'BaseData' } },
|
|
|
|
|
{ path: 'material', name: 'Material', component: () => import('../pages/BaseData.vue'), props: { mode: 'material' }, meta: { title: '物料档案', keepAlive: true, componentName: 'BaseData' } },
|
2026-09-02 14:54:54 +08:00
|
|
|
{ path: 'change-password', name: 'ChangePassword', component: () => import('../pages/ChangePassword.vue'), meta: { title: '修改密码' } },
|
2026-09-03 14:20:37 +08:00
|
|
|
{ path: 'users', name: 'UserManage', component: () => import('../pages/UserManage.vue'), meta: { title: '账号管理', keepAlive: true, componentName: 'UserManage' } },
|
2026-09-04 14:18:53 +08:00
|
|
|
{ path: 'roles', name: 'RoleManage', component: () => import('../pages/RoleManage.vue'), meta: { title: '角色管理', keepAlive: true, componentName: 'RoleManage' } },
|
2026-09-19 10:54:15 +08:00
|
|
|
{ path: 'event-log', name: 'EventLog', component: () => import('../pages/EventLog.vue'), meta: { title: '操作日志', keepAlive: true, componentName: 'EventLog' } },
|
|
|
|
|
{ path: 'attachment', name: 'AttachmentCenter', component: () => import('../pages/AttachmentCenter.vue'), meta: { title: '附件中心', keepAlive: true, componentName: 'AttachmentCenter' } }
|
2026-08-28 15:06:01 +08:00
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{ path: '/:pathMatch(.*)*', redirect: '/' }
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
const router = createRouter({
|
|
|
|
|
history: createWebHistory(),
|
|
|
|
|
routes
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 路由守卫:除 /login 和 /display 外校验 token
|
|
|
|
|
router.beforeEach((to) => {
|
|
|
|
|
if (to.path !== '/login' && to.path !== '/display' && !to.path.startsWith('/display')) {
|
|
|
|
|
if (!localStorage.getItem('token')) {
|
|
|
|
|
return { path: '/login', query: to.fullPath ? { redirect: to.fullPath } : {} }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
router.afterEach((to) => {
|
2026-09-07 15:26:37 +08:00
|
|
|
document.title = to.meta?.title ? `${to.meta.title} - WMS库房管理` : 'WMS库房管理'
|
2026-08-28 15:06:01 +08:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
export default router
|