批量更新

This commit is contained in:
2025-11-02 23:53:41 +08:00
parent 7972f0a6d9
commit 9a6c29f3b0
29 changed files with 1947 additions and 899 deletions
+8
View File
@@ -68,6 +68,14 @@ export function convertMenusToRoutes(menus) {
}
}
// 特殊处理:知识库的编辑和详情页需要支持动态参数
// 如果最终路径是 edit 或 detail,转换为支持参数的路由
if (currentRoute.path === 'edit') {
currentRoute.path = 'edit/:id';
} else if (currentRoute.path === 'detail') {
currentRoute.path = 'detail/:id';
}
if (!parentRoute.children) {
parentRoute.children = [];
}
+16 -21
View File
@@ -140,30 +140,25 @@ function addDynamicRoutes(menus) {
router.addRoute(newMainRoute);
// 添加知识库的子路由(详情页和编辑页)
// 直接在 Main 路由下添加完整路径的子路由
// router.addRoute('Main', {
// path: 'apps/knowledge/detail/:id',
// name: 'apps-knowledge-detail',
// component: () => import('@/views/apps/knowledge/components/detail.vue'),
// meta: {
// requiresAuth: true,
// title: '知识详情'
// }
// });
// router.addRoute('Main', {
// path: 'apps/knowledge/edit/:id',
// name: 'apps-knowledge-edit',
// component: () => import('@/views/apps/knowledge/components/edit.vue'),
// meta: {
// requiresAuth: true,
// title: '编辑知识'
// }
// });
dynamicRoutesAdded = true;
}
// 递归查找路由(根据名称)
function findRouteByName(routes, routeName) {
for (const route of routes) {
if (route.name === routeName) {
return route;
}
if (route.children) {
const found = findRouteByName(route.children, routeName);
if (found) {
return found;
}
}
}
return null;
}
// 查找第一个有效的路由(有组件的路由)
function findFirstValidRoute(routes) {
for (const route of routes) {