public ActionResult GetEnableTreeSelectJson() { var data = organizeApp.GetEnableList(); var treeList = new List <TreeSelectModel>(); foreach (OrganizeEntity item in data) { TreeSelectModel treeModel = new TreeSelectModel(); treeModel.id = item.F_Id; treeModel.text = item.F_FullName; treeModel.parentId = item.F_ParentId; treeModel.data = item; treeList.Add(treeModel); } return(Content(treeList.TreeSelectJson())); }
public ActionResult GetOrgJson(string keyword) { var data = organizeApp.GetEnableList(); if (!string.IsNullOrEmpty(keyword)) { data = data.TreeWhere(t => t.FullName.Contains(keyword)); } var treeList = new List <TreeGridModel>(); foreach (OrganizeEntity item in data) { TreeGridModel treeModel = new TreeGridModel(); bool hasChildren = data.Count(t => t.ParentId == item.Id) == 0 ? false : true; treeModel.id = item.Id; treeModel.isLeaf = hasChildren; treeModel.parentId = item.ParentId; treeModel.expanded = hasChildren; treeModel.entityJson = item.ToJson(); treeList.Add(treeModel); } return(Content(treeList.TreeGridJson())); }