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.

FunctionManagerController.cs 4.3 KiB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. using Learun.Application.AppMagager;
  2. using Learun.Util;
  3. using System.Web.Mvc;
  4. namespace Learun.Application.Web.Areas.AppManager.Controllers
  5. {
  6. /// <summary>
  7. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  8. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  9. /// 创建人:陈彬彬
  10. /// 日 期:2017.04.17
  11. /// 描 述:移动功能管理
  12. /// </summary>
  13. public class FunctionManagerController : MvcControllerBase
  14. {
  15. private FunctionIBLL functionIBLL = new FunctionBLL();
  16. #region 视图功能
  17. /// <summary>
  18. /// 管理页面
  19. /// </summary>
  20. /// <returns></returns>
  21. [HttpGet]
  22. public ActionResult Index()
  23. {
  24. return View();
  25. }
  26. /// <summary>
  27. /// 表单页面
  28. /// </summary>
  29. /// <returns></returns>
  30. [HttpGet]
  31. public ActionResult Form()
  32. {
  33. return View();
  34. }
  35. #endregion
  36. #region 获取数据
  37. /// <summary>
  38. /// 获取分页数据
  39. /// </summary>
  40. /// <param name="pagination">分页参数</param>
  41. /// <param name="keyword">关键字</param>
  42. /// <param name="type">类型</param>
  43. /// <returns></returns>
  44. [HttpGet]
  45. [AjaxOnly]
  46. public ActionResult GetPageList(string pagination, string keyword, string type)
  47. {
  48. Pagination paginationobj = pagination.ToObject<Pagination>();
  49. var data = functionIBLL.GetPageList(paginationobj, keyword, type);
  50. var jsonData = new
  51. {
  52. rows = data,
  53. total = paginationobj.total,
  54. page = paginationobj.page,
  55. records = paginationobj.records,
  56. };
  57. return JsonResult(jsonData);
  58. }
  59. /// <summary>
  60. /// 获取表单数据
  61. /// </summary>
  62. /// <param name="keyValue">主键</param>
  63. /// <returns></returns>
  64. [HttpGet]
  65. [AjaxOnly]
  66. public ActionResult GetForm(string keyValue) {
  67. FunctionEntity entity = functionIBLL.GetEntity(keyValue);
  68. FunctionSchemeEntity schemeEntity = functionIBLL.GetScheme(entity.F_SchemeId);
  69. var jsonData = new {
  70. entity= entity,
  71. schemeEntity= schemeEntity
  72. };
  73. return JsonResult(jsonData);
  74. }
  75. /// <summary>
  76. /// 获取树形移动功能列表
  77. /// </summary>
  78. /// <returns></returns>
  79. [HttpGet]
  80. [AjaxOnly]
  81. public ActionResult GetCheckTree()
  82. {
  83. var data = functionIBLL.GetCheckTree();
  84. return JsonResult(data);
  85. }
  86. #endregion
  87. #region 提交数据
  88. /// <summary>
  89. /// 删除表单数据
  90. /// </summary>
  91. /// <param name="keyValue">主键</param>
  92. /// <returns></returns>
  93. [HttpPost]
  94. [AjaxOnly]
  95. public ActionResult DeleteForm(string keyValue)
  96. {
  97. functionIBLL.Delete(keyValue);
  98. return Success("删除成功!");
  99. }
  100. /// <summary>
  101. /// 保存表单数据
  102. /// </summary>
  103. /// <param name="keyValue">主键</param>
  104. /// <param name="strEntity">实体对象字串</param>
  105. /// <param name="strSchemeEntity">模板实体对象字串</param>
  106. /// <returns></returns>
  107. [HttpPost]
  108. [ValidateAntiForgeryToken]
  109. [AjaxOnly]
  110. public ActionResult SaveForm(string keyValue, string strEntity, string strSchemeEntity)
  111. {
  112. FunctionEntity entity = strEntity.ToObject<FunctionEntity>();
  113. FunctionSchemeEntity schemeEntity = strSchemeEntity.ToObject<FunctionSchemeEntity>();
  114. functionIBLL.SaveEntity(keyValue, entity, schemeEntity);
  115. return Success("保存成功!");
  116. }
  117. /// <summary>
  118. /// 启用/停用表单
  119. /// </summary>
  120. /// <param name="keyValue">主键</param>
  121. /// <param name="state">状态1启用0禁用</param>
  122. /// <returns></returns>
  123. [HttpPost]
  124. [AjaxOnly]
  125. public ActionResult UpDateSate(string keyValue, int state)
  126. {
  127. functionIBLL.UpdateState(keyValue, state);
  128. return Success((state == 1 ? "启用" : "禁用") + "成功!");
  129. }
  130. #endregion
  131. }
  132. }