/// <summary> /// 获取角色的权限信息 /// </summary> /// <param name="context"></param> /// <returns></returns> public string FindRoleMenuTree(HttpContext context) { string roleId = context.Request.Params["roleId"]; List <MenuModel> roleMenus = roleBll.FindRoleMenuTree(roleId); var treeList = new List <TreeViewModel>(); foreach (MenuModel item in roleMenus) { TreeViewModel treeModel = new TreeViewModel(); bool hasChildren = roleMenus.Count(t => t.F_ParentId == item.F_Id) != 0; treeModel.id = item.F_Id; treeModel.text = (item.F_Type == 3 ? "按钮" : "菜单") + "-" + item.F_Name; treeModel.value = item.F_Id; treeModel.parentId = item.F_ParentId; treeModel.isexpand = hasChildren; treeModel.complete = true; treeModel.iconCls = item.F_Icon; treeModel.checkstate = item.F_Remark == "-1" ? 0 : 1; treeModel.hasChildren = hasChildren; treeList.Add(treeModel); } return(ContentResult(treeList.TreeViewJson())); }