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
9.3 KiB

  1. using Learun.Util;
  2. using System.Data;
  3. using Learun.Application.TwoDevelopment.LR_CodeDemo;
  4. using System.Web.Mvc;
  5. using System.Collections.Generic;
  6. namespace Learun.Application.Web.Areas.LR_CodeDemo.Controllers
  7. {
  8. /// <summary>
  9. /// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架
  10. /// Copyright (c) 2013-2018 上海力软信息技术有限公司
  11. /// 创 建:超级管理员
  12. /// 日 期:2019-05-08 18:30
  13. /// 描 述:甘特图应用
  14. /// </summary>
  15. public class GantProjectController : MvcControllerBase
  16. {
  17. private GantProjectIBLL gantProjectIBLL = new GantProjectBLL();
  18. #region 视图功能
  19. /// <summary>
  20. /// 主页面
  21. /// <summary>
  22. /// <returns></returns>
  23. [HttpGet]
  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. /// <summary>
  38. /// 甘特图
  39. /// <summary>
  40. /// <returns></returns>
  41. [HttpGet]
  42. public ActionResult Gant()
  43. {
  44. return View();
  45. }
  46. /// <summary>
  47. /// 项目主表
  48. /// <summary>
  49. /// <returns></returns>
  50. [HttpGet]
  51. public ActionResult Project()
  52. {
  53. return View();
  54. }
  55. /// <summary>
  56. /// 项目明细
  57. /// <summary>
  58. /// <returns></returns>
  59. [HttpGet]
  60. public ActionResult ProjectDetail()
  61. {
  62. return View();
  63. }
  64. #endregion
  65. #region 获取数据
  66. /// <summary>
  67. /// 获取页面显示列表数据
  68. /// <summary>
  69. /// <param name="queryJson">查询参数</param>
  70. /// <returns></returns>
  71. [HttpGet]
  72. [AjaxOnly]
  73. public ActionResult GetPageList(string pagination, string queryJson)
  74. {
  75. Pagination paginationobj = pagination.ToObject<Pagination>();
  76. var data = gantProjectIBLL.GetPageList(paginationobj, queryJson);
  77. var jsonData = new
  78. {
  79. rows = data,
  80. total = paginationobj.total,
  81. page = paginationobj.page,
  82. records = paginationobj.records
  83. };
  84. return Success(jsonData);
  85. }
  86. /// <summary>
  87. /// 获取表单数据
  88. /// <summary>
  89. /// <returns></returns>
  90. [HttpGet]
  91. [AjaxOnly]
  92. public ActionResult GetFormData(string keyValue)
  93. {
  94. var LR_OA_ProjectData = gantProjectIBLL.GetLR_OA_ProjectEntity(keyValue);
  95. var LR_OA_ProjectDetailData = gantProjectIBLL.GetLR_OA_ProjectDetailList(LR_OA_ProjectData.F_Id);
  96. var jsonData = new
  97. {
  98. LR_OA_Project = LR_OA_ProjectData,
  99. LR_OA_ProjectDetail = LR_OA_ProjectDetailData,
  100. };
  101. return Success(jsonData);
  102. }
  103. /// <summary>
  104. /// 获取甘特图明细数据
  105. /// </summary>
  106. /// <param name="keyword">关键字</param>
  107. /// <returns></returns>
  108. [HttpGet]
  109. [AjaxOnly]
  110. public ActionResult GetProjectList(string keyword)
  111. {
  112. List<object> list = new List<object>();
  113. var projectList = gantProjectIBLL.GetList(keyword);
  114. foreach (var item in projectList)
  115. {
  116. List<object> timeList = new List<object>();
  117. timeList.Add(new
  118. {
  119. beginTime = item.F_StartTime.ToString(),
  120. endTime = item.F_EndTime.ToString(),
  121. color = string.IsNullOrEmpty(item.F_Status) ? "#3286ed" : item.F_Status,
  122. overtime = false,
  123. text = item.F_ProjectName
  124. });
  125. var data = new
  126. {
  127. id = item.F_Id,
  128. text = item.F_ProjectName,
  129. isexpand = false,
  130. complete = false,
  131. timeList = timeList,
  132. hasChildren = true
  133. };
  134. if (!string.IsNullOrEmpty(keyword))
  135. {
  136. if (data.text.IndexOf(keyword) != -1)
  137. {
  138. list.Add(data);
  139. }
  140. }
  141. else
  142. {
  143. list.Add(data);
  144. };
  145. }
  146. return Success(list);
  147. }
  148. /// <summary>
  149. /// 获取甘特图数据
  150. /// </summary>
  151. /// <param name="parenId">父键</param>
  152. /// <returns></returns>
  153. [HttpGet]
  154. [AjaxOnly]
  155. public ActionResult GetProjectDetail(string parentId)
  156. {
  157. List<object> list = new List<object>();
  158. var projectDetail = gantProjectIBLL.GetDetailList(parentId);
  159. foreach (var item in projectDetail)
  160. {
  161. List<object> timeList = new List<object>();
  162. timeList.Add(new
  163. {
  164. beginTime = item.F_StartTime.ToString(),
  165. endTime = item.F_EndTime.ToString(),
  166. color = string.IsNullOrEmpty(item.F_Status) ? "#1bb99a" : item.F_Status,
  167. overtime = false,
  168. text = item.F_ItemName
  169. });
  170. var data = new
  171. {
  172. id = item.F_Id,
  173. text = item.F_ItemName,
  174. isexpand = false,
  175. complete = true,
  176. timeList = timeList,
  177. hasChildren = false
  178. };
  179. list.Add(data);
  180. }
  181. return Success(list);
  182. }
  183. /// <summary>
  184. /// 获取表单数据
  185. /// <summary>
  186. /// <returns></returns>
  187. [HttpGet]
  188. [AjaxOnly]
  189. public ActionResult GetGantData(string keyValue)
  190. {
  191. var LR_OA_ProjectData = gantProjectIBLL.GetLR_OA_ProjectEntity(keyValue);
  192. var jsonData = new
  193. {
  194. LR_OA_Project = LR_OA_ProjectData,
  195. };
  196. return Success(jsonData);
  197. }
  198. /// <summary>
  199. /// 获取表单数据
  200. /// <summary>
  201. /// <returns></returns>
  202. [HttpGet]
  203. [AjaxOnly]
  204. public ActionResult GetGantDetail(string keyValue)
  205. {
  206. var LR_OA_ProjectDetailData = gantProjectIBLL.GetLR_OA_ProjectDetailEntity(keyValue);
  207. var jsonData = new
  208. {
  209. LR_OA_ProjectDetail = LR_OA_ProjectDetailData,
  210. };
  211. return Success(jsonData);
  212. }
  213. #endregion
  214. #region 提交数据
  215. /// <summary>
  216. /// 删除实体数据
  217. /// <param name="keyValue">主键</param>
  218. /// <summary>
  219. /// <returns></returns>
  220. [HttpPost]
  221. [AjaxOnly]
  222. public ActionResult DeleteForm(string keyValue)
  223. {
  224. gantProjectIBLL.DeleteEntity(keyValue);
  225. return Success("删除成功!");
  226. }
  227. /// <summary>
  228. /// 删除明细数据
  229. /// <param name="keyValue">主键</param>
  230. /// <summary>
  231. /// <returns></returns>
  232. [HttpPost]
  233. [AjaxOnly]
  234. public ActionResult DeleteDetail(string keyValue)
  235. {
  236. gantProjectIBLL.DeleteDetail(keyValue);
  237. return Success("删除成功!");
  238. }
  239. /// <summary>
  240. /// 保存实体数据(新增、修改)
  241. /// <param name="keyValue">主键</param>
  242. /// <summary>
  243. /// <returns></returns>
  244. [HttpPost]
  245. [ValidateAntiForgeryToken]
  246. [AjaxOnly]
  247. public ActionResult SaveForm(string keyValue, string strEntity, string strlR_OA_ProjectDetailList)
  248. {
  249. LR_OA_ProjectEntity entity = strEntity.ToObject<LR_OA_ProjectEntity>();
  250. List<LR_OA_ProjectDetailEntity> lR_OA_ProjectDetailList = strlR_OA_ProjectDetailList.ToObject<List<LR_OA_ProjectDetailEntity>>();
  251. gantProjectIBLL.SaveEntity(keyValue, entity, lR_OA_ProjectDetailList);
  252. return Success("保存成功!");
  253. }
  254. /// <summary>
  255. /// 保存表头实体数据(新增、修改)
  256. /// <param name="keyValue">主键</param>
  257. /// <summary>
  258. /// <returns></returns>
  259. [HttpPost]
  260. [ValidateAntiForgeryToken]
  261. [AjaxOnly]
  262. public ActionResult SaveGant(string keyValue, string strEntity)
  263. {
  264. LR_OA_ProjectEntity entity = strEntity.ToObject<LR_OA_ProjectEntity>();
  265. gantProjectIBLL.SaveGant(keyValue, entity);
  266. return Success("保存成功!");
  267. }
  268. /// <summary>
  269. /// 保存明细实体数据(新增、修改)
  270. /// <param name="keyValue">主键</param>
  271. /// <summary>
  272. /// <returns></returns>
  273. [HttpPost]
  274. [ValidateAntiForgeryToken]
  275. [AjaxOnly]
  276. public ActionResult SaveDetail(string keyValue, string strEntity)
  277. {
  278. LR_OA_ProjectDetailEntity entity = strEntity.ToObject<LR_OA_ProjectDetailEntity>();
  279. gantProjectIBLL.SaveDetail(keyValue, entity);
  280. return Success("保存成功!");
  281. }
  282. #endregion
  283. }
  284. }