| | |
| | | import {createRouter, createWebHashHistory} from 'vue-router' |
| | | |
| | | // import i18n from '@/utils/lang' |
| | | // import User from '../views/sys/User.vue' |
| | | // import Role from '../views/sys/Role.vue' |
| | | // import Menu from '../views/sys/Menu.vue' |
| | | |
| | | const router = createRouter({ |
| | | history: createWebHashHistory(), |
| | | routes: [ |
| | |
| | | component: () => import('../views/LoginView.vue') |
| | | }, |
| | | { |
| | | path: '/new-page', // 新增的无需登录的页面 |
| | | name: 'newPage', |
| | | component: () => import('../views/NewPage.vue') |
| | | }, |
| | | { |
| | | path: '/main', |
| | | name: 'main', |
| | | component: () => import('../layout/MainErpView.vue'), |
| | | children:[ |
| | | |
| | | |
| | | { |
| | | path: 'Temperedlayout', |
| | | name: 'Temperedlayout', |
| | |
| | | } |
| | | ] |
| | | }, |
| | | |
| | | /*----------- 用户列表 ----------------*/ |
| | | // { |
| | | // path: 'User', |
| | | // name: 'User', |
| | | // component: () => import('../views/User/userlist.vue'), |
| | | // children:[ |
| | | // { |
| | | // path: '/User/userlist', |
| | | // name: 'userlist', |
| | | // component: () => import('../views/User/userlist.vue') |
| | | // }, |
| | | // ] |
| | | // }, |
| | | |
| | | /*----------- 权限列表 ----------------*/ |
| | | // { |
| | | // path: 'Permissions', |
| | | // name: 'Permissions', |
| | | // component: () => import('../views/Permissions/permissionslist.vue'), |
| | | // children:[ |
| | | // { |
| | | // path: '/Permissions/permissionslist', |
| | | // name: 'permissionslist', |
| | | // component: () => import('../views/Permissions/permissionslist.vue') |
| | | // }, |
| | | // ] |
| | | // }, |
| | | /*----------- 上片机 ----------------*/ |
| | | { |
| | | path: 'Returns', |
| | | name: 'Returns', |
| | | component: () => import('../views/Returns/returns.vue'), |
| | | name: 'return', |
| | | component: () => import('../views/Returns/return.vue'), |
| | | children:[ |
| | | { |
| | | path: '/Returns/returns', |
| | | name: 'returns', |
| | | component: () => import('../views/Returns/returns.vue') |
| | | path: '/Returns/upreturns', |
| | | name: 'upreturns', |
| | | component: () => import('../views/Returns/upreturns.vue') |
| | | }, |
| | | { |
| | | path: '/Returns/upreturns2', |
| | | name: 'upreturns2', |
| | | component: () => import('../views/Returns/upreturns2.vue') |
| | | } |
| | | ] |
| | | }, |
| | | /*----------- 掰片/识别 ----------------*/ |
| | | { |
| | | path: 'Identify', |
| | | name: 'Identify', |
| | | component: () => import('../views/Identify/identify.vue'), |
| | | children:[ |
| | | name: 'ident', |
| | | component: () => import('../views/Identify/ident.vue'), |
| | | children: [ |
| | | { |
| | | path: '/Identify/identify', |
| | | name: 'identify', |
| | | component: () => import('../views/Identify/identify.vue') |
| | | }, |
| | | { |
| | | path: '/Identify/identifwu', |
| | | name: 'identifwu', |
| | | component: () => import('../views/Identify/identifwu.vue') |
| | | }, |
| | | { |
| | | path: '/Identify/identifwutwo', |
| | | name: 'identifwutwo', |
| | | component: () => import('../views/Identify/identifwutwo.vue') |
| | | }, |
| | | ] |
| | | }, |
| | |
| | | /*----------- 磨边(冷加工) ----------------*/ |
| | | { |
| | | path: 'StockBasicData', |
| | | name: 'StockBasicData', |
| | | component: () => import('../views/StockBasicData/stockBasicData.vue'), |
| | | name: 'Select', |
| | | component: () => import('../views/StockBasicData/Select.vue'), |
| | | children:[ |
| | | { |
| | | path: '/StockBasicData/stockBasicData', |
| | | name: 'stockBasicData', |
| | | component: () => import('../views/StockBasicData/stockBasicData.vue') |
| | | }, |
| | | { |
| | | path: '/StockBasicData/stockBasicDatatwo', |
| | | name: 'stockBasicDatatwo', |
| | | component: () => import('../views/StockBasicData/stockBasicDatatwo.vue') |
| | | }, |
| | | { |
| | | path: '/StockBasicData/stockBasicyiwu', |
| | | name: 'stockBasicyiwu', |
| | | component: () => import('../views/StockBasicData/stockBasicyiwu.vue') |
| | | }, |
| | | ] |
| | | }, |
| | |
| | | name: 'slicecage', |
| | | component: () => import('../views/Slicecage/slicecage.vue') |
| | | }, |
| | | |
| | | ] |
| | | |
| | | // { |
| | | // path: '/slicecagehistory', |
| | | // name: 'slicecagehistory', |
| | | // component: () => import('../views/slicecagehistory.vue') |
| | | // }, |
| | | }, |
| | | /*----------- 钢化 ----------------*/ |
| | | { |
| | |
| | | }, |
| | | ] |
| | | }, |
| | | /*----------- 下片台 ----------------*/ |
| | | { |
| | | path: 'UnLoadGlass', |
| | | name: 'UnLoadGlass', |
| | | component: () => import('../views/UnLoadGlass/UnLoadGlass.vue'), |
| | | /*----------- 仓储中心 ----------------*/ |
| | | { |
| | | path: 'GlassStorage', |
| | | name: 'GlassStorage', |
| | | component: () => import('../views/GlassStorage/GlassStorage.vue'), |
| | | children:[ |
| | | { |
| | | path: '/UnLoadGlass/loadmachinerack', |
| | | name: 'loadmachinerack', |
| | | component: () => import('../views/UnLoadGlass/loadmachinerack.vue') |
| | | path: '/GlassStorage/MaterialRackManagement', |
| | | name: 'MaterialRackManagement', |
| | | component: () => import('../views/GlassStorage/MaterialRackManagement.vue') |
| | | }, |
| | | { |
| | | path: '/UnLoadGlass/loadmachineracktwo', |
| | | name: 'loadmachineracktwo', |
| | | component: () => import('../views/UnLoadGlass/loadmachineracktwo.vue') |
| | | }, |
| | | { |
| | | path: '/UnLoadGlass/Landingindication', |
| | | name: 'Landingindication', |
| | | component: () => import('../views/UnLoadGlass/Landingindication.vue') |
| | | }, |
| | | { |
| | | path: '/UnLoadGlass/Landingindicationtwo', |
| | | name: 'Landingindicationtwo', |
| | | component: () => import('../views/UnLoadGlass/Landingindicationtwo.vue') |
| | | path: '/GlassStorage/rawfilmstorage', |
| | | name: 'rawfilmstorage', |
| | | component: () => import('../views/GlassStorage/rawfilmstorage.vue') |
| | | } |
| | | ] |
| | | }, |
| | | |
| | | |
| | | /*----------- 可视化系统 ----------------*/ |
| | | { |
| | | path: 'Visualization', |
| | |
| | | } |
| | | ] |
| | | }, |
| | | |
| | | /*----------- 系统管理 ----------------*/ |
| | | { |
| | | path: 'User', |
| | | name: 'user', |
| | | component: () => import('../views/User/user.vue'), |
| | | children:[ |
| | | { |
| | | path: '/User/userlist', |
| | | name: 'userlist', |
| | | component: () => import('../views/User/userlist.vue') |
| | | }, |
| | | { |
| | | path: '/User/rolelist', |
| | | name: 'rolelist', |
| | | component: () => import('../views/User/rolelist.vue') |
| | | }, |
| | | { |
| | | path: '/User/permissions', |
| | | name: 'permissions', |
| | | component: () => import('../views/User/permissions.vue') |
| | | }, |
| | | { |
| | | path: '/User/userpageNo', |
| | | name: 'userpageNo', |
| | | component: () => import('../views/User/userpageNo.vue') |
| | | } |
| | | ] |
| | | }, |
| | | /*----------- 显示 ----------------*/ |
| | | { |
| | | path: 'largescreen', |
| | | name: 'largescreen', |
| | | component: () => import('../views/largescreen/largescreen.vue'), |
| | | children:[ |
| | | { |
| | | path: '/largescreen/largescreen', |
| | | name: 'largescreen', |
| | | component: () => import('../views/largescreen/largescreen.vue') |
| | | }, |
| | | ] |
| | | }, |
| | | /*----------- 报工管理 ----------------*/ |
| | | { |
| | | path: 'reportWork', |
| | | name: 'reportWork', |
| | | component: () => import('../views/ReportWork/reportWork.vue'), |
| | | children: [ |
| | | { |
| | | path: '/ReportWork/reportWork', |
| | | name: 'reportWork', |
| | | component: () => import('../views/ReportWork/reportWork.vue') |
| | | }, |
| | | ] |
| | | }, |
| | | |
| | | /*----------- 大屏显示 ----------------*/ |
| | | { |
| | | path: 'largescreendisplay', |
| | | name: 'screendisplay', |
| | | component: () => import('../views/largescreendisplay/screendisplay.vue'), |
| | | children: [ |
| | | { |
| | | path: '/largescreendisplay/screendisplay', |
| | | name: 'screendisplay', |
| | | component: () => import('../views/largescreendisplay/screendisplay.vue') |
| | | }, |
| | | ] |
| | | }, |
| | | /*----------- 中空 ----------------*/ |
| | | { |
| | | path: 'hollow', |
| | | name: 'hol', |
| | | component: () => import('../views/hollow/hol.vue'), |
| | | children: [ |
| | | { |
| | | path: '/hollow/hollowequipment', |
| | | name: 'hollowequipment', |
| | | component: () => import('../views/hollow/hollowequipment.vue') |
| | | }, |
| | | { |
| | | path: '/hollow/hollowequipmenttwo', |
| | | name: 'hollowequipmenttwo', |
| | | component: () => import('../views/hollow/hollowequipmenttwo.vue') |
| | | }, |
| | | { |
| | | path: '/hollow/hollowequipmenthree', |
| | | name: 'hollowequipmenthree', |
| | | component: () => import('../views/hollow/hollowequipmenthree.vue') |
| | | }, |
| | | { |
| | | path: '/hollow/hollowslicecage', |
| | | name: 'hollowslicecage', |
| | | component: () => import('../views/hollow/hollowslicecage.vue') |
| | | }, |
| | | { |
| | | path: '/hollow/hollowaluminum', |
| | | name: 'hollowaluminum', |
| | | component: () => import('../views/hollow/hollowaluminum.vue') |
| | | }, |
| | | { |
| | | path: '/hollow/hollowaluminumtwo', |
| | | name: 'hollowaluminumtwo', |
| | | component: () => import('../views/hollow/hollowaluminumtwo.vue') |
| | | }, |
| | | { |
| | | path: '/hollow/hollowaluminumthree', |
| | | name: 'hollowaluminumthree', |
| | | component: () => import('../views/hollow/hollowaluminumthree.vue') |
| | | }, |
| | | ] |
| | | }, |
| | | /*----------- 管理系统 ----------------*/ |
| | | { |
| | | path: 'sys', |
| | |
| | | // }, |
| | | ] |
| | | }, |
| | | { |
| | | path: '', |
| | | redirect: '/Slicecage/slicecage' |
| | | } |
| | | // { |
| | | // path: '', |
| | | // redirect: '/hollow/hollowslicecage' |
| | | // } |
| | | ] |
| | | }, |
| | | { |
| | | path: '/register', |
| | | name: 'register', |
| | | component: () => import('../views/RegisterView.vue') |
| | | } |
| | | |
| | | }, |
| | | { |
| | | path: '/slicecagehistory', |
| | | name: 'slicecagehistory', |
| | | component: () => import('../views/Slicecage/slicecagehistory.vue'), |
| | | children: [ |
| | | { |
| | | path: '/Slicecage/slicecagehistory', |
| | | name: 'slicecagehistory', |
| | | component: () => import('../views/Slicecage/slicecagehistory.vue') |
| | | }, |
| | | ] |
| | | }, |
| | | { |
| | | path: '/hellowslicecagehistory', |
| | | name: 'hellowslicecagehistory', |
| | | component: () => import('../views/hollow/hellowslicecagehistory.vue'), |
| | | children: [ |
| | | { |
| | | path: '/hollow/hellowslicecagehistory', |
| | | name: 'hellowslicecagehistory', |
| | | component: () => import('../views/hollow/hellowslicecagehistory.vue') |
| | | }, |
| | | ] |
| | | }, |
| | | { |
| | | path: '/hellowquiphistory', |
| | | name: 'hellowquiphistory', |
| | | component: () => import('../views/hollow/hellowquiphistory.vue'), |
| | | children: [ |
| | | { |
| | | path: '/hollow/hellowquiphistory', |
| | | name: 'hellowquiphistory', |
| | | component: () => import('../views/hollow/hellowquiphistory.vue') |
| | | }, |
| | | ] |
| | | }, |
| | | { |
| | | path: '/hellowquiptwohistory', |
| | | name: 'hellowquiptwohistory', |
| | | component: () => import('../views/hollow/hellowquiptwohistory.vue'), |
| | | children: [ |
| | | { |
| | | path: '/hollow/hellowquiptwohistory', |
| | | name: 'hellowquiptwohistory', |
| | | component: () => import('../views/hollow/hellowquiptwohistory.vue') |
| | | }, |
| | | ] |
| | | }, |
| | | { |
| | | path: '/hellowquipthreehistory', |
| | | name: 'hellowquipthreehistory', |
| | | component: () => import('../views/hollow/hellowquipthreehistory.vue'), |
| | | children: [ |
| | | { |
| | | path: '/hollow/hellowquipthreehistory', |
| | | name: 'hellowquipthreehistory', |
| | | component: () => import('../views/hollow/hellowquipthreehistory.vue') |
| | | }, |
| | | ] |
| | | }, |
| | | { |
| | | path: '/cachingbeforehistory', |
| | | name: 'cachingbeforehistory', |
| | | component: () => import('../views/Caching/cachingbeforehistory.vue'), |
| | | children: [ |
| | | { |
| | | path: '/Caching/cachingbeforehistory', |
| | | name: 'cachingbeforehistory', |
| | | component: () => import('../views/Caching/cachingbeforehistory.vue') |
| | | }, |
| | | ] |
| | | }, |
| | | { |
| | | path: '/cachingunhistory', |
| | | name: 'cachingunhistory', |
| | | component: () => import('../views/Caching/cachingunhistory.vue'), |
| | | children: [ |
| | | { |
| | | path: '/Caching/cachingunhistory', |
| | | name: 'cachingunhistory', |
| | | component: () => import('../views/Caching/cachingunhistory.vue') |
| | | }, |
| | | ] |
| | | }, |
| | | { |
| | | path: '/rawhistory', |
| | | name: 'rawhistory', |
| | | component: () => import('../views/GlassStorage/rawhistory.vue'), |
| | | children: [ |
| | | { |
| | | path: '/GlassStorage/rawhistory', |
| | | name: 'rawhistory', |
| | | component: () => import('../views/GlassStorage/rawhistory.vue') |
| | | }, |
| | | ] |
| | | }, |
| | | { |
| | | path: '/stockhistory', |
| | | name: 'stockhistory', |
| | | component: () => import('../views/StockBasicData/stockhistory.vue'), |
| | | children: [ |
| | | { |
| | | path: '/StockBasicData/stockhistory', |
| | | name: 'stockhistory', |
| | | component: () => import('../views/StockBasicData/stockhistory.vue') |
| | | }, |
| | | ] |
| | | }, |
| | | { |
| | | path: '/upreturnhistory', |
| | | name: 'upreturnhistory', |
| | | component: () => import('../views/Returns/upreturnhistory.vue'), |
| | | children: [ |
| | | { |
| | | path: '/Returns/upreturnhistory', |
| | | name: 'upreturnhistory', |
| | | component: () => import('../views/Returns/upreturnhistory.vue') |
| | | }, |
| | | ] |
| | | }, |
| | | { |
| | | path: '/upreturnhistory2', |
| | | name: 'upreturnhistory2', |
| | | component: () => import('../views/Returns/upreturnhistory2.vue'), |
| | | children: [ |
| | | { |
| | | path: '/Returns/upreturnhistory2', |
| | | name: 'upreturnhistory2', |
| | | component: () => import('../views/Returns/upreturnhistory2.vue') |
| | | }, |
| | | ] |
| | | }, |
| | | { |
| | | path: '/statistics', |
| | | name: 'statistics', |
| | | component: () => import('../views/largescreendisplay/statistics.vue'), |
| | | children: [ |
| | | { |
| | | path: '/largescreendisplay/statistics', |
| | | name: 'statistics', |
| | | component: () => import('../views/largescreendisplay/statistics.vue') |
| | | }, |
| | | ] |
| | | }, |
| | | { |
| | | path: '/productionstatistics', |
| | | name: 'productionstatistics', |
| | | component: () => import('../views/largescreendisplay/productionstatistics.vue'), |
| | | children: [ |
| | | { |
| | | path: '/largescreendisplay/productionstatistics', |
| | | name: 'productionstatistics', |
| | | component: () => import('../views/largescreendisplay/productionstatistics.vue') |
| | | }, |
| | | ] |
| | | }, |
| | | ] |
| | | }) |
| | | |
| | | export default router |
| | | // 导航守卫 |
| | | router.beforeEach((to, from, next) => { |
| | | const isAuthenticated = !!localStorage.getItem('authToken'); // 假设这是你的登录状态检查逻辑 |
| | | if (to.matched.some(record => record.meta.requiresAuth) && !isAuthenticated) { |
| | | next({ name: 'login' }); // 如果需要登录但未登录,则重定向到登录页面 |
| | | } else { |
| | | next(); // 否则继续导航 |
| | | } |
| | | }); |
| | | export default router |