/// <summary> /// 获取数据权限组织树 /// </summary> /// <returns></returns> public JsonResult GetDataPermissionOrgTree() { if (_Request == null) { _Request = Request; } SetRequest(_Request); string asyncStr = _Request.QueryEx("async").ObjToStr(); bool isAsync = asyncStr.ObjToInt() == 1; //是否异步 string idStr = _Request.QueryEx("id").ObjToStr(); Guid? tempId = idStr.ObjToGuidNull(); TreeNode tempNode = new TreeNode() { id = "-1", text = "全部", iconCls = "eu-icon-dept" }; TreeNode currDeptNode = new TreeNode() { id = "0", text = "本部门", iconCls = "eu-icon-dept" }; Expression <Func <Sys_Organization, bool> > expression = null; string q = _Request.QueryEx("q").ObjToStr(); //查询字符 if (!string.IsNullOrEmpty(q)) { expression = x => x.Name.Contains(q); } TreeNode node = CommonOperate.GetTreeNode <Sys_Organization>(tempId, null, null, null, null, "eu-icon-dept", expression, null, null, isAsync, GetCurrentUser(_Request)); if (isAsync) { node.state = "closed"; if (node.children != null && node.children.Count() > 0) { node.children.ForEach(x => { x.state = "closed"; }); } } if (tempId == null || tempId == Guid.Empty) { List <TreeNode> list = new List <TreeNode> { tempNode, currDeptNode }; if (node != null) { list.Add(node); } return(Json(list.ToJson().Content)); } else { return(Json(node.children.ToJson().Content)); } }