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.
 
 
 
 
 
 

173 lines
5.3 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.Configuration;
  7. namespace Learun.Application.Web.Areas.Permission.Controllers
  8. {
  9. /// <summary>
  10. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  11. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  12. /// 创 建:超级管理员
  13. /// 日 期:2019-04-22 10:59
  14. /// 描 述:应用管理
  15. /// </summary>
  16. public class Perm_FunctionController : MvcControllerBase
  17. {
  18. private Perm_FunctionIBLL perm_FunctionIBLL = new Perm_FunctionBLL();
  19. #region 视图功能
  20. /// <summary>
  21. /// 主页面
  22. /// <summary>
  23. /// <returns></returns>
  24. [HttpGet]
  25. public ActionResult Index()
  26. {
  27. return View();
  28. }
  29. [HttpGet]
  30. public ActionResult TeacherIndex()
  31. {
  32. var logininfo = LoginUserInfo.Get();
  33. ViewBag.UserId = logininfo.userId;
  34. return View();
  35. }
  36. /// <summary>
  37. /// 表单页
  38. /// <summary>
  39. /// <returns></returns>
  40. [HttpGet]
  41. public ActionResult Form()
  42. {
  43. return View();
  44. }
  45. [HttpGet]
  46. public ActionResult FormTeacher()
  47. {
  48. return View();
  49. }
  50. #endregion
  51. #region 获取数据
  52. /// <summary>
  53. /// 获取页面显示列表数据
  54. /// <summary>
  55. /// <param name="queryJson">查询参数</param>
  56. /// <returns></returns>
  57. [HttpGet]
  58. public ActionResult GetPageList(string pagination, string queryJson)
  59. {
  60. string publickey = ConfigurationManager.AppSettings["SSOPublicSecret"];
  61. var logininfo = LoginUserInfo.Get();
  62. Pagination paginationobj = pagination.ToObject<Pagination>();
  63. var data = perm_FunctionIBLL.GetPageList(paginationobj, queryJson);
  64. foreach (var item in data)
  65. {
  66. if (item.FIsManagePage == true)
  67. {
  68. item.FInterfaceUrl = "/SSOSystem/GoTo?sysid="+ DESEncrypt.Encrypt(item.FId, publickey)+ "&openid="+ DESEncrypt.Encrypt(logininfo.userId, publickey);
  69. }
  70. else
  71. {
  72. item.FInterfaceUrl = item.FUrl;
  73. }
  74. }
  75. var jsonData = new
  76. {
  77. rows = data,
  78. total = paginationobj.total,
  79. page = paginationobj.page,
  80. records = paginationobj.records
  81. };
  82. return Success(jsonData);
  83. }
  84. /// <summary>
  85. /// 获取表单数据
  86. /// <summary>
  87. /// <returns></returns>
  88. [HttpGet]
  89. [AjaxOnly]
  90. public ActionResult GetFormData(string keyValue)
  91. {
  92. var Perm_FunctionData = perm_FunctionIBLL.GetPerm_FunctionEntity(keyValue);
  93. if (!string.IsNullOrEmpty(Perm_FunctionData.FSecret))
  94. {
  95. Perm_FunctionData.FSecret = Util.DESEncrypt.Decrypt(Perm_FunctionData.FSecret,
  96. ConfigurationManager.AppSettings["SSOPublicSecret"]);
  97. }
  98. var jsonData = new
  99. {
  100. Perm_Function = Perm_FunctionData,
  101. };
  102. return Success(jsonData);
  103. }
  104. [HttpGet]
  105. [AjaxOnly]
  106. public ActionResult GetUserFormData(string keyValue)
  107. {
  108. var Perm_FunctionData = perm_FunctionIBLL.GetPerm_FunctionEntityByUPId(keyValue);
  109. var jsonData = new
  110. {
  111. Perm_Function = Perm_FunctionData,
  112. };
  113. return Success(jsonData);
  114. }
  115. #endregion
  116. #region 提交数据
  117. /// <summary>
  118. /// 删除实体数据
  119. /// <param name="keyValue">主键</param>
  120. /// <summary>
  121. /// <returns></returns>
  122. [HttpPost]
  123. [AjaxOnly]
  124. public ActionResult DeleteForm(string keyValue)
  125. {
  126. perm_FunctionIBLL.DeleteEntity(keyValue);
  127. return Success("删除成功!");
  128. }
  129. /// <summary>
  130. /// 保存实体数据(新增、修改)
  131. /// <param name="keyValue">主键</param>
  132. /// <summary>
  133. /// <returns></returns>
  134. [HttpPost]
  135. [ValidateAntiForgeryToken]
  136. [AjaxOnly]
  137. public ActionResult SaveForm(string keyValue, string strEntity)
  138. {
  139. Perm_FunctionEntity entity = strEntity.ToObject<Perm_FunctionEntity>();
  140. if (!string.IsNullOrEmpty(entity.FSecret))
  141. {
  142. entity.FSecret = Util.DESEncrypt.Encrypt(entity.FSecret,
  143. ConfigurationManager.AppSettings["SSOPublicSecret"]);
  144. }
  145. perm_FunctionIBLL.SaveEntity(keyValue, entity);
  146. return Success("保存成功!");
  147. }
  148. [HttpPost]
  149. [ValidateAntiForgeryToken]
  150. [AjaxOnly]
  151. public ActionResult SaveUserForm(string keyValue, string strEntity)
  152. {
  153. Perm_FunctionEntity entity = strEntity.ToObject<Perm_FunctionEntity>();
  154. perm_FunctionIBLL.SaveEntityByUPId(keyValue, entity);
  155. return Success("保存成功!");
  156. }
  157. #endregion
  158. }
  159. }