lcw
This commit is contained in:
@ -10,11 +10,11 @@ const getChildrenRoutes = (routes) => {
|
||||
routes.forEach((route) => {
|
||||
if (route.children && route.children.length > 0) {
|
||||
if (deptBizType == '23' && roleList) {
|
||||
// 在这个条件分支中也需要过滤掉/internalAuditor路由
|
||||
result.push(...route.children);
|
||||
} else {
|
||||
// console.log(route.path);
|
||||
if (route.path == '/JudgmentHome') {
|
||||
route.children.splice(6, 1);
|
||||
route.children.splice(route.children.findIndex(item => item.path == '/internalAuditor'), 1)
|
||||
result.push(...route.children);
|
||||
} else {
|
||||
result.push(...route.children);
|
||||
@ -29,15 +29,18 @@ const getChildrenRoutes = (routes) => {
|
||||
*处理脱离层级的路由
|
||||
*/
|
||||
export const filterRoutes = (routes) => {
|
||||
|
||||
//获取到所有的子集路由
|
||||
const childrenRoutes = getChildrenRoutes(routes);
|
||||
//根据子集路由进行查重操作
|
||||
return routes.filter((route) => {
|
||||
const data = routes.filter((route) => {
|
||||
//根据route在childrenRoutes中进行查重,把所有重复路由表 剔除
|
||||
return !childrenRoutes.find((childrenRoute) => {
|
||||
return childrenRoute.path === route.path;
|
||||
});
|
||||
});
|
||||
}).filter(item => item.path != '/internalAuditor')
|
||||
console.log(childrenRoutes);
|
||||
|
||||
return data
|
||||
};
|
||||
|
||||
function isNull(data) {
|
||||
@ -86,3 +89,5 @@ export function generateMenus(routes, basePath = "") {
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user