|
- 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
- {
- /// <summary>
- /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架
- /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
- /// 创 建:超级管理员
- /// 日 期:2021-06-21 18:39
- /// 描 述:质量目标管理体系指标模块
- /// </summary>
- public class FillinFromController : MvcControllerBase
- {
- private FillinFromIBLL fillinFromIBLL = new FillinFromBLL();
- private DepartmentBLL departmentIBLL = new DepartmentBLL();
- private QualityReportMainIBLL qualityReportMainIBLL = new QualityReportMainBLL();
-
- #region 视图功能
-
- /// <summary>
- /// 主页面
- /// <summary>
- /// <returns></returns>
- [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();
- }
- /// <summary>
- ///
- /// <summary>
- /// <returns></returns>
- [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();
- }
- /// <summary>
- /// 表单页
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Form()
- {
- return View();
- }
- /// <summary>
- /// 设置填报人
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult FormPeople()
- {
- return View();
- }
-
- #endregion
-
- #region 获取数据
-
- /// <summary>
- /// 获取页面显示列表数据
- /// </summary>
- /// <param name="pagination">分页参数</param>
- /// <param name="queryJson">查询参数</param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetPageList(string pagination, string queryJson)
- {
- Pagination paginationobj = pagination.ToObject<Pagination>();
- var data = fillinFromIBLL.GetPageList(paginationobj, queryJson);
- var jsonData = new
- {
- rows = data,
- total = paginationobj.total,
- page = paginationobj.page,
- records = paginationobj.records
- };
- return Success(jsonData);
- }
- /// <summary>
- /// 获取表单数据
- /// </summary>
- /// <param name="keyValue">主键</param>
- /// <returns></returns>
- [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 提交数据
-
- /// <summary>
- /// 删除实体数据
- /// </summary>
- /// <param name="keyValue">主键</param>
- /// <returns></returns>
- [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("作废成功!");
- }
-
- /// <summary>
- /// 保存实体数据(新增、修改)
- /// </summary>
- /// <param name="keyValue">主键</param>
- /// <param name="strEntity">实体</param>
- /// <returns></returns>
- [HttpPost]
- [ValidateAntiForgeryToken]
- [AjaxOnly]
- public ActionResult SaveForm(string keyValue, string strEntity)
- {
- FillinFromEntity entity = strEntity.ToObject<FillinFromEntity>();
- 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 扩展数据
-
- /// <summary>
- /// 提交
- /// </summary>
- /// <param name="keyValue"></param>
- /// <returns></returns>
- [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("保存成功!");
- }
-
- /// <summary>
- /// 隐藏/显示
- /// </summary>
- /// <param name="keyValue"></param>
- /// <returns></returns>
- [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("保存成功!");
- }
-
- /// <summary>
- /// 撤回
- /// </summary>
- /// <param name="keyValue"></param>
- /// <returns></returns>
- [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("保存成功!");
- }
-
- /// <summary>
- /// 归档
- /// </summary>
- /// <param name="keyValue"></param>
- /// <returns></returns>
- 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
- }
- }
|