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.
 
 
 
 
 
 

295 lines
8.9 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.departmentId = "";
  33. var Model = departmentIBLL.GetEntity(logininfo.companyId, logininfo.departmentId);
  34. if (Model.F_Manager == logininfo.realName)
  35. {
  36. ViewBag.departmentId = logininfo.departmentId;
  37. }
  38. return View();
  39. }
  40. /// <summary>
  41. ///
  42. /// <summary>
  43. /// <returns></returns>
  44. [HttpGet]
  45. public ActionResult FormIndex()
  46. {
  47. var logininfo = LoginUserInfo.Get();
  48. ViewBag.isSystem = logininfo.isSystem;
  49. ViewBag.departmentId = "";
  50. var Model = departmentIBLL.GetEntity(logininfo.companyId, logininfo.departmentId);
  51. if (Model.F_Manager == logininfo.realName)
  52. {
  53. ViewBag.departmentId = logininfo.departmentId;
  54. }
  55. return View();
  56. }
  57. /// <summary>
  58. /// 表单页
  59. /// <summary>
  60. /// <returns></returns>
  61. [HttpGet]
  62. public ActionResult Form()
  63. {
  64. return View();
  65. }
  66. /// <summary>
  67. /// 设置填报人
  68. /// <summary>
  69. /// <returns></returns>
  70. [HttpGet]
  71. public ActionResult FormPeople()
  72. {
  73. return View();
  74. }
  75. #endregion
  76. #region 获取数据
  77. /// <summary>
  78. /// 获取页面显示列表数据
  79. /// </summary>
  80. /// <param name="pagination">分页参数</param>
  81. /// <param name="queryJson">查询参数</param>
  82. /// <returns></returns>
  83. [HttpGet]
  84. [AjaxOnly]
  85. public ActionResult GetPageList(string pagination, string queryJson)
  86. {
  87. Pagination paginationobj = pagination.ToObject<Pagination>();
  88. var data = fillinFromIBLL.GetPageList(paginationobj, queryJson);
  89. var jsonData = new
  90. {
  91. rows = data,
  92. total = paginationobj.total,
  93. page = paginationobj.page,
  94. records = paginationobj.records
  95. };
  96. return Success(jsonData);
  97. }
  98. /// <summary>
  99. /// 获取表单数据
  100. /// </summary>
  101. /// <param name="keyValue">主键</param>
  102. /// <returns></returns>
  103. [HttpGet]
  104. [AjaxOnly]
  105. public ActionResult GetFormData(string keyValue)
  106. {
  107. var FillinFromData = fillinFromIBLL.GetFillinFromEntity(keyValue);
  108. if (FillinFromData.FillingCycle == "2")
  109. {
  110. FillinFromData.FillingTime2 = FillinFromData.FillingTime;
  111. }
  112. else
  113. {
  114. FillinFromData.FillingTime1 = FillinFromData.FillingTime;
  115. }
  116. var jsonData = new
  117. {
  118. FillinFrom = FillinFromData,
  119. };
  120. return Success(jsonData);
  121. }
  122. #endregion
  123. #region 提交数据
  124. /// <summary>
  125. /// 删除实体数据
  126. /// </summary>
  127. /// <param name="keyValue">主键</param>
  128. /// <returns></returns>
  129. [HttpPost]
  130. [AjaxOnly]
  131. public ActionResult DeleteForm(string keyValue)
  132. {
  133. var Models = fillinFromIBLL.GetListByIds(keyValue);
  134. foreach (var Model in Models)
  135. {
  136. Model.State = -1;
  137. qualityReportMainIBLL.DelProjectByFId(Model.Id);
  138. fillinFromIBLL.SaveEntity(Model.Id, Model);
  139. }
  140. return Success("作废成功!");
  141. }
  142. /// <summary>
  143. /// 保存实体数据(新增、修改)
  144. /// </summary>
  145. /// <param name="keyValue">主键</param>
  146. /// <param name="strEntity">实体</param>
  147. /// <returns></returns>
  148. [HttpPost]
  149. [ValidateAntiForgeryToken]
  150. [AjaxOnly]
  151. public ActionResult SaveForm(string keyValue, string strEntity)
  152. {
  153. FillinFromEntity entity = strEntity.ToObject<FillinFromEntity>();
  154. if (!string.IsNullOrEmpty(keyValue))
  155. {
  156. #region 修改状态
  157. if (entity.State == 1)
  158. {
  159. entity.State = 2;
  160. }
  161. #endregion
  162. //qualityReportMainIBLL.EditProjectByFId(keyValue);
  163. }
  164. #region 处理填报日期
  165. if (entity.FillingCycle == "1")
  166. {
  167. entity.FillingTime = "";
  168. }
  169. else if (entity.FillingCycle == "2")
  170. {
  171. entity.FillingTime = entity.FillingTime2;
  172. }
  173. else if (entity.FillingCycle == "3")
  174. {
  175. entity.FillingTime = entity.FillingTime1;
  176. }
  177. #endregion
  178. fillinFromIBLL.SaveEntity(keyValue, entity);
  179. return Success("保存成功!");
  180. }
  181. #endregion
  182. #region 扩展数据
  183. /// <summary>
  184. /// 提交
  185. /// </summary>
  186. /// <param name="keyValue"></param>
  187. /// <returns></returns>
  188. [HttpPost]
  189. [AjaxOnly]
  190. public ActionResult Submit(string keyValue)
  191. {
  192. var Models = fillinFromIBLL.GetListByIds(keyValue);
  193. foreach (var Model in Models)
  194. {
  195. Model.State = 1;
  196. fillinFromIBLL.SaveEntity(Model.Id, Model);
  197. }
  198. return Success("保存成功!");
  199. }
  200. /// <summary>
  201. /// 隐藏/显示
  202. /// </summary>
  203. /// <param name="keyValue"></param>
  204. /// <returns></returns>
  205. [HttpPost]
  206. [AjaxOnly]
  207. public ActionResult HideList(string keyValue)
  208. {
  209. var Models = fillinFromIBLL.GetListByIds(keyValue);
  210. foreach (var Model in Models)
  211. {
  212. if (Model.IsFlag == 0)
  213. {
  214. Model.IsFlag = 1;
  215. }
  216. else
  217. {
  218. Model.IsFlag = 0;
  219. }
  220. fillinFromIBLL.SaveEntity(Model.Id, Model);
  221. }
  222. return Success("保存成功!");
  223. }
  224. /// <summary>
  225. /// 撤回
  226. /// </summary>
  227. /// <param name="keyValue"></param>
  228. /// <returns></returns>
  229. [HttpPost]
  230. [AjaxOnly]
  231. public ActionResult DoCanCel(string keyValue)
  232. {
  233. var Models = fillinFromIBLL.GetListByIds(keyValue);
  234. foreach (var Model in Models)
  235. {
  236. //重新填写
  237. Model.State = 0;
  238. Model.FillingPeople = "";
  239. qualityReportMainIBLL.EditProjectByFId(Model.Id);
  240. fillinFromIBLL.SaveEntity(Model.Id, Model);
  241. }
  242. return Success("保存成功!");
  243. }
  244. /// <summary>
  245. /// 归档
  246. /// </summary>
  247. /// <param name="keyValue"></param>
  248. /// <returns></returns>
  249. public ActionResult IsFile(string keyValue)
  250. {
  251. var Models = fillinFromIBLL.GetListByIds(keyValue);
  252. foreach (var Model in Models)
  253. {
  254. var ModeList = qualityReportMainIBLL.IsFinish(Model.Id);
  255. if (ModeList != null)
  256. {
  257. if (ModeList.Status == 1)
  258. {
  259. Model.State = 3;
  260. }
  261. else
  262. {
  263. return Success("选中项未上报,归档失败!");
  264. }
  265. }
  266. else
  267. {
  268. return Success("选中项未上报,归档失败!");
  269. }
  270. fillinFromIBLL.SaveEntity(Model.Id, Model);
  271. }
  272. return Success("归档成功!");
  273. }
  274. #endregion
  275. }
  276. }