From d24c5d0737ab8b1efbe170530e7e9c70c982321a Mon Sep 17 00:00:00 2001 From: wangzenghua <1048523306@qq.com> Date: Mon, 14 Apr 2025 02:49:35 +0100 Subject: [PATCH] fix --- sub-operation-service/src/utils/router.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/sub-operation-service/src/utils/router.js b/sub-operation-service/src/utils/router.js index ce09911..7c80973 100644 --- a/sub-operation-service/src/utils/router.js +++ b/sub-operation-service/src/utils/router.js @@ -109,3 +109,23 @@ export function handleRoutes(routers, pathUrl = '') { item.path = path.resolve(pathUrl, item.path); }); } + +export function findParentRoute(routes, targetPath) { + for (const route of routes) { + if (route.children) { + for (const child of route.children) { + if (child.path === targetPath) { + return route; + } + if (child.children) { + for (const grandChild of child.children) { + if (grandChild.path === targetPath) { + return child; + } + } + } + } + } + } + return null; +}