コード例 #1
0
        public IEnumerable <TreeDataView> GetUserGroupTree()
        {
            IEnumerable <FapUserGroup> userGroups = _rbacService.GetAllUserGroup();
            List <TreeDataView>        oriList    = userGroups.Select(t => new TreeDataView {
                Id = t.Fid.ToString(), Pid = t.Pid.ToString(), Data = new { group = "1" }, Text = t.UserGroupName, Icon = "icon-folder orange ace-icon fa fa-users"
            }).ToList <TreeDataView>();
            List <TreeDataView> tree     = new List <TreeDataView>();
            TreeDataView        treeRoot = new TreeDataView()
            {
                Id    = "0",
                Text  = "用户组",
                Data  = new { group = "0" },
                State = new NodeState {
                    Opened = true
                },
                Icon = "icon-folder blue ace-icon fa fa-sitemap",
            };

            tree.Add(treeRoot);
            TreeViewHelper.MakeTree(treeRoot.Children, oriList, treeRoot.Id);
            return(tree);
        }