路由过滤代码调整
This commit is contained in:
parent
40624c3177
commit
21b279646c
@ -35,69 +35,28 @@ function hasPermission(roles, route, parentsRoles) {
|
||||
*/
|
||||
function resetAsyncRouter({ systemType }) {
|
||||
let list = publicAsyncRoute;
|
||||
if (systemType == projectTrain) {
|
||||
const projectList = [projectTrain, projectXian, projectJyd, projectTky, projectDrts, projectRichor];
|
||||
const specialProjects = [projectXty, projectGzzb, projectHeb, projectSdy, projectRichorJoint];
|
||||
const specialProjectEnum = {[projectXty]:'designxty', [projectGzzb]:'designgzb', [projectHeb]:'designheb',
|
||||
[projectSdy]:'designsdy', [projectRichorJoint]:'designrichorjoint' };
|
||||
if (projectList.includes(systemType)) {
|
||||
list = [...list, ...asyncRouter];
|
||||
} else if (systemType == projectXian) {
|
||||
list = [...list, ...asyncRouter];
|
||||
} else if (systemType == projectXty) {
|
||||
if (projectRoute && projectRoute.designxty && projectRoute.designxty.length) {
|
||||
projectRoute.designxty.forEach(item => {
|
||||
if (item.merge) {
|
||||
asyncRouter[item.mergeIndex].children = [...asyncRouter[item.mergeIndex].children, ...item.children];
|
||||
} else {
|
||||
list.push(item);
|
||||
}
|
||||
});
|
||||
}
|
||||
list = [...list, ...asyncRouter];
|
||||
} else if (systemType == projectGzzb) {
|
||||
if (projectRoute && projectRoute.designgzb && projectRoute.designgzb.length) {
|
||||
projectRoute.designgzb.forEach(item => {
|
||||
if (item.merge) {
|
||||
asyncRouter[item.mergeIndex].children = [...asyncRouter[item.mergeIndex].children, ...item.children];
|
||||
} else {
|
||||
list.push(item);
|
||||
}
|
||||
});
|
||||
}
|
||||
list = [...list, ...asyncRouter];
|
||||
} else if (systemType == projectHeb) {
|
||||
if (projectRoute && projectRoute.designheb && projectRoute.designheb.length) {
|
||||
projectRoute.designheb.forEach(item => {
|
||||
if (item.merge) {
|
||||
asyncRouter[item.mergeIndex].children = [...asyncRouter[item.mergeIndex].children, ...item.children];
|
||||
} else { list.push(item); }
|
||||
});
|
||||
} else if (specialProjects.includes(systemType) ) {
|
||||
if (projectRoute) {
|
||||
const proRoute = projectRoute[specialProjectEnum[systemType]];
|
||||
if (proRoute && proRoute.length) {
|
||||
proRoute.forEach(item => {
|
||||
if (item.merge) {
|
||||
asyncRouter[item.mergeIndex].children = [...asyncRouter[item.mergeIndex].children, ...item.children];
|
||||
} else {
|
||||
list.push(item);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
list = [...list, ...asyncRouter];
|
||||
} else if (systemType == projectJsxt) {
|
||||
list = [...list, ...JSXT];
|
||||
} else if (systemType == projectJyd) {
|
||||
list = [...list, ...asyncRouter];
|
||||
} else if (systemType == projectTky) {
|
||||
list = [...list, ...asyncRouter];
|
||||
} else if (systemType == projectDrts) {
|
||||
list = [...list, ...asyncRouter];
|
||||
} else if (systemType == projectRichor) {
|
||||
list = [...list, ...asyncRouter];
|
||||
} else if (systemType == projectSdy) {
|
||||
if (projectRoute && projectRoute.designsdy && projectRoute.designsdy.length) {
|
||||
projectRoute.designsdy.forEach(item => {
|
||||
if (item.merge) {
|
||||
asyncRouter[item.mergeIndex].children = [...asyncRouter[item.mergeIndex].children, ...item.children];
|
||||
} else { list.push(item); }
|
||||
});
|
||||
}
|
||||
list = [...list, ...asyncRouter];
|
||||
} else if (systemType == projectRichorJoint) {
|
||||
if (projectRoute && projectRoute.designrichorjoint && projectRoute.designrichorjoint.length) {
|
||||
projectRoute.designrichorjoint.forEach(item => {
|
||||
if (item.merge) {
|
||||
asyncRouter[item.mergeIndex].children = [...asyncRouter[item.mergeIndex].children, ...item.children];
|
||||
} else { list.push(item); }
|
||||
});
|
||||
}
|
||||
list = [...list, ...asyncRouter];
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user