public ActionResult GetRoleTree(string selectNodeID = "", string thisid = "", bool ismanage = false) { var cuser = userBLL.GetCurrentUser(); //Expression<Func<SysRole, bool>> exp = sr => !sr.IsDel && sr.IsAvailable /*&& sr.RoleIDPath.Contains("/" + cuser.RoleID)*/; //var rightQueryable = rightService.GetQueryable(r => !r.IsDel); //if (!ismanage) //{ // rightQueryable = rightQueryable.Where(r => r.IsAvailable); //} var roleQueryable = roleService.GetQueryable(r => !r.IsDel); if (!ismanage) { roleQueryable = roleQueryable.Where(r => r.IsAvailable); } var roles = roleQueryable.OrderBy(d => d.SortNo).ThenByDescending(d => d.AddDate).ToList(); var level1 = roles.FirstOrDefault(d => d.Parent == null); bool disabled = level1.RoleIDPath.Trim('/').Split('/').Any(rid => rid == thisid) || !cuser.RolesID.Contains(level1.ID); var selectedNodeIDs = selectNodeID.Split(','); bool selected = selectedNodeIDs.Any(nodeid => nodeid == level1.ID); var root = new JsTree3Node() { id = level1.ID, text = level1.Name, state = new State(true, disabled, selected), children = new List <JsTree3Node>() }; GenerateRoleTree(root, roles, cuser.RolesID, disabled, selectedNodeIDs, thisid); return(Json(root, JsonRequestBehavior.AllowGet)); }