/// <summary>获取菜单树</summary> /// <param name="id">顶级ID</param> /// <returns></returns> public List <ViewMenuTree> GetMenuTreeChildren(List <Permission> all, int ParentID) { List <ViewMenuTree> data = new List <ViewMenuTree>(); var MenuTreedata = all.Where(ee => ee.ParentID == ParentID).ToList();; foreach (var child in MenuTreedata) { ViewMenuTree menuTree = new ViewMenuTree(); menuTree.id = child.ID; menuTree.name = child.Name; menuTree.pid = child.ParentID.ObjToInt(); menuTree.order = child.orderID.ObjToInt(); menuTree.path = child.Path; menuTree.iconCls = child.Icon; menuTree.component = child.component; //Func = child.Func, menuTree.hidden = child.IsButton.ObjToBool(); //IsButton = child.IsButton.ObjToBool(), menuTree.meta = new meta { affix = true, icon = "dashboard", title = child.Title }; data.Add(menuTree); } return(data); }
public List <ViewMenuTree> GetMenuTreelist(List <Permission> Permissionlist) { var MenuTreedata = Permissionlist.Where(c => c.ParentID == 0).ToList(); List <ViewMenuTree> permissionTrees = new List <ViewMenuTree>(); foreach (var child in MenuTreedata) { ViewMenuTree menuTree = new ViewMenuTree(); menuTree.id = child.ID; menuTree.name = child.Name; menuTree.pid = child.ParentID.ObjToInt(); menuTree.order = child.orderID.ObjToInt(); menuTree.path = child.Path; menuTree.iconCls = child.Icon; menuTree.component = child.component; //Func = child.Func, menuTree.hidden = child.IsButton.ObjToBool(); menuTree.meta = new meta { affix = true, //icon = child.Icon, icon = "dashboard", title = child.Title // requireAuth = true, title = child.Name, NoTabPage = child.IsHide.ObjToBool(), // keepAlive = child.IskeepAlive.ObjToBool() }; menuTree.children = GetMenuTreeChildren(Permissionlist, child.ID); permissionTrees.Add(menuTree); } return(permissionTrees); }