From 247c74e3874884aaf18986bc5dfbe37a77234e72 Mon Sep 17 00:00:00 2001 From: halo Date: Thu, 9 Jul 2026 21:40:42 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B3=A8=E5=86=8C=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=88=97=E8=A1=A8=E4=B8=8E=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/componentRegistry.js | 15 ++++++++++++++- src/router/dynamic.js | 9 ++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/router/componentRegistry.js b/src/router/componentRegistry.js index 1cdce8a..14c8381 100644 --- a/src/router/componentRegistry.js +++ b/src/router/componentRegistry.js @@ -6,5 +6,18 @@ export const routePathComponentMap = { '/system/org': 'system/org/OrgList', '/system/permission': 'system/permission/PermissionList', '/base-config/channel': 'base-config/channel/ChannelList', - '/base-config/manager': 'base-config/manager/ManagerList' + '/base-config/manager': 'base-config/manager/ManagerList', + '/customer/personal': 'customer/personal/PersonalList', + '/customer/enterprise': 'customer/enterprise/EnterpriseList' } + +// 新增/编辑/查看等表单页不是后端菜单节点(不出现在侧边栏),但仍需要注册为 +// MainLayout 下的可访问路由,由列表页通过 router.push 跳转进入。 +export const extraChildRoutes = [ + { path: 'customer/personal/create', name: 'customer-personal-create', component: 'customer/personal/PersonalForm' }, + { path: 'customer/personal/edit', name: 'customer-personal-edit', component: 'customer/personal/PersonalForm' }, + { path: 'customer/personal/detail', name: 'customer-personal-detail', component: 'customer/personal/PersonalForm' }, + { path: 'customer/enterprise/create', name: 'customer-enterprise-create', component: 'customer/enterprise/EnterpriseForm' }, + { path: 'customer/enterprise/edit', name: 'customer-enterprise-edit', component: 'customer/enterprise/EnterpriseForm' }, + { path: 'customer/enterprise/detail', name: 'customer-enterprise-detail', component: 'customer/enterprise/EnterpriseForm' } +] diff --git a/src/router/dynamic.js b/src/router/dynamic.js index acd4563..6e874f9 100644 --- a/src/router/dynamic.js +++ b/src/router/dynamic.js @@ -1,5 +1,5 @@ import MainLayout from '@/layouts/MainLayout.vue' -import { routePathComponentMap } from './componentRegistry' +import { routePathComponentMap, extraChildRoutes } from './componentRegistry' const componentModules = import.meta.glob('@/views/**/*.vue') @@ -48,6 +48,13 @@ export function buildRouteRecords(menuTree) { export function installDynamicRoutes(router, menuTree) { const children = buildRouteRecords(menuTree) + extraChildRoutes.forEach((route) => { + children.push({ + path: route.path, + name: route.name, + component: resolveComponent(route.component) + }) + }) router.addRoute({ path: '/', component: MainLayout,