You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

160 lines
4.6 KiB

  1. using Learun.Util;
  2. using System.Data;
  3. using Learun.Application.TwoDevelopment.Permission;
  4. using System.Web.Mvc;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using Learun.Application.Organization;
  8. namespace Learun.Application.Web.Areas.Permission.Controllers
  9. {
  10. /// <summary>
  11. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  12. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  13. /// 创 建:超级管理员
  14. /// 日 期:2019-04-22 11:01
  15. /// 描 述:应用授权
  16. /// </summary>
  17. public class Perm_UserPermissionController : MvcControllerBase
  18. {
  19. private Perm_UserPermissionIBLL perm_UserPermissionIBLL = new Perm_UserPermissionBLL();
  20. private Perm_ChartGroupIBLL permChartGroupIbll = new Perm_ChartGroupBLL();
  21. #region 视图功能
  22. /// <summary>
  23. /// 主页面
  24. /// <summary>
  25. /// <returns></returns>
  26. [HttpGet]
  27. public ActionResult Index()
  28. {
  29. return View();
  30. }
  31. /// <summary>
  32. /// 表单页
  33. /// <summary>
  34. /// <returns></returns>
  35. [HttpGet]
  36. public ActionResult Form()
  37. {
  38. return View();
  39. }
  40. [HttpGet]
  41. public ActionResult SelectForm()
  42. {
  43. return View();
  44. }
  45. [HttpGet]
  46. public ActionResult GirdSelectIndex()
  47. {
  48. return View();
  49. }
  50. #endregion
  51. #region 获取数据
  52. [HttpGet]
  53. [AjaxOnly]
  54. public ActionResult GetUserList(string objectId, string type)
  55. {
  56. IEnumerable<UserEntity> data = null;
  57. if (type == "up")
  58. {
  59. data = perm_UserPermissionIBLL.GetUserList(objectId);
  60. }
  61. if (type == "ug")
  62. {
  63. data = permChartGroupIbll.GetUserList(objectId);
  64. }
  65. return JsonResult(data);
  66. }
  67. /// <summary>
  68. /// 获取页面显示列表数据
  69. /// <summary>
  70. /// <param name="queryJson">查询参数</param>
  71. /// <returns></returns>
  72. [HttpGet]
  73. [AjaxOnly]
  74. public ActionResult GetPageList(string pagination, string queryJson)
  75. {
  76. Pagination paginationobj = pagination.ToObject<Pagination>();
  77. var data = perm_UserPermissionIBLL.GetPageList(paginationobj, queryJson);
  78. var jsonData = new
  79. {
  80. rows = data,
  81. total = paginationobj.total,
  82. page = paginationobj.page,
  83. records = paginationobj.records
  84. };
  85. return Success(jsonData);
  86. }
  87. /// <summary>
  88. /// 获取表单数据
  89. /// <summary>
  90. /// <returns></returns>
  91. [HttpGet]
  92. [AjaxOnly]
  93. public ActionResult GetFormData(string keyValue)
  94. {
  95. var Perm_UserPermissionData = perm_UserPermissionIBLL.GetPerm_UserPermissionEntity(keyValue);
  96. var jsonData = new
  97. {
  98. Perm_UserPermission = Perm_UserPermissionData,
  99. };
  100. return Success(jsonData);
  101. }
  102. #endregion
  103. #region 提交数据
  104. /// <summary>
  105. /// 删除实体数据
  106. /// <param name="keyValue">主键</param>
  107. /// <summary>
  108. /// <returns></returns>
  109. [HttpPost]
  110. [AjaxOnly]
  111. public ActionResult DeleteForm(string keyValue)
  112. {
  113. perm_UserPermissionIBLL.DeleteEntity(keyValue);
  114. return Success("删除成功!");
  115. }
  116. /// <summary>
  117. /// 保存实体数据(新增、修改)
  118. /// <param name="keyValue">主键</param>
  119. /// <summary>
  120. /// <returns></returns>
  121. [HttpPost]
  122. [ValidateAntiForgeryToken]
  123. [AjaxOnly]
  124. public ActionResult SaveForm(string objectId, string userIds, string type)
  125. {
  126. if (type == "up")
  127. {
  128. perm_UserPermissionIBLL.SaveEntity(objectId, userIds);
  129. }
  130. if (type == "ug")
  131. {
  132. permChartGroupIbll.SaveUsers(objectId, userIds);
  133. }
  134. return Success("保存成功!");
  135. }
  136. [HttpPost]
  137. [ValidateAntiForgeryToken]
  138. [AjaxOnly]
  139. public ActionResult SaveRoleFun(string FId, string roleids)
  140. {
  141. if (!string.IsNullOrEmpty(roleids))
  142. {
  143. List<string> roleList = roleids.Split(',').ToList();
  144. perm_UserPermissionIBLL.SaveRoleFun(FId, roleList);
  145. }
  146. return Success("保存成功!");
  147. }
  148. #endregion
  149. }
  150. }