/// <summary> /// 组树的加载 /// </summary> /// <param name="userId">用户id</param> /// <returns></returns> public ActionResult GetPermissionGroupTree(string userId) { //所有的组 var groupData = IdalCommon.IgroupEx.getEntityList(); //此用户拥有的所有的组 var authorizeData = new List <group>(); if (!string.IsNullOrEmpty(userId)) { //获取这个用户所有的组 authorizeData = IdalCommon.IuserGroupEx.getGroupList(int.Parse(userId));//this.CreateService<IRoleAuthorizeAppService>().GetList(roleId); } var treeList = new List <ACETreeEntity>(); foreach (group r in groupData) { ACETreeEntity tree = new ACETreeEntity(); bool hasChildren = groupData.Any(a => a.id == r.id); tree.id = r.id; tree.Text = r.groupname; // tree.Value = r.EnCode; tree.ParentId = null; tree.Isexpand = false; tree.Complete = true; tree.Showcheck = true; tree.Checkstate = authorizeData.Count(t => t.id == r.id); tree.HasChildren = hasChildren; //tree.Img = r.Icon == "" ? "" : r.Icon; treeList.Add(tree); } return(Content(TreeJson.ConvertToJson(treeList))); }
/// <summary> /// 动作树的加载 /// </summary> /// <param name="roleId">角色id</param> /// <returns></returns> public ActionResult GetPermissionActionTree(string roleId) { //所有的动作 var actionData = IdalCommon.IactionEx.getEntityList(); //此角色拥有的所有的资源 var authorizeData = new List <action>(); if (!string.IsNullOrEmpty(roleId)) { //获取这个角色所有的资源 authorizeData = IdalCommon.IroleActionEx.getRoleAllAction(int.Parse(roleId));//this.CreateService<IRoleAuthorizeAppService>().GetList(roleId); } var treeList = new List <ACETreeEntity>(); foreach (action r in actionData) { ACETreeEntity tree = new ACETreeEntity(); bool hasChildren = actionData.Any(a => a.actionowner == r.id.ToString()); tree.id = r.id; tree.Text = r.actionname; // tree.Value = r.EnCode; tree.ParentId = null; tree.Isexpand = true; tree.Complete = true; tree.Showcheck = true; tree.Checkstate = authorizeData.Count(t => t.id == r.id); tree.HasChildren = hasChildren; //tree.Img = r.Icon == "" ? "" : r.Icon; treeList.Add(tree); } return(Content(TreeJson.ConvertToJson(treeList))); }
/// <summary> /// 显示页面 /// </summary> /// <returns></returns> //public override ActionResult Index() //{ // return View(); //} public override ActionResult Index() { var data = IdalCommon.IareaEx.getEntityList(); var treeList = new List <TreeSelectModel>(); foreach (area item in data) { TreeSelectModel treeModel = new TreeSelectModel(); treeModel.id = item.id.ToString(); treeModel.text = item.fullname; treeModel.parentId = item.parentid; treeList.Add(treeModel); } this.ViewBag.AreaString = TreeJson.ConvertToJson(treeList); string strjson = TreeJson.ConvertToJson(treeList); return(View()); }
/// <summary> /// 显示页面BootstrapTemplate /// </summary> /// <returns></returns> //public override ActionResult Index() //{ // return View(); //} /// <summary> /// 显示页面ACE(页面视图入口) /// </summary> /// <returns></returns> public override ActionResult Index() { var data = IdalCommon.IresourceEx.getEntityList(); var treeList = new List <TreeSelectModel>(); //菜单下拉集合 List <SelectOption> resourceList = SelectOption.CreateList(IdalCommon.IresourceEx.getEntityList(), "id", "resourcename"); this.ViewBag.MenusList = resourceList; this.ViewBag.MenusListString = Athena.common.Util.Json.ToJson(resourceList); foreach (resource item in data) { TreeSelectModel treeModel = new TreeSelectModel(); treeModel.id = item.id.ToString(); treeModel.text = item.resourcename; treeModel.parentId = item.resourceowner; treeList.Add(treeModel); } this.ViewBag.Menus = TreeJson.ConvertToJson(treeList);//数据json格式数据 // this.ViewBag.padata = TreeJson.PageConvertToJson(this.SuccessDatajson(ret));//分页格式数据 return(View()); }