//部门树 public JsonResult TreeDept() { var cBll = new BLL_Dept(); var list = cBll.GetEnabledList_Ex(); if (list != null) { return(Json(list.Select(c => new TreeModel() { Id = c.ID, Title = c.Dept_Name, Pid = c.Dept_FatherId, Url = c.Dept_Code }))); } return(Json("")); }
public JsonResult TreeDept_Ex() { var cBll = new BLL_Dept(); var list2nodes = cBll.GetEnabledListBy2nodes(); //得到1,2级 var list = cBll.GetEnabledList_Ex(); //到2级 List <ts_Dept> listex = new List <ts_Dept>(); for (int i = 0; i < list.Count; i++) { listex = listex.Concat(cBll.GetEnabledListByParent(list[i].ID).ToList()).ToList(); } listex = listex.Concat(list2nodes.ToList()).ToList(); if (listex != null) { return(Json(listex.Select(c => new TreeModel() { Id = c.ID, Title = c.Dept_Name, Pid = c.Dept_FatherId, Url = c.Dept_Code, open = c.Dept_FatherId == "0" }))); } return(Json("")); }