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.
 
 
 
 
 
 

296 lines
8.8 KiB

  1. using Learun.Util;
  2. using System.Data;
  3. using Learun.Application.TwoDevelopment.EducationalAdministration;
  4. using System.Web.Mvc;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using Learun.Application.Organization;
  8. using Learun.Application.TwoDevelopment.LR_Desktop;
  9. namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
  10. {
  11. /// <summary>
  12. /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架
  13. /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  14. /// 创 建:超级管理员
  15. /// 日 期:2021-06-21 18:39
  16. /// 描 述:质量目标管理体系指标模块
  17. /// </summary>
  18. public class FillinFromController : MvcControllerBase
  19. {
  20. private FillinFromIBLL fillinFromIBLL = new FillinFromBLL();
  21. private DepartmentBLL departmentIBLL = new DepartmentBLL();
  22. private QualityReportMainIBLL qualityReportMainIBLL = new QualityReportMainBLL();
  23. #region 视图功能
  24. /// <summary>
  25. /// 主页面
  26. /// <summary>
  27. /// <returns></returns>
  28. [HttpGet]
  29. public ActionResult Index()
  30. {
  31. var logininfo = LoginUserInfo.Get();
  32. ViewBag.isSystem = logininfo.isSystem;
  33. ViewBag.departmentId = "";
  34. var Model = departmentIBLL.GetEntity(logininfo.companyId, logininfo.departmentId);
  35. if (Model.F_Manager == logininfo.realName)
  36. {
  37. ViewBag.departmentId = logininfo.departmentId;
  38. }
  39. return View();
  40. }
  41. /// <summary>
  42. ///
  43. /// <summary>
  44. /// <returns></returns>
  45. [HttpGet]
  46. public ActionResult FormIndex()
  47. {
  48. var logininfo = LoginUserInfo.Get();
  49. ViewBag.isSystem = logininfo.isSystem;
  50. ViewBag.departmentId = "";
  51. var Model = departmentIBLL.GetEntity(logininfo.companyId, logininfo.departmentId);
  52. if (Model.F_Manager == logininfo.realName)
  53. {
  54. ViewBag.departmentId = logininfo.departmentId;
  55. }
  56. return View();
  57. }
  58. /// <summary>
  59. /// 表单页
  60. /// <summary>
  61. /// <returns></returns>
  62. [HttpGet]
  63. public ActionResult Form()
  64. {
  65. return View();
  66. }
  67. /// <summary>
  68. /// 设置填报人
  69. /// <summary>
  70. /// <returns></returns>
  71. [HttpGet]
  72. public ActionResult FormPeople()
  73. {
  74. return View();
  75. }
  76. #endregion
  77. #region 获取数据
  78. /// <summary>
  79. /// 获取页面显示列表数据
  80. /// </summary>
  81. /// <param name="pagination">分页参数</param>
  82. /// <param name="queryJson">查询参数</param>
  83. /// <returns></returns>
  84. [HttpGet]
  85. [AjaxOnly]
  86. public ActionResult GetPageList(string pagination, string queryJson)
  87. {
  88. Pagination paginationobj = pagination.ToObject<Pagination>();
  89. var data = fillinFromIBLL.GetPageList(paginationobj, queryJson);
  90. var jsonData = new
  91. {
  92. rows = data,
  93. total = paginationobj.total,
  94. page = paginationobj.page,
  95. records = paginationobj.records
  96. };
  97. return Success(jsonData);
  98. }
  99. /// <summary>
  100. /// 获取表单数据
  101. /// </summary>
  102. /// <param name="keyValue">主键</param>
  103. /// <returns></returns>
  104. [HttpGet]
  105. [AjaxOnly]
  106. public ActionResult GetFormData(string keyValue)
  107. {
  108. var FillinFromData = fillinFromIBLL.GetFillinFromEntity(keyValue);
  109. if (FillinFromData.FillingCycle == "2")
  110. {
  111. FillinFromData.FillingTime2 = FillinFromData.FillingTime;
  112. }
  113. else
  114. {
  115. FillinFromData.FillingTime1 = FillinFromData.FillingTime;
  116. }
  117. var jsonData = new
  118. {
  119. FillinFrom = FillinFromData,
  120. };
  121. return Success(jsonData);
  122. }
  123. #endregion
  124. #region 提交数据
  125. /// <summary>
  126. /// 删除实体数据
  127. /// </summary>
  128. /// <param name="keyValue">主键</param>
  129. /// <returns></returns>
  130. [HttpPost]
  131. [AjaxOnly]
  132. public ActionResult DeleteForm(string keyValue)
  133. {
  134. var Model = fillinFromIBLL.GetFillInNo(keyValue);
  135. if (Model != null)
  136. {
  137. Model.State = -1;
  138. qualityReportMainIBLL.DelProjectByFId(keyValue);
  139. }
  140. fillinFromIBLL.SaveEntity(keyValue, Model);
  141. return Success("作废成功!");
  142. }
  143. /// <summary>
  144. /// 保存实体数据(新增、修改)
  145. /// </summary>
  146. /// <param name="keyValue">主键</param>
  147. /// <param name="strEntity">实体</param>
  148. /// <returns></returns>
  149. [HttpPost]
  150. [ValidateAntiForgeryToken]
  151. [AjaxOnly]
  152. public ActionResult SaveForm(string keyValue, string strEntity)
  153. {
  154. FillinFromEntity entity = strEntity.ToObject<FillinFromEntity>();
  155. if (!string.IsNullOrEmpty(keyValue))
  156. {
  157. #region 修改状态
  158. if (entity.State == 1)
  159. {
  160. entity.State = 2;
  161. }
  162. #endregion
  163. qualityReportMainIBLL.EditProjectByFId(keyValue);
  164. }
  165. #region 处理填报日期
  166. if (entity.FillingCycle == "1")
  167. {
  168. entity.FillingTime = "";
  169. }
  170. else if (entity.FillingCycle == "2")
  171. {
  172. entity.FillingTime = entity.FillingTime2;
  173. }
  174. else if (entity.FillingCycle == "3")
  175. {
  176. entity.FillingTime = entity.FillingTime1;
  177. }
  178. #endregion
  179. fillinFromIBLL.SaveEntity(keyValue, entity);
  180. return Success("保存成功!");
  181. }
  182. #endregion
  183. #region 扩展数据
  184. /// <summary>
  185. /// 提交
  186. /// </summary>
  187. /// <param name="keyValue"></param>
  188. /// <returns></returns>
  189. [HttpPost]
  190. [AjaxOnly]
  191. public ActionResult Submit(string keyValue)
  192. {
  193. var Model = fillinFromIBLL.GetFillInNo(keyValue);
  194. if (Model != null)
  195. {
  196. //重新填写
  197. Model.State = 1;
  198. }
  199. fillinFromIBLL.SaveEntity(keyValue, Model);
  200. return Success("保存成功!");
  201. }
  202. /// <summary>
  203. /// 隐藏/显示
  204. /// </summary>
  205. /// <param name="keyValue"></param>
  206. /// <returns></returns>
  207. [HttpPost]
  208. [AjaxOnly]
  209. public ActionResult HideList(string keyValue)
  210. {
  211. var Model = fillinFromIBLL.GetFillInNo(keyValue);
  212. if (Model != null)
  213. {
  214. if (Model.IsFlag == 0)
  215. {
  216. Model.IsFlag = 1;
  217. }
  218. else
  219. {
  220. Model.IsFlag = 0;
  221. }
  222. }
  223. fillinFromIBLL.SaveEntity(keyValue, Model);
  224. return Success("保存成功!");
  225. }
  226. /// <summary>
  227. /// 撤回
  228. /// </summary>
  229. /// <param name="keyValue"></param>
  230. /// <returns></returns>
  231. [HttpPost]
  232. [AjaxOnly]
  233. public ActionResult DoCanCel(string keyValue)
  234. {
  235. var Model = fillinFromIBLL.GetFillInNo(keyValue);
  236. if (Model != null)
  237. {
  238. //重新填写
  239. Model.State = 0;
  240. Model.FillingPeople = "";
  241. }
  242. qualityReportMainIBLL.EditProjectByFId(keyValue);
  243. fillinFromIBLL.SaveEntity(keyValue, Model);
  244. return Success("保存成功!");
  245. }
  246. /// <summary>
  247. /// 归档
  248. /// </summary>
  249. /// <param name="keyValue"></param>
  250. /// <returns></returns>
  251. public ActionResult IsFile(string keyValue)
  252. {
  253. var Model = fillinFromIBLL.GetFillInNo(keyValue);
  254. if (Model != null)
  255. {
  256. var ModeList = qualityReportMainIBLL.IsFinish(keyValue);
  257. if (ModeList != null)
  258. {
  259. if (ModeList.Status == 1)
  260. {
  261. Model.State = 3;
  262. }
  263. else
  264. {
  265. return Success("归档失败!");
  266. }
  267. }
  268. else
  269. {
  270. return Success("归档失败!");
  271. }
  272. }
  273. fillinFromIBLL.SaveEntity(keyValue, Model);
  274. return Success("归档成功!");
  275. }
  276. #endregion
  277. }
  278. }