2024-05-14 16:31:23 +08:00
|
|
|
|
import { createRouter, createWebHashHistory } from 'vue-router'
|
|
|
|
|
|
|
|
|
|
|
|
const routes = [
|
|
|
|
|
|
{ path: '/', redirect: '/login' },
|
|
|
|
|
|
{ path: '/login', name: 'login', component: () => import('../view/page/LoginPage.vue') },
|
|
|
|
|
|
{
|
|
|
|
|
|
path: '/wcs',
|
|
|
|
|
|
name: 'wcs',
|
|
|
|
|
|
component: () => import('../view/page/ContentPage.vue'),
|
|
|
|
|
|
children: [
|
|
|
|
|
|
{ path: 'nullPage', name: 'nullPage', component:() => import('../view/page/NullPage.vue') },
|
|
|
|
|
|
// 系统状态
|
|
|
|
|
|
{ path: 'runningInfo', name: 'runningInfo', component:() => import('../view/tab/systemStatus/RunningInfo.vue') }, // 运行信息
|
|
|
|
|
|
{ path: 'stackerStatus', name: 'stackerStatus', component:() => import('../view/tab/systemStatus/StackerStatus.vue') }, // 堆垛机状态
|
|
|
|
|
|
{ path: 'conveyStatus', name: 'conveyStatus', component:() => import('../view/tab/systemStatus/ConveyStatus.vue') }, // 输送机状态
|
|
|
|
|
|
{ path: 'containerStatus', name: 'containerStatus', component:() => import('../view/tab/systemStatus/ContainerStatus.vue') }, // 智能货柜状态
|
|
|
|
|
|
{ path: 'shuttleStatus', name: 'shuttleStatus', component:() => import('../view/tab/systemStatus/ShuttleStatus.vue') }, // 穿梭车状态
|
|
|
|
|
|
// 任务管理
|
|
|
|
|
|
{ path: 'wmsTask', name: 'wmsTask', component:() => import('../view/tab/taskManage/WmsTask.vue') }, // Wms任务管理
|
|
|
|
|
|
{ path: 'wcsTask', name: 'wcsTask', component:() => import('../view/tab/taskManage/WcsTask.vue') }, // Wcs任务管理
|
2024-05-30 15:34:46 +08:00
|
|
|
|
{ path: 'elTagTask', name: 'elTagTask', component:() => import('../view/tab/taskManage/ElTagTask.vue') }, // 电子标签任务管理
|
2024-05-14 16:31:23 +08:00
|
|
|
|
// 设备管理
|
|
|
|
|
|
{ path: 'location', name: 'location', component:() => import('@/view/tab/equipmentManage/LocationData.vue') }, // 点位/库位管理
|
|
|
|
|
|
{ path: 'stackerData', name: 'stackerData', component:() => import('@/view/tab/equipmentManage/StackerData.vue') }, // 堆垛机管理
|
2024-06-15 13:55:26 +08:00
|
|
|
|
{path: 'elTagLocationData', name: 'elTagLocationData', component:() => import('@/view/tab/equipmentManage/ElTagLocationData.vue')}, // 电子标签货位管理
|
2024-05-14 16:31:23 +08:00
|
|
|
|
// 数据查询
|
|
|
|
|
|
{ path: 'apiAccept', name: 'apiAccept', component:() => import('../view/tab/dataQuery/ApiAccept.vue') }, // 接口接收记录
|
|
|
|
|
|
{ path: 'apiRequest', name: 'apiRequest', component:() => import('../view/tab/dataQuery/ApiRequest.vue') }, // 接口请求记录
|
|
|
|
|
|
{ path: 'errMsg', name: 'errMsg', component:() => import('../view/tab/dataQuery/ErrMsg.vue') }, // 设备异常信息
|
|
|
|
|
|
{ path: 'errMsgBase', name: 'errMsgBase', component:() => import('../view/tab/dataQuery/ErrMsgBase.vue') }, // 设备异常信息基础资料
|
|
|
|
|
|
// 系统管理
|
|
|
|
|
|
{ path: 'settingsData', name: 'settingsData', component:() => import('../view/tab/systemManage/SettingData.vue') }, // 系统设置
|
|
|
|
|
|
// 工具箱
|
|
|
|
|
|
{ path: 'printQRCode', name: 'printQRCode', component:() => import('../view/tab/tools/PrintQRCode.vue') }, // 二维码打印
|
|
|
|
|
|
// 账户管理
|
|
|
|
|
|
{ path: 'userMenuRule', name: 'userMenuRule', component:() => import('../view/tab/accountManage/UserMenuRule.vue') }, // 权限管理
|
|
|
|
|
|
{ path: 'userData', name: 'userData', component:() => import('../view/tab/accountManage/UserData.vue') }, // 用户管理
|
|
|
|
|
|
// 开发者选项
|
|
|
|
|
|
{ path: 'plcData', name: 'plcData', component:() => import('@/view/tab/development/PLCData.vue') }, // PLC管理
|
|
|
|
|
|
{ path: 'dbData', name: 'dbData', component:() => import('@/view/tab/development/DbData.vue') }, // PLC通讯管理(DB块)
|
|
|
|
|
|
{ path: 'configData', name: 'configData', component:() => import('@/view/tab/development/ConfigData.vue') }, // 系统配置
|
2024-05-27 08:50:44 +08:00
|
|
|
|
{ path: 'socketData', name: 'socketData', component:() => import('../view/tab/development/SocketData.vue') }, // Socket通讯管理
|
2024-05-14 16:31:23 +08:00
|
|
|
|
{ path: 'menuData', name: 'menuData', component:() => import('@/view/tab/development/MenuData.vue') }, // 菜单管理
|
|
|
|
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
},
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
const router = createRouter({
|
|
|
|
|
|
history: createWebHashHistory(),
|
|
|
|
|
|
routes
|
|
|
|
|
|
})
|
|
|
|
|
|
// 导航守卫
|
|
|
|
|
|
router.beforeEach((to, from, next) => {
|
|
|
|
|
|
// 登陆页和错误页允许访问
|
|
|
|
|
|
if(to.name === 'login' || to.name === 'limit') {
|
|
|
|
|
|
next()
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
// 校验用户是否登陆
|
|
|
|
|
|
const userName = window.sessionStorage.getItem("userName")
|
|
|
|
|
|
if(userName === undefined || userName === null || userName === '') {
|
|
|
|
|
|
next({name: 'login'})
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
// 校验是否访问不受限制的页面
|
|
|
|
|
|
if(to.name === 'wcs' || to.name === 'nullPage') {
|
|
|
|
|
|
next()
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
// 校验用户是否有菜单
|
|
|
|
|
|
const menuList = JSON.parse(window.sessionStorage.getItem("menuList"))
|
|
|
|
|
|
if(menuList === undefined || menuList === null || menuList.length === 0) {
|
|
|
|
|
|
next({name: 'login'})
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
// 校验用户访问的是不是其有权限访问的菜单
|
|
|
|
|
|
if(menuList.find(m => m.router === to.name) === undefined) {
|
|
|
|
|
|
console.log(to.name)
|
|
|
|
|
|
console.table(menuList)
|
|
|
|
|
|
next({name: 'login'})
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
next()
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
export default router
|