|
|
|
|
import Vue from 'vue'
|
|
|
|
|
import VueRouter from 'vue-router'
|
|
|
|
|
|
|
|
|
|
// const files = require.context('@/views', true, /-router\.js$/)
|
|
|
|
|
// let allRouter = [];
|
|
|
|
|
// // 匹配成功的名字数组
|
|
|
|
|
// files.keys().map(key => {
|
|
|
|
|
// allRouter = allRouter.concat(files(key).default)
|
|
|
|
|
// })
|
|
|
|
|
// allRouter.sort((a, b) => {
|
|
|
|
|
// return a.meta.sort - b.meta.sort
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
|
|
// console.log(allRouter)
|
|
|
|
|
|
|
|
|
|
Vue.use(VueRouter)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 避免冗余导航 (重复点击菜单栏报错问题)
|
|
|
|
|
const originalPush = VueRouter.prototype.push
|
|
|
|
|
VueRouter.prototype.push = function push(location) {
|
|
|
|
|
return originalPush.call(this, location).catch(err => err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const routes = [{
|
|
|
|
|
path: '/',
|
|
|
|
|
redirect: {
|
|
|
|
|
name: 'realTimeMonitoring'
|
|
|
|
|
},
|
|
|
|
|
component: () => import('@/views/index'),
|
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
path: 'videoWall',
|
|
|
|
|
name: 'videoWall',
|
|
|
|
|
meta: {
|
|
|
|
|
icon: 'desktop',
|
|
|
|
|
name: '视频墙'
|
|
|
|
|
},
|
|
|
|
|
component: () => import('@/views/videoWall/index'),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'realTimeMonitoring',
|
|
|
|
|
name: 'realTimeMonitoring',
|
|
|
|
|
meta: {
|
|
|
|
|
icon: 'desktop',
|
|
|
|
|
name: '实时视频流'
|
|
|
|
|
},
|
|
|
|
|
component: () => import('@/views/realTimeMonitoring/index'),
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
path: 'historyMonitoring',
|
|
|
|
|
name: 'historyMonitoring',
|
|
|
|
|
meta: {
|
|
|
|
|
icon: 'line-chart',
|
|
|
|
|
name: '历史数据'
|
|
|
|
|
},
|
|
|
|
|
component: () => import('@/views/historyMonitoring/index')
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'alarmLog',
|
|
|
|
|
name: 'alarmLog',
|
|
|
|
|
meta: {
|
|
|
|
|
icon: 'exception',
|
|
|
|
|
name: '告警日志'
|
|
|
|
|
},
|
|
|
|
|
component: () => import('@/views/alarmVideos/alarmLog')
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'checkManage',
|
|
|
|
|
name: 'checkManage',
|
|
|
|
|
meta: {
|
|
|
|
|
icon: 'form',
|
|
|
|
|
name: '盘点管理',
|
|
|
|
|
},
|
|
|
|
|
component: () => import('@/views/checkManage/index'),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'checkOperation',
|
|
|
|
|
name: 'checkOperation',
|
|
|
|
|
meta: {
|
|
|
|
|
name: '盘点操作'
|
|
|
|
|
},
|
|
|
|
|
component: () => import('@/views/checkManage/checkOperation'),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'roadwayManage',
|
|
|
|
|
name: 'roadwayManage',
|
|
|
|
|
meta: {
|
|
|
|
|
icon: 'build',
|
|
|
|
|
name: '巷道管理'
|
|
|
|
|
},
|
|
|
|
|
component: () => import('@/views/roadwayManage/index')
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'cameraManage',
|
|
|
|
|
name: 'cameraManage',
|
|
|
|
|
meta: {
|
|
|
|
|
icon: 'video-camera',
|
|
|
|
|
name: '球机管理'
|
|
|
|
|
},
|
|
|
|
|
component: () => import('@/views/cameraManage/index')
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'cameraManage/model',
|
|
|
|
|
name: 'cameraManageModel',
|
|
|
|
|
meta: {
|
|
|
|
|
name: '球机管理测试or配置'
|
|
|
|
|
},
|
|
|
|
|
component: () => import('@/views/cameraManage/model')
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'productSpecManage',
|
|
|
|
|
name: 'productSpecManage',
|
|
|
|
|
meta: {
|
|
|
|
|
icon: 'pushpin',
|
|
|
|
|
name: '品规管理'
|
|
|
|
|
},
|
|
|
|
|
component: () => import('@/views/productSpecManage/index')
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'repertoryManage',
|
|
|
|
|
name: 'repertoryManage',
|
|
|
|
|
meta: {
|
|
|
|
|
icon: 'wallet',
|
|
|
|
|
name: '库存管理'
|
|
|
|
|
},
|
|
|
|
|
component: () => import('@/views/repertoryManage/index')
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
path: 'cameraManage/ioTable',
|
|
|
|
|
name: 'ioTable',
|
|
|
|
|
meta: {
|
|
|
|
|
name: 'IO表配置'
|
|
|
|
|
},
|
|
|
|
|
component: () => import('@/views/cameraManage/ioTable')
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'center',
|
|
|
|
|
name: 'center',
|
|
|
|
|
meta: {
|
|
|
|
|
name: '个人中心'
|
|
|
|
|
},
|
|
|
|
|
component: () => import('@/views/center')
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'plcStatus',
|
|
|
|
|
name: 'plcStatus',
|
|
|
|
|
meta: {
|
|
|
|
|
name: 'PLC状态'
|
|
|
|
|
},
|
|
|
|
|
component: () => import('@/views/plcStatus')
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: '/login',
|
|
|
|
|
name: 'login',
|
|
|
|
|
component: () => import('../views/login.vue')
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: '/guide',
|
|
|
|
|
name: 'guide',
|
|
|
|
|
component: () => import('../views/guide.vue')
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: '/updateStyles',
|
|
|
|
|
name: '修改样式',
|
|
|
|
|
component: () => import('../views/updateStyles/index')
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
path: '*',
|
|
|
|
|
name: '404',
|
|
|
|
|
component: () => import('../views/404.vue')
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
const router = new VueRouter({
|
|
|
|
|
routes
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
router.beforeEach((to, from, next) => {
|
|
|
|
|
next()
|
|
|
|
|
// let userInfo = JSON.parse(sessionStorage.getItem('userInfo') || '{}')
|
|
|
|
|
// // 校验是否登录
|
|
|
|
|
// if (userInfo.id) {
|
|
|
|
|
// // 匹配不到 404
|
|
|
|
|
// if (!to.name) next();
|
|
|
|
|
// // 权限
|
|
|
|
|
// if (userInfo.permissionList.some((item) => {
|
|
|
|
|
// return item.rights === to.name
|
|
|
|
|
// })) {
|
|
|
|
|
// next()
|
|
|
|
|
// } else {
|
|
|
|
|
// if (to.name === 'login') {
|
|
|
|
|
// next()
|
|
|
|
|
// } else {
|
|
|
|
|
// Vue.prototype.$message.info('没有权限')
|
|
|
|
|
// next(false)
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// if (to.name === 'login') {
|
|
|
|
|
// next()
|
|
|
|
|
// } else if (to.name !== 'login') {
|
|
|
|
|
// Vue.prototype.$message.info('请先登录')
|
|
|
|
|
// next('/login')
|
|
|
|
|
// } else {
|
|
|
|
|
// next('/login')
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
export default router
|