using Learun.Util; using System.Data; using Learun.Application.TwoDevelopment.EducationalAdministration; using System.Web.Mvc; using System.Collections.Generic; using System.Linq; using Learun.Application.Organization; using Learun.Application.TwoDevelopment.LR_Desktop; namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers { /// /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 /// 创 建:超级管理员 /// 日 期:2021-06-21 18:39 /// 描 述:质量目标管理体系指标模块 /// public class FillinFromController : MvcControllerBase { private FillinFromIBLL fillinFromIBLL = new FillinFromBLL(); private DepartmentBLL departmentIBLL = new DepartmentBLL(); private QualityReportMainIBLL qualityReportMainIBLL = new QualityReportMainBLL(); #region 视图功能 /// /// 主页面 /// /// [HttpGet] public ActionResult Index() { var logininfo = LoginUserInfo.Get(); ViewBag.departmentId = ""; var Model = departmentIBLL.GetEntity(logininfo.companyId, logininfo.departmentId); if (Model.F_Manager == logininfo.realName) { ViewBag.departmentId = logininfo.departmentId; } return View(); } /// /// /// /// [HttpGet] public ActionResult FormIndex() { var logininfo = LoginUserInfo.Get(); ViewBag.isSystem = logininfo.isSystem; ViewBag.departmentId = ""; var Model = departmentIBLL.GetEntity(logininfo.companyId, logininfo.departmentId); if (Model.F_Manager == logininfo.realName) { ViewBag.departmentId = logininfo.departmentId; } return View(); } /// /// 表单页 /// /// [HttpGet] public ActionResult Form() { return View(); } /// /// 设置填报人 /// /// [HttpGet] public ActionResult FormPeople() { return View(); } #endregion #region 获取数据 /// /// 获取页面显示列表数据 /// /// 分页参数 /// 查询参数 /// [HttpGet] [AjaxOnly] public ActionResult GetPageList(string pagination, string queryJson) { Pagination paginationobj = pagination.ToObject(); var data = fillinFromIBLL.GetPageList(paginationobj, queryJson); var jsonData = new { rows = data, total = paginationobj.total, page = paginationobj.page, records = paginationobj.records }; return Success(jsonData); } /// /// 获取表单数据 /// /// 主键 /// [HttpGet] [AjaxOnly] public ActionResult GetFormData(string keyValue) { var FillinFromData = fillinFromIBLL.GetFillinFromEntity(keyValue); if (FillinFromData.FillingCycle == "2") { FillinFromData.FillingTime2 = FillinFromData.FillingTime; } else { FillinFromData.FillingTime1 = FillinFromData.FillingTime; } var jsonData = new { FillinFrom = FillinFromData, }; return Success(jsonData); } #endregion #region 提交数据 /// /// 删除实体数据 /// /// 主键 /// [HttpPost] [AjaxOnly] public ActionResult DeleteForm(string keyValue) { var Models = fillinFromIBLL.GetListByIds(keyValue); foreach (var Model in Models) { Model.State = -1; qualityReportMainIBLL.DelProjectByFId(Model.Id); fillinFromIBLL.SaveEntity(Model.Id, Model); } return Success("作废成功!"); } /// /// 保存实体数据(新增、修改) /// /// 主键 /// 实体 /// [HttpPost] [ValidateAntiForgeryToken] [AjaxOnly] public ActionResult SaveForm(string keyValue, string strEntity) { FillinFromEntity entity = strEntity.ToObject(); if (!string.IsNullOrEmpty(keyValue)) { #region 修改状态 if (entity.State == 1) { entity.State = 2; } #endregion //qualityReportMainIBLL.EditProjectByFId(keyValue); } #region 处理填报日期 if (entity.FillingCycle == "1") { entity.FillingTime = ""; } else if (entity.FillingCycle == "2") { entity.FillingTime = entity.FillingTime2; } else if (entity.FillingCycle == "3") { entity.FillingTime = entity.FillingTime1; } #endregion fillinFromIBLL.SaveEntity(keyValue, entity); return Success("保存成功!"); } #endregion #region 扩展数据 /// /// 提交 /// /// /// [HttpPost] [AjaxOnly] public ActionResult Submit(string keyValue) { var Models = fillinFromIBLL.GetListByIds(keyValue); foreach (var Model in Models) { Model.State = 1; fillinFromIBLL.SaveEntity(Model.Id, Model); } return Success("保存成功!"); } /// /// 隐藏/显示 /// /// /// [HttpPost] [AjaxOnly] public ActionResult HideList(string keyValue) { var Models = fillinFromIBLL.GetListByIds(keyValue); foreach (var Model in Models) { if (Model.IsFlag == 0) { Model.IsFlag = 1; } else { Model.IsFlag = 0; } fillinFromIBLL.SaveEntity(Model.Id, Model); } return Success("保存成功!"); } /// /// 撤回 /// /// /// [HttpPost] [AjaxOnly] public ActionResult DoCanCel(string keyValue) { var Models = fillinFromIBLL.GetListByIds(keyValue); foreach (var Model in Models) { //重新填写 Model.State = 0; Model.FillingPeople = ""; qualityReportMainIBLL.EditProjectByFId(Model.Id); fillinFromIBLL.SaveEntity(Model.Id, Model); } return Success("保存成功!"); } /// /// 归档 /// /// /// public ActionResult IsFile(string keyValue) { var Models = fillinFromIBLL.GetListByIds(keyValue); foreach (var Model in Models) { var ModeList = qualityReportMainIBLL.IsFinish(Model.Id); if (ModeList != null) { if (ModeList.Status == 1) { Model.State = 3; } else { return Success("选中项未上报,归档失败!"); } } else { return Success("选中项未上报,归档失败!"); } fillinFromIBLL.SaveEntity(Model.Id, Model); } return Success("归档成功!"); } #endregion } }