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.

ExcelExportController.cs 3.8 KiB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. using Learun.Application.Excel;
  2. using System.Collections.Generic;
  3. using System.Web.Mvc;
  4. using Learun.Util;
  5. namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers
  6. {
  7. /// <summary>
  8. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  9. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  10. /// 创建人:陈彬彬
  11. /// 日 期:2017.04.01
  12. /// 描 述:Excel导出管理
  13. /// </summary>
  14. public class ExcelExportController : MvcControllerBase
  15. {
  16. private ExcelExportIBLL excelExportIBLL = new ExcelExportBLL();
  17. #region 视图功能
  18. [HttpGet]
  19. public ActionResult Index()
  20. {
  21. return View();
  22. }
  23. [HttpGet]
  24. public ActionResult Form()
  25. {
  26. return View();
  27. }
  28. #endregion
  29. #region 获取数据
  30. /// <summary>
  31. /// 获取分页数据
  32. /// </summary>
  33. /// <param name="pagination">分页参数</param>
  34. /// <param name="queryJson">查询参数</param>
  35. /// <returns></returns>
  36. [HttpGet]
  37. [AjaxOnly]
  38. public ActionResult GetPageList(string pagination, string queryJson)
  39. {
  40. Pagination paginationobj = pagination.ToObject<Pagination>();
  41. var data = excelExportIBLL.GetPageList(paginationobj, queryJson);
  42. var jsonData = new
  43. {
  44. rows = data,
  45. total = paginationobj.total,
  46. page = paginationobj.page,
  47. records = paginationobj.records,
  48. };
  49. return JsonResult(jsonData);
  50. }
  51. /// <summary>
  52. /// 获取列表数据
  53. /// </summary>
  54. /// <param name="moduleId">功能模块主键</param>
  55. /// <returns></returns>
  56. [HttpGet]
  57. [AjaxOnly]
  58. public ActionResult GetList(string moduleId)
  59. {
  60. var data = excelExportIBLL.GetList(moduleId);
  61. return JsonResult(data);
  62. }
  63. /// <summary>
  64. /// 获取表单数据
  65. /// <param name="keyValue">主键</param>
  66. /// <summary>
  67. /// <returns></returns>
  68. [HttpGet]
  69. [AjaxOnly]
  70. public ActionResult GetEntity(string keyValue)
  71. {
  72. var data = excelExportIBLL.GetEntity(keyValue);
  73. return JsonResult(data);
  74. }
  75. #endregion
  76. #region 提交数据
  77. /// <summary>
  78. /// 保存表单数据
  79. /// </summary>
  80. /// <param name="keyValue">主键</param>
  81. /// <param name="entity">实体</param>
  82. /// <returns></returns>
  83. [HttpPost]
  84. [ValidateAntiForgeryToken]
  85. [AjaxOnly]
  86. public ActionResult SaveForm(string keyValue, ExcelExportEntity entity)
  87. {
  88. excelExportIBLL.SaveEntity(keyValue, entity);
  89. return Success("保存成功!");
  90. }
  91. /// <summary>
  92. /// 删除表单数据
  93. /// </summary>
  94. /// <param name="keyValue">主键</param>
  95. /// <returns></returns>
  96. [HttpPost]
  97. [AjaxOnly]
  98. public ActionResult DeleteForm(string keyValue)
  99. {
  100. excelExportIBLL.DeleteEntity(keyValue);
  101. return Success("删除成功!");
  102. }
  103. /// <summary>
  104. /// 更新表单数据
  105. /// </summary>
  106. /// <param name="keyValue">主键</param>
  107. /// <param name="entity">实体数据</param>
  108. /// <returns></returns>
  109. [HttpPost]
  110. [AjaxOnly]
  111. public ActionResult UpdateState(string keyValue, int state)
  112. {
  113. ExcelExportEntity entity = new ExcelExportEntity()
  114. {
  115. F_EnabledMark = state
  116. };
  117. excelExportIBLL.SaveEntity(keyValue, entity);
  118. return Success("操作成功!");
  119. }
  120. #endregion
  121. }
  122. }