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.
 
 
 
 
 
 

111 lines
3.2 KiB

  1. using Learun.Application.Base.SystemModule;
  2. using System.Web.Mvc;
  3. namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers
  4. {
  5. /// <summary>
  6. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  7. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  8. /// 创建人:陈彬彬
  9. /// 日 期:2017.04.01
  10. /// 描 述:行政区域
  11. /// </summary>
  12. public class AreaController : MvcControllerBase
  13. {
  14. private AreaIBLL areaIBLL = new AreaBLL();
  15. #region 视图功能
  16. /// <summary>
  17. /// 行政区域管理
  18. /// </summary>
  19. /// <returns></returns>
  20. [HttpGet]
  21. public ActionResult Index()
  22. {
  23. return View();
  24. }
  25. /// <summary>
  26. /// 表单
  27. /// </summary>
  28. /// <returns></returns>
  29. [HttpGet]
  30. public ActionResult Form()
  31. {
  32. return View();
  33. }
  34. #endregion
  35. #region 获取数据
  36. /// <summary>
  37. /// 获取列表数据
  38. /// </summary>
  39. /// <param name="parentId">父级主键</param>
  40. /// <param name="keyword">关键字查询(名称/编号)</param>
  41. /// <returns></returns>
  42. [HttpGet]
  43. [AjaxOnly]
  44. public ActionResult Getlist(string parentId, string keyword)
  45. {
  46. var data = areaIBLL.GetList(parentId, keyword);
  47. return JsonResult(data);
  48. }
  49. /// <summary>
  50. /// 获取树形数据
  51. /// </summary>
  52. /// <param name="parentId"></param>
  53. /// <returns></returns>
  54. [HttpGet]
  55. [AjaxOnly]
  56. public ActionResult GetTree(string parentId)
  57. {
  58. var data = areaIBLL.GetTree(parentId);
  59. return JsonResult(data);
  60. }
  61. #endregion
  62. #region 提交数据
  63. /// <summary>
  64. /// 保存表单数据
  65. /// </summary>
  66. /// <param name="keyValue"></param>
  67. /// <param name="entity"></param>
  68. /// <returns></returns>
  69. [HttpPost]
  70. [ValidateAntiForgeryToken]
  71. [AjaxOnly]
  72. public ActionResult SaveForm(string keyValue, AreaEntity entity)
  73. {
  74. var model = areaIBLL.GetEntityByCode(entity.F_AreaCode);
  75. if (string.IsNullOrEmpty(keyValue))
  76. {
  77. if (model.F_AreaCode == entity.F_AreaCode)
  78. {
  79. return Fail("编号重复,新重新输入!");
  80. }
  81. }
  82. else
  83. {
  84. if (model.F_AreaCode == entity.F_AreaCode && model.F_AreaId != keyValue)
  85. {
  86. return Fail("编号重复,新重新输入!");
  87. }
  88. }
  89. areaIBLL.SaveEntity(keyValue, entity);
  90. return Success("保存成功!");
  91. }
  92. /// <summary>
  93. /// 删除表单数据
  94. /// </summary>
  95. /// <param name="keyValue"></param>
  96. /// <returns></returns>
  97. [HttpPost]
  98. [AjaxOnly]
  99. public ActionResult DeleteForm(string keyValue)
  100. {
  101. areaIBLL.VirtualDelete(keyValue);
  102. return Success("删除成功!");
  103. }
  104. #endregion
  105. }
  106. }