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.

PostController.cs 4.5 KiB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. using System.Linq;
  2. using Learun.Application.Organization;
  3. using System.Web.Mvc;
  4. namespace Learun.Application.Web.Areas.LR_OrganizationModule.Controllers
  5. {
  6. /// <summary>
  7. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  8. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  9. /// 创建人:陈彬彬
  10. /// 日 期:2017.03.09
  11. /// 描 述:岗位管理
  12. /// </summary>
  13. public class PostController : MvcControllerBase
  14. {
  15. private PostIBLL postIBLL = new PostBLL();
  16. private CompanyIBLL companyIBLL = new CompanyBLL();
  17. #region 获取视图
  18. /// <summary>
  19. /// 主页
  20. /// </summary>
  21. /// <returns></returns>
  22. [HttpGet]
  23. public ActionResult Index()
  24. {
  25. return View();
  26. }
  27. /// <summary>
  28. /// 表单
  29. /// </summary>
  30. /// <returns></returns>
  31. [HttpGet]
  32. public ActionResult Form()
  33. {
  34. return View();
  35. }
  36. /// <summary>
  37. /// 岗位选择页面
  38. /// </summary>
  39. /// <returns></returns>
  40. [HttpGet]
  41. public ActionResult SelectForm()
  42. {
  43. return View();
  44. }
  45. #endregion
  46. #region 获取数据
  47. /// <summary>
  48. /// 获取岗位列表信息
  49. /// </summary>
  50. /// <param name="keyWord">查询关键字</param>
  51. /// <returns></returns>
  52. [HttpGet]
  53. [AjaxOnly]
  54. public ActionResult GetList(string companyId, string keyword, string departmentId)
  55. {
  56. var data = postIBLL.GetList(companyId, keyword, departmentId);
  57. return JsonResult(data);
  58. }
  59. /// <summary>
  60. /// 获取树形数据
  61. /// </summary>
  62. /// <param name="companyId">公司主键</param>
  63. /// <returns></returns>
  64. [HttpGet]
  65. [AjaxOnly]
  66. public ActionResult GetTree(string companyId)
  67. {
  68. var data = postIBLL.GetTree(companyId);
  69. return JsonResult(data);
  70. }
  71. [HttpGet]
  72. [AjaxOnly]
  73. public ActionResult GetAllTree(string companyId, string parentId)
  74. {
  75. if (string.IsNullOrEmpty(companyId))
  76. {
  77. var companylist = companyIBLL.GetList();
  78. var data = postIBLL.GetAllTree(companylist);
  79. return JsonResult(data);
  80. }
  81. else
  82. {
  83. var data = postIBLL.GetTree(companyId, parentId);
  84. return JsonResult(data);
  85. }
  86. }
  87. /// <summary>
  88. /// 获取岗位名称
  89. /// </summary>
  90. /// <param name="keyValue">岗位主键</param>
  91. /// <returns></returns>
  92. [HttpGet]
  93. [AjaxOnly]
  94. public ActionResult GetEntityName(string keyValue)
  95. {
  96. if (keyValue == "0")
  97. {
  98. return SuccessString("");
  99. }
  100. var data = postIBLL.GetEntity(keyValue);
  101. return SuccessString(data.F_Name);
  102. }
  103. /// <summary>
  104. /// 获取岗位实体数据
  105. /// </summary>
  106. /// <param name="keyValue">岗位主键</param>
  107. /// <returns></returns>
  108. [HttpGet]
  109. [AjaxOnly]
  110. public ActionResult GetEntity(string keyValue)
  111. {
  112. var data = postIBLL.GetEntity(keyValue);
  113. return JsonResult(data);
  114. }
  115. #endregion
  116. #region 提交数据
  117. /// <summary>
  118. /// 保存表单数据
  119. /// </summary>
  120. /// <param name="keyValue">主键</param>
  121. /// <param name="entity">实体</param>
  122. /// <returns></returns>
  123. [HttpPost]
  124. [ValidateAntiForgeryToken]
  125. [AjaxOnly]
  126. public ActionResult SaveForm(string keyValue, PostEntity entity)
  127. {
  128. var list = postIBLL.GetList(entity.F_CompanyId);
  129. if (list.Any(a => a.F_EnCode == entity.F_EnCode))
  130. {
  131. return Fail("岗位编号重复");
  132. }
  133. postIBLL.SaveEntity(keyValue, entity);
  134. return Success("保存成功!");
  135. }
  136. /// <summary>
  137. /// 删除表单数据
  138. /// </summary>
  139. /// <param name="keyValue">主键</param>
  140. /// <returns></returns>
  141. [HttpPost]
  142. [AjaxOnly]
  143. public ActionResult DeleteForm(string keyValue)
  144. {
  145. postIBLL.VirtualDelete(keyValue);
  146. return Success("删除成功!");
  147. }
  148. #endregion
  149. }
  150. }