mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-24 07:55:06 +08:00
1. 简化 ruoyi 获取菜单列表时,和前端耦合性比较重的情况
2. 删除 MenuDO 表非关键性字段,进一步简化模型
This commit is contained in:
@ -43,19 +43,28 @@ const permission = {
|
||||
// 遍历后台传来的路由字符串,转换为组件对象
|
||||
function filterAsyncRouter(asyncRouterMap, isRewrite = false) {
|
||||
return asyncRouterMap.filter(route => {
|
||||
// 将 ruoyi 后端原有耦合前端的逻辑,迁移到此处
|
||||
// 处理 meta 属性
|
||||
route.meta = {
|
||||
title: route.menuName,
|
||||
icon: route.icon
|
||||
}
|
||||
// 处理 component 属性
|
||||
if (route.children) { // 父节点
|
||||
// debugger
|
||||
if (route.parentId === 0) {
|
||||
route.component = Layout
|
||||
} else {
|
||||
route.component = ParentView
|
||||
}
|
||||
} else { // 根节点
|
||||
route.component = loadView(route.component)
|
||||
}
|
||||
|
||||
// filterChildren
|
||||
if (isRewrite && route.children) {
|
||||
route.children = filterChildren(route.children)
|
||||
}
|
||||
if (route.component) {
|
||||
// Layout ParentView 组件特殊处理
|
||||
if (route.component === 'Layout') {
|
||||
route.component = Layout
|
||||
} else if (route.component === 'ParentView') {
|
||||
route.component = ParentView
|
||||
} else {
|
||||
route.component = loadView(route.component)
|
||||
}
|
||||
}
|
||||
if (route.children != null && route.children && route.children.length) {
|
||||
route.children = filterAsyncRouter(route.children, route, isRewrite)
|
||||
}
|
||||
|
Reference in New Issue
Block a user