/// <summary> /// 请求角色树形 /// </summary> /// <param name="request"></param> /// <returns></returns> public IEnumerable <EasyUITree> GetRoleTree(EasyUITreeRequest request) { ////wher语句查询条件 //string commandText = ""; //if (!request.Where.IsNullOrEmpty()) //{ // //做Where的翻译处理工作 // FilterTranslator whereTranslator = new FilterTranslator(); // //反序列化Filter Group JSON // whereTranslator.Group = JsonHelper.FromJson<FilterGroup>(request.Where); // //开始翻译sql语句 // whereTranslator.Translate(); // commandText = FilterParam.AddParameters(whereTranslator.CommandText, whereTranslator.Parms); //} //返回ui层的菜单 IEnumerable <EasyUITree> rootRole = new List <EasyUITree>() { new EasyUITree() { icon = request.RootIcon, id = 0, desc = "角色组", text = "角色组", children = (List <EasyUITree>)EasyUITree.ToListViewModel(base.GetListBy(r => true)), } }; return(rootRole); }
/// <summary> /// 获取部门的Tree格式 /// </summary> /// <param name="treeData">获得树级请求数据</param> /// <returns></returns> public IEnumerable <EasyUITree> GetDepartmentTree(EasyUITreeRequest treeData) { StringBuilder sbJson = new StringBuilder(); IEnumerable <Sample_Department> departAllList = base.GetListBy(d => true).ToList(); List <EasyUITree> listDepart = new List <EasyUITree>(); //查找所有的一级部门 var ParentDepart = departAllList.Where(con => con.depPid == 0); foreach (var parent in ParentDepart) { //实体转化 EasyUITree parentItem = EasyUITree.ToEntity(parent); //获取子级 GetDepartmentChildren(ref parentItem, (List <Sample_Department>)departAllList); listDepart.Add(parentItem); } return(listDepart); }
public IEnumerable <ViewModelMenu> GetUserTreeMenus(EasyUITreeRequest request, string userRoles) { //返回ui层的菜单 IEnumerable <ViewModelMenu> rootMenus = new List <ViewModelMenu>() { new ViewModelMenu() { icon = request.RootIcon, MenuIcon = request.RootIcon, MenuParentNo = request.PidField, MenuName = "主菜单", MenuNo = request.IdField, text = "主菜单", children = (List <ViewModelMenu>)ViewModelMenu.ToListViewModel(ModuleManager.GetListBy(m => m.moduleParentId == 0)) } }; return(rootMenus); }