提交 1e16ad36 编写于 作者: tony001's avatar tony001

修复去掉某个子菜单后,主菜单不显示

上级 c3f00f37
...@@ -538,6 +538,7 @@ ${P.getLogicCode(singleFuncs,"LOGIC.vue").code} ...@@ -538,6 +538,7 @@ ${P.getLogicCode(singleFuncs,"LOGIC.vue").code}
public handleMenusResource(inputMenus:Array<any>){ public handleMenusResource(inputMenus:Array<any>){
if(Environment.enablePermissionValid){ if(Environment.enablePermissionValid){
this.computedEffectiveMenus(inputMenus); this.computedEffectiveMenus(inputMenus);
this.computeParentMenus(inputMenus);
} }
this.dataProcess(inputMenus); this.dataProcess(inputMenus);
this.menus = inputMenus; this.menus = inputMenus;
...@@ -549,7 +550,7 @@ ${P.getLogicCode(singleFuncs,"LOGIC.vue").code} ...@@ -549,7 +550,7 @@ ${P.getLogicCode(singleFuncs,"LOGIC.vue").code}
/** /**
* 计算有效菜单项 * 计算有效菜单项
* *
* @param {*} data * @param {*} inputMenus
* @memberof ${srfclassname('${ctrl.codeName}')}Base * @memberof ${srfclassname('${ctrl.codeName}')}Base
*/ */
public computedEffectiveMenus(inputMenus:Array<any>){ public computedEffectiveMenus(inputMenus:Array<any>){
...@@ -563,6 +564,29 @@ ${P.getLogicCode(singleFuncs,"LOGIC.vue").code} ...@@ -563,6 +564,29 @@ ${P.getLogicCode(singleFuncs,"LOGIC.vue").code}
}) })
} }
/**
* 计算父项菜单项是否隐藏
*
* @param {*} inputMenus
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public computeParentMenus(inputMenus:Array<any>){
if(inputMenus && inputMenus.length >0){
inputMenus.forEach((item:any) =>{
if(item.hidden && item.items && item.items.length >0){
item.items.map((singleItem:any) =>{
if(!singleItem.hidden){
item.hidden = false;
}
if(singleItem.items && singleItem.items.length >0){
this.computeParentMenus(singleItem.items);
}
})
}
})
}
}
/** /**
* 数据处理 * 数据处理
* *
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册