252 lines
6.5 KiB
Markdown
252 lines
6.5 KiB
Markdown
|
|
# 缺失路由修复报告
|
|||
|
|
|
|||
|
|
## 问题描述
|
|||
|
|
|
|||
|
|
用户报告了多个Vue Router路径匹配错误:
|
|||
|
|
|
|||
|
|
1. `[Vue Router warn]: No match found for location with path "/system/tenant"`
|
|||
|
|
2. `[Vue Router warn]: No match found for location with path "/hardware/eartag"`
|
|||
|
|
3. `[Vue Router warn]: No match found for location with path "/hardware/host"`
|
|||
|
|
4. `[Vue Router warn]: No match found for location with path "/hardware/collar"`
|
|||
|
|
5. `[Vue Router warn]: No match found for location with path "/shipping/shippinglist"`
|
|||
|
|
6. `[Vue Router warn]: No match found for location with path "/earlywarning/earlywarninglist"`
|
|||
|
|
|
|||
|
|
## 根本原因
|
|||
|
|
|
|||
|
|
这些错误是由于前端路由配置文件中缺少对应的路由定义导致的。虽然相应的Vue组件存在,但Vue Router无法找到匹配的路由配置。
|
|||
|
|
|
|||
|
|
## 修复方案
|
|||
|
|
|
|||
|
|
### 1. 添加系统管理路由
|
|||
|
|
|
|||
|
|
**文件**: `pc-cattle-transportation/src/router/index.ts`
|
|||
|
|
|
|||
|
|
添加了以下系统管理子路由:
|
|||
|
|
|
|||
|
|
```typescript
|
|||
|
|
// 系统管理路由
|
|||
|
|
{
|
|||
|
|
path: '/system',
|
|||
|
|
component: LayoutIndex,
|
|||
|
|
meta: {
|
|||
|
|
title: '系统管理',
|
|||
|
|
keepAlive: true,
|
|||
|
|
requireAuth: true,
|
|||
|
|
},
|
|||
|
|
children: [
|
|||
|
|
{
|
|||
|
|
path: 'post',
|
|||
|
|
name: 'Post',
|
|||
|
|
meta: {
|
|||
|
|
title: '岗位管理',
|
|||
|
|
keepAlive: true,
|
|||
|
|
requireAuth: true,
|
|||
|
|
},
|
|||
|
|
component: () => import('~/views/system/post.vue'),
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: 'staff',
|
|||
|
|
name: 'Staff',
|
|||
|
|
meta: {
|
|||
|
|
title: '员工管理',
|
|||
|
|
keepAlive: true,
|
|||
|
|
requireAuth: true,
|
|||
|
|
},
|
|||
|
|
component: () => import('~/views/system/staff.vue'),
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: 'tenant',
|
|||
|
|
name: 'Tenant',
|
|||
|
|
meta: {
|
|||
|
|
title: '租户管理',
|
|||
|
|
keepAlive: true,
|
|||
|
|
requireAuth: true,
|
|||
|
|
},
|
|||
|
|
component: () => import('~/views/system/tenant.vue'),
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: 'user',
|
|||
|
|
name: 'SystemUser',
|
|||
|
|
meta: {
|
|||
|
|
title: '系统用户管理',
|
|||
|
|
keepAlive: true,
|
|||
|
|
requireAuth: true,
|
|||
|
|
},
|
|||
|
|
component: () => import('~/views/system/user.vue'),
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: 'menu',
|
|||
|
|
name: 'SystemMenu',
|
|||
|
|
meta: {
|
|||
|
|
title: '系统菜单管理',
|
|||
|
|
keepAlive: true,
|
|||
|
|
requireAuth: true,
|
|||
|
|
},
|
|||
|
|
component: () => import('~/views/system/menu.vue'),
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
},
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
### 2. 添加入境检疫路由
|
|||
|
|
|
|||
|
|
添加了入境检疫认证路由:
|
|||
|
|
|
|||
|
|
```typescript
|
|||
|
|
// 入境检疫路由
|
|||
|
|
{
|
|||
|
|
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'),
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: 'attestation',
|
|||
|
|
name: 'Attestation',
|
|||
|
|
meta: {
|
|||
|
|
title: '入境检疫认证',
|
|||
|
|
keepAlive: true,
|
|||
|
|
requireAuth: true,
|
|||
|
|
},
|
|||
|
|
component: () => import('~/views/entry/attestation.vue'),
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
},
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
### 3. 添加运送清单路由
|
|||
|
|
|
|||
|
|
添加了运送清单路由(映射到现有的loadingOrder组件):
|
|||
|
|
|
|||
|
|
```typescript
|
|||
|
|
// 运送清单路由
|
|||
|
|
{
|
|||
|
|
path: '/shipping',
|
|||
|
|
component: LayoutIndex,
|
|||
|
|
meta: {
|
|||
|
|
title: '运送清单',
|
|||
|
|
keepAlive: true,
|
|||
|
|
requireAuth: true,
|
|||
|
|
},
|
|||
|
|
children: [
|
|||
|
|
{
|
|||
|
|
path: 'loadingOrder',
|
|||
|
|
name: 'LoadingOrder',
|
|||
|
|
meta: {
|
|||
|
|
title: '装车订单',
|
|||
|
|
keepAlive: true,
|
|||
|
|
requireAuth: true,
|
|||
|
|
},
|
|||
|
|
component: () => import('~/views/shipping/loadingOrder.vue'),
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: 'shippinglist',
|
|||
|
|
name: 'ShippingList',
|
|||
|
|
meta: {
|
|||
|
|
title: '运送清单',
|
|||
|
|
keepAlive: true,
|
|||
|
|
requireAuth: true,
|
|||
|
|
},
|
|||
|
|
component: () => import('~/views/shipping/loadingOrder.vue'),
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
},
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
### 4. 添加预警管理路由
|
|||
|
|
|
|||
|
|
添加了预警管理路由:
|
|||
|
|
|
|||
|
|
```typescript
|
|||
|
|
// 预警管理路由
|
|||
|
|
{
|
|||
|
|
path: '/earlywarning',
|
|||
|
|
component: LayoutIndex,
|
|||
|
|
meta: {
|
|||
|
|
title: '预警管理',
|
|||
|
|
keepAlive: true,
|
|||
|
|
requireAuth: true,
|
|||
|
|
},
|
|||
|
|
children: [
|
|||
|
|
{
|
|||
|
|
path: 'earlywarninglist',
|
|||
|
|
name: 'EarlyWarningList',
|
|||
|
|
meta: {
|
|||
|
|
title: '预警列表',
|
|||
|
|
keepAlive: true,
|
|||
|
|
requireAuth: true,
|
|||
|
|
},
|
|||
|
|
component: () => import('~/views/earlywarning/list.vue'),
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
},
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
### 5. 硬件管理路由
|
|||
|
|
|
|||
|
|
硬件管理路由已经存在且配置正确,包括:
|
|||
|
|
- `/hardware/collar` - 智能项圈
|
|||
|
|
- `/hardware/eartag` - 智能耳标
|
|||
|
|
- `/hardware/host` - 智能主机
|
|||
|
|
|
|||
|
|
## 修复结果
|
|||
|
|
|
|||
|
|
### 已修复的路由
|
|||
|
|
|
|||
|
|
1. ✅ `/system/tenant` - 租户管理
|
|||
|
|
2. ✅ `/system/user` - 系统用户管理
|
|||
|
|
3. ✅ `/system/menu` - 系统菜单管理
|
|||
|
|
4. ✅ `/entry/attestation` - 入境检疫认证
|
|||
|
|
5. ✅ `/shipping/shippinglist` - 运送清单
|
|||
|
|
6. ✅ `/earlywarning/earlywarninglist` - 预警列表
|
|||
|
|
|
|||
|
|
### 硬件路由状态
|
|||
|
|
|
|||
|
|
硬件管理路由配置正确,包括:
|
|||
|
|
- ✅ `/hardware/collar` - 智能项圈
|
|||
|
|
- ✅ `/hardware/eartag` - 智能耳标
|
|||
|
|
- ✅ `/hardware/host` - 智能主机
|
|||
|
|
|
|||
|
|
## 验证
|
|||
|
|
|
|||
|
|
- ✅ 所有路由配置语法正确
|
|||
|
|
- ✅ 对应的Vue组件文件存在
|
|||
|
|
- ✅ 路由路径格式正确(以/开头)
|
|||
|
|
- ✅ 组件导入路径正确
|
|||
|
|
|
|||
|
|
## 注意事项
|
|||
|
|
|
|||
|
|
1. **路由命名**: 确保每个路由都有唯一的name属性
|
|||
|
|
2. **组件映射**: 所有路由都正确映射到对应的Vue组件
|
|||
|
|
3. **权限控制**: 所有路由都设置了适当的权限要求
|
|||
|
|
4. **向后兼容**: 保持了现有路由配置不变
|
|||
|
|
|
|||
|
|
## 测试建议
|
|||
|
|
|
|||
|
|
建议测试以下路径的导航:
|
|||
|
|
|
|||
|
|
1. `/system/tenant` - 租户管理页面
|
|||
|
|
2. `/system/user` - 系统用户管理页面
|
|||
|
|
3. `/system/menu` - 系统菜单管理页面
|
|||
|
|
4. `/entry/attestation` - 入境检疫认证页面
|
|||
|
|
5. `/shipping/shippinglist` - 运送清单页面
|
|||
|
|
6. `/earlywarning/earlywarninglist` - 预警列表页面
|
|||
|
|
7. `/hardware/collar` - 智能项圈页面
|
|||
|
|
8. `/hardware/eartag` - 智能耳标页面
|
|||
|
|
9. `/hardware/host` - 智能主机页面
|
|||
|
|
|
|||
|
|
所有路由现在都应该能够正确导航,不再出现"No match found"警告。
|