Files
KCGL/inventory-web/src/router/index.ts

154 lines
4.4 KiB
TypeScript
Raw Normal View History

import { createRouter, createWebHistory } from 'vue-router'
// 核心修改点:使用 'type' 关键字导入 RouteRecordRaw,或者将其分开导入
import type { RouteRecordRaw } from 'vue-router'
import Layout from '@/layout/index.vue'
const routes: Array<RouteRecordRaw> = [
// 1. 首页 Dashboard
{
path: '/',
component: Layout,
redirect: '/dashboard',
children: [
{
path: 'dashboard',
name: 'Dashboard',
component: () => import('@/views/dashboard/index.vue'),
meta: { title: '首页', icon: 'HomeFilled' }
}
]
},
// 2. 基础信息 (对应 views/material/list.vue)
{
path: '/material',
component: Layout,
redirect: '/material/index',
children: [
{
path: 'index',
name: 'MaterialBase',
// 基础信息列表
component: () => import('@/views/material/list.vue'),
meta: { title: '基础信息', icon: 'Box' }
}
]
},
// 3. 库存管理 (采购/半成品/成品/权益)
{
path: '/inventory',
component: Layout,
meta: { title: '库存管理', icon: 'Shop' },
redirect: '/inventory/buy',
children: [
{
path: 'buy',
name: 'InventoryBuy',
// 采购入库页面
component: () => import('@/views/stock/inbound/buy.vue'),
meta: { title: '采购件' }
},
{
path: 'semi',
name: 'InventorySemi',
// 半成品页面
component: () => import('@/views/stock/inbound/semi.vue'),
meta: { title: '半成品' }
},
{
path: 'product',
name: 'InventoryProduct',
// 成品页面
component: () => import('@/views/stock/inbound/product.vue'),
meta: { title: '成品' }
},
{
path: 'service',
name: 'InventoryService',
// 服务权益页面
component: () => import('@/views/stock/inbound/service.vue'),
meta: { title: '服务权益' }
}
]
},
// 4. 业务操作 (借库/维修/报废)
{
path: '/operation',
component: Layout,
meta: { title: '业务操作', icon: 'Operation' },
redirect: '/operation/borrow',
children: [
{
path: 'borrow',
name: 'OpBorrow',
// 借库页面
component: () => import('@/views/transaction/borrow.vue'),
meta: { title: '借库' }
},
{
path: 'repair',
name: 'OpRepair',
// 维修页面 (指向 return.vue)
component: () => import('@/views/transaction/return.vue'),
meta: { title: '维修' }
},
{
path: 'scrap',
name: 'OpScrap',
// 报废页面
component: () => import('@/views/transaction/scrap.vue'),
meta: { title: '报废' }
}
]
},
/* * 暂时屏蔽 BOM 和 系统管理
*/
// {
// path: '/bom',
// component: Layout,
// children: [
// {
// path: 'index',
// name: 'BOM',
// component: () => import('@/views/bom/index.vue'),
// meta: { title: 'BOM管理', icon: 'List' }
// }
// ]
// },
// {
// path: '/system',
// component: Layout,
// meta: { title: '系统管理', icon: 'Setting' },
// children: [
// {
// path: 'user',
// name: 'UserManage',
// component: () => import('@/views/system/user.vue'),
// meta: { title: '用户管理', icon: 'User' }
// },
// {
// path: 'log',
// name: 'OpLog',
// component: () => import('@/views/system/log.vue'),
// meta: { title: '操作日志', icon: 'Document' }
// }
// ]
// },
// 404 路由
{
path: '/:pathMatch(.*)*',
redirect: '/dashboard',
meta: { hidden: true }
}
]
const router = createRouter({
history: createWebHistory(),
routes
})
export default router