FlowDelegateController.cs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. using LeaRun.Application.Busines.FlowManage;
  2. using LeaRun.Application.Code;
  3. using LeaRun.Application.Entity.FlowManage;
  4. using LeaRun.Util;
  5. using LeaRun.Util.WebControl;
  6. using System.Web.Mvc;
  7. namespace LeaRun.Application.Web.Areas.FlowManage.Controllers
  8. {
  9. /// <summary>
  10. /// 版 本 6.1
  11. /// Copyright (c) 2013-2016 上海力软信息技术有限公司
  12. /// 创建人:陈彬彬
  13. /// 日 期:2016.03.19 13:57
  14. /// 描 述:工作委托
  15. /// </summary>
  16. public class FlowDelegateController : MvcControllerBase
  17. {
  18. private WFDelegate wfDelegate = new WFDelegate();
  19. #region 视图功能
  20. //
  21. // GET: /FlowManage/FlowToOther/
  22. [HttpGet]
  23. [HandlerAuthorize(PermissionMode.Enforce)]
  24. public ActionResult Index()
  25. {
  26. return View();
  27. }
  28. /// <summary>
  29. /// 新增编辑
  30. /// </summary>
  31. /// <returns></returns>
  32. [HttpGet]
  33. public ActionResult Form()
  34. {
  35. return View();
  36. }
  37. #endregion
  38. #region 获取数据
  39. /// <summary>
  40. /// 委托规则列表(分页)
  41. /// </summary>
  42. /// <param name="pagination">分页参数</param>
  43. /// <param name="queryJson">查询参数</param>
  44. /// <returns>返回分页列表Json</returns>
  45. [HttpGet]
  46. public ActionResult GetRulePageListJson(Pagination pagination, string queryJson)
  47. {
  48. string _userId = "";
  49. if (!OperatorProvider.Provider.Current().IsSystem)
  50. {
  51. _userId = OperatorProvider.Provider.Current().UserId;
  52. }
  53. var watch = CommonHelper.TimerStart();
  54. var data = wfDelegate.GetRulePageList(pagination, queryJson, _userId);
  55. var JsonData = new
  56. {
  57. rows = data,
  58. total = pagination.total,
  59. page = pagination.page,
  60. records = pagination.records,
  61. costtime = CommonHelper.TimerEnd(watch)
  62. };
  63. return Content(JsonData.ToJson());
  64. }
  65. /// <summary>
  66. /// 委托记录列表(分页)(type 1:委托记录,其他:被委托记录)
  67. /// </summary>
  68. /// <param name="pagination">分页参数</param>
  69. /// <param name="queryJson">查询参数</param>
  70. /// <param name="type">1:委托记录,其他:被委托记录</param>
  71. /// <returns>返回分页列表Json</returns>
  72. [HttpGet]
  73. public ActionResult GetRecordPageListJson(Pagination pagination, string queryJson,int type)
  74. {
  75. string _userId = "";
  76. if (!OperatorProvider.Provider.Current().IsSystem)
  77. {
  78. _userId = OperatorProvider.Provider.Current().UserId;
  79. }
  80. var watch = CommonHelper.TimerStart();
  81. var data = wfDelegate.GetRecordPageList(pagination, queryJson,type, _userId);
  82. var JsonData = new
  83. {
  84. rows = data,
  85. total = pagination.total,
  86. page = pagination.page,
  87. records = pagination.records,
  88. costtime = CommonHelper.TimerEnd(watch)
  89. };
  90. return Content(JsonData.ToJson());
  91. }
  92. /// <summary>
  93. /// 流程模板信息列表
  94. /// </summary>
  95. /// <returns></returns>
  96. [HttpGet]
  97. public ActionResult GetSchemeInfoList(string ruleId)
  98. {
  99. var data = wfDelegate.GetSchemeInfoList(ruleId);
  100. return Content(data.ToJson());
  101. }
  102. /// <summary>
  103. /// 获取委托规则实体对象
  104. /// </summary>
  105. /// <returns></returns>
  106. [HttpGet]
  107. public ActionResult GetRuleEntityJson(string keyValue)
  108. {
  109. var data = wfDelegate.GetRuleEntity(keyValue);
  110. return Content(data.ToJson());
  111. }
  112. #endregion
  113. #region 提交数据
  114. /// <summary>
  115. /// 保存委托规则
  116. /// </summary>
  117. /// <param name="keyValue"></param>
  118. /// <param name="rlueEntity"></param>
  119. /// <param name="shcemeInfoIds"></param>
  120. /// <returns></returns>
  121. [HttpPost]
  122. [ValidateAntiForgeryToken]
  123. [AjaxOnly]
  124. public ActionResult SaveDelegateRule(string keyValue, string rlueStr, string shcemeInfoIds)
  125. {
  126. WFDelegateRuleEntity entity = rlueStr.ToObject<WFDelegateRuleEntity>();
  127. wfDelegate.SaveDelegateRule(keyValue, entity, shcemeInfoIds.Split(','));
  128. return Success("操作成功。");
  129. }
  130. /// <summary>
  131. /// 删除委托规则
  132. /// </summary>
  133. /// <param name="keyValue"></param>
  134. /// <returns></returns>
  135. [HttpPost]
  136. [ValidateAntiForgeryToken]
  137. [AjaxOnly]
  138. public ActionResult DeleteRule(string keyValue)
  139. {
  140. wfDelegate.DeleteRule(keyValue);
  141. return Success("删除成功。");
  142. }
  143. /// <summary>
  144. /// 启用/停止委托规则
  145. /// </summary>
  146. /// <param name="keyValue"></param>
  147. /// <param name="enableMark"></param>
  148. /// <returns></returns>
  149. [HttpPost]
  150. [ValidateAntiForgeryToken]
  151. [AjaxOnly]
  152. public ActionResult UpdateRuleEnable(string keyValue, int enableMark)
  153. {
  154. wfDelegate.UpdateRuleEnable(keyValue, enableMark);
  155. return Success("操作成功。");
  156. }
  157. #endregion
  158. }
  159. }