2025-10-20 17:32:09 +08:00
|
|
|
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
|
|
|
|
|
import LayoutIndex from '@/components/layout/index.vue';
|
|
|
|
|
|
|
|
|
|
export const constantRoutes: Array<RouteRecordRaw> = [
|
|
|
|
|
{
|
|
|
|
|
path: '',
|
|
|
|
|
redirect: '/login',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: '/login',
|
|
|
|
|
name: 'Login',
|
|
|
|
|
meta: {
|
|
|
|
|
title: '登录',
|
|
|
|
|
keepAlive: true,
|
|
|
|
|
requireAuth: false,
|
|
|
|
|
},
|
|
|
|
|
component: () => import('~/views/login.vue'),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: '/entry',
|
|
|
|
|
component: LayoutIndex,
|
|
|
|
|
meta: {
|
|
|
|
|
title: '入境检疫',
|
|
|
|
|
keepAlive: true,
|
|
|
|
|
requireAuth: true,
|
|
|
|
|
},
|
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
path: '/entry/details',
|
|
|
|
|
name: 'details',
|
|
|
|
|
meta: {
|
|
|
|
|
title: '详情',
|
|
|
|
|
keepAlive: true,
|
|
|
|
|
requireAuth: false,
|
|
|
|
|
},
|
|
|
|
|
component: () => import('~/views/entry/details.vue'),
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
2025-10-23 17:28:06 +08:00
|
|
|
// 系统管理路由
|
2025-10-20 17:32:09 +08:00
|
|
|
{
|
|
|
|
|
path: '/system',
|
|
|
|
|
component: LayoutIndex,
|
|
|
|
|
meta: {
|
|
|
|
|
title: '系统管理',
|
|
|
|
|
keepAlive: true,
|
|
|
|
|
requireAuth: true,
|
|
|
|
|
},
|
|
|
|
|
children: [
|
|
|
|
|
{
|
2025-10-23 17:28:06 +08:00
|
|
|
path: '/system/post',
|
2025-10-20 17:32:09 +08:00
|
|
|
name: 'Post',
|
|
|
|
|
meta: {
|
|
|
|
|
title: '岗位管理',
|
|
|
|
|
keepAlive: true,
|
|
|
|
|
requireAuth: true,
|
|
|
|
|
},
|
|
|
|
|
component: () => import('~/views/system/post.vue'),
|
|
|
|
|
},
|
2025-10-23 17:28:06 +08:00
|
|
|
{
|
|
|
|
|
path: '/system/staff',
|
|
|
|
|
name: 'Staff',
|
|
|
|
|
meta: {
|
|
|
|
|
title: '员工管理',
|
|
|
|
|
keepAlive: true,
|
|
|
|
|
requireAuth: true,
|
|
|
|
|
},
|
|
|
|
|
component: () => import('~/views/system/staff.vue'),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: '/system/tenant',
|
|
|
|
|
name: 'Tenant',
|
|
|
|
|
meta: {
|
|
|
|
|
title: '租户管理',
|
|
|
|
|
keepAlive: true,
|
|
|
|
|
requireAuth: true,
|
|
|
|
|
},
|
|
|
|
|
component: () => import('~/views/system/tenant.vue'),
|
|
|
|
|
},
|
2025-10-20 17:32:09 +08:00
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
// 权限管理路由
|
|
|
|
|
{
|
|
|
|
|
path: '/permission',
|
|
|
|
|
component: LayoutIndex,
|
|
|
|
|
meta: {
|
|
|
|
|
title: '权限管理',
|
|
|
|
|
keepAlive: true,
|
|
|
|
|
requireAuth: true,
|
|
|
|
|
},
|
|
|
|
|
children: [
|
|
|
|
|
{
|
2025-10-23 17:28:06 +08:00
|
|
|
path: '/permission/menu',
|
2025-10-20 17:32:09 +08:00
|
|
|
name: 'MenuPermission',
|
|
|
|
|
meta: {
|
|
|
|
|
title: '菜单权限管理',
|
|
|
|
|
keepAlive: true,
|
|
|
|
|
requireAuth: true,
|
|
|
|
|
},
|
|
|
|
|
component: () => import('~/views/permission/menuPermission.vue'),
|
|
|
|
|
},
|
|
|
|
|
{
|
2025-10-23 17:28:06 +08:00
|
|
|
path: '/permission/operation',
|
2025-10-20 17:32:09 +08:00
|
|
|
name: 'OperationPermission',
|
|
|
|
|
meta: {
|
|
|
|
|
title: '操作权限管理',
|
|
|
|
|
keepAlive: true,
|
|
|
|
|
requireAuth: true,
|
|
|
|
|
},
|
|
|
|
|
component: () => import('~/views/permission/operationPermission.vue'),
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
// 智能硬件路由
|
|
|
|
|
{
|
|
|
|
|
path: '/hardware',
|
|
|
|
|
component: LayoutIndex,
|
|
|
|
|
meta: {
|
|
|
|
|
title: '智能硬件',
|
|
|
|
|
keepAlive: true,
|
|
|
|
|
requireAuth: true,
|
|
|
|
|
},
|
|
|
|
|
children: [
|
|
|
|
|
{
|
2025-10-23 17:28:06 +08:00
|
|
|
path: '/hardware/collar',
|
2025-10-20 17:32:09 +08:00
|
|
|
name: 'Collar',
|
|
|
|
|
meta: {
|
|
|
|
|
title: '智能项圈',
|
|
|
|
|
keepAlive: true,
|
|
|
|
|
requireAuth: true,
|
|
|
|
|
},
|
|
|
|
|
component: () => import('~/views/hardware/collar.vue'),
|
|
|
|
|
},
|
|
|
|
|
{
|
2025-10-23 17:28:06 +08:00
|
|
|
path: '/hardware/eartag',
|
2025-10-20 17:32:09 +08:00
|
|
|
name: 'Eartag',
|
|
|
|
|
meta: {
|
|
|
|
|
title: '智能耳标',
|
|
|
|
|
keepAlive: true,
|
|
|
|
|
requireAuth: true,
|
|
|
|
|
},
|
|
|
|
|
component: () => import('~/views/hardware/eartag.vue'),
|
|
|
|
|
},
|
|
|
|
|
{
|
2025-10-23 17:28:06 +08:00
|
|
|
path: '/hardware/host',
|
2025-10-20 17:32:09 +08:00
|
|
|
name: 'Host',
|
|
|
|
|
meta: {
|
|
|
|
|
title: '智能主机',
|
|
|
|
|
keepAlive: true,
|
|
|
|
|
requireAuth: true,
|
|
|
|
|
},
|
|
|
|
|
component: () => import('~/views/hardware/host.vue'),
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
2025-10-23 17:28:06 +08:00
|
|
|
// 用户管理路由
|
|
|
|
|
{
|
|
|
|
|
path: '/userManage',
|
|
|
|
|
component: LayoutIndex,
|
|
|
|
|
meta: {
|
|
|
|
|
title: '用户管理',
|
|
|
|
|
keepAlive: true,
|
|
|
|
|
requireAuth: true,
|
|
|
|
|
},
|
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
path: '/userManage/user',
|
|
|
|
|
name: 'UserManage',
|
|
|
|
|
meta: {
|
|
|
|
|
title: '用户管理',
|
|
|
|
|
keepAlive: true,
|
|
|
|
|
requireAuth: true,
|
|
|
|
|
},
|
|
|
|
|
component: () => import('~/views/userManage/user.vue'),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: '/userManage/driver',
|
|
|
|
|
name: 'DriverManage',
|
|
|
|
|
meta: {
|
|
|
|
|
title: '司机管理',
|
|
|
|
|
keepAlive: true,
|
|
|
|
|
requireAuth: true,
|
|
|
|
|
},
|
|
|
|
|
component: () => import('~/views/userManage/driver.vue'),
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
// 早期预警路由
|
|
|
|
|
{
|
|
|
|
|
path: '/earlywarning',
|
|
|
|
|
component: LayoutIndex,
|
|
|
|
|
meta: {
|
|
|
|
|
title: '早期预警',
|
|
|
|
|
keepAlive: true,
|
|
|
|
|
requireAuth: true,
|
|
|
|
|
},
|
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
path: '/earlywarning/earlywarninglist',
|
|
|
|
|
name: 'EarlyWarningList',
|
|
|
|
|
meta: {
|
|
|
|
|
title: '早期预警列表',
|
|
|
|
|
keepAlive: true,
|
|
|
|
|
requireAuth: true,
|
|
|
|
|
},
|
|
|
|
|
component: () => import('~/views/earlywarning/list.vue'),
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
2025-10-20 17:32:09 +08:00
|
|
|
// 运送清单路由
|
|
|
|
|
{
|
|
|
|
|
path: '/shipping',
|
|
|
|
|
component: LayoutIndex,
|
|
|
|
|
meta: {
|
|
|
|
|
title: '运送清单',
|
|
|
|
|
keepAlive: true,
|
|
|
|
|
requireAuth: true,
|
|
|
|
|
},
|
|
|
|
|
children: [
|
|
|
|
|
{
|
2025-10-23 17:28:06 +08:00
|
|
|
path: '/shipping/loadingOrder',
|
2025-10-20 17:32:09 +08:00
|
|
|
name: 'LoadingOrder',
|
|
|
|
|
meta: {
|
|
|
|
|
title: '装车订单',
|
|
|
|
|
keepAlive: true,
|
|
|
|
|
requireAuth: true,
|
|
|
|
|
},
|
|
|
|
|
component: () => import('~/views/shipping/loadingOrder.vue'),
|
|
|
|
|
},
|
2025-10-23 17:28:06 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
path: '/shipping/shippinglist',
|
|
|
|
|
name: 'ShippingList',
|
|
|
|
|
meta: {
|
|
|
|
|
title: '运送清单',
|
|
|
|
|
keepAlive: true,
|
|
|
|
|
requireAuth: true,
|
|
|
|
|
},
|
|
|
|
|
component: () => import('~/views/entry/attestation.vue'),
|
|
|
|
|
},
|
2025-10-20 17:32:09 +08:00
|
|
|
],
|
2025-10-23 17:28:06 +08:00
|
|
|
|
2025-10-20 17:32:09 +08:00
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
export const dynamicRoutes = [
|
|
|
|
|
{
|
|
|
|
|
path: '/menu',
|
|
|
|
|
name: 'Menu',
|
|
|
|
|
meta: {
|
|
|
|
|
title: '首页',
|
|
|
|
|
keepAlive: true,
|
|
|
|
|
requireAuth: false,
|
|
|
|
|
},
|
|
|
|
|
component: () => import('~/views/system/menu.vue'),
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const router = createRouter({
|
|
|
|
|
history: createWebHistory(),
|
|
|
|
|
routes: constantRoutes,
|
2025-10-23 17:28:06 +08:00
|
|
|
scrollBehavior(to, from, savedPosition) {
|
|
|
|
|
// 如果有保存的位置(浏览器前进/后退),使用保存的位置
|
|
|
|
|
if (savedPosition) {
|
|
|
|
|
return savedPosition;
|
|
|
|
|
}
|
|
|
|
|
// 否则滚动到顶部
|
|
|
|
|
return { top: 0 };
|
|
|
|
|
},
|
2025-10-20 17:32:09 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export default router;
|