20231113专项检查列表页面优化

This commit is contained in:
2023-11-13 14:19:41 +08:00
parent 7755589aa4
commit e3b8757e91
2 changed files with 141 additions and 48 deletions
@@ -1,4 +1,7 @@
using System;
using FineUIPro;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
@@ -9,6 +12,91 @@ namespace BLL
/// </summary>
public static class Check_CheckSpecialService
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
/// </summary>
public static int count
{
get;
set;
}
/// <summary>
/// 定义变量
/// </summary>
private static IQueryable<Model.Check_CheckSpecial> getDataLists = from x in db.Check_CheckSpecial
select x;
/// <summary>
/// 列表
/// </summary>
/// <param name="projectId"></param>
/// <param name="states"></param>
/// <param name="checkType"></param>
/// <param name="checkItemSetId"></param>
/// <param name="startTime"></param>
/// <param name="endTime"></param>
/// <param name="Grid1"></param>
/// <returns></returns>
public static IEnumerable getListData(string projectId, string states, string checkType, string checkItemSetId, DateTime? startTime, DateTime? endTime, Grid Grid1)
{
IQueryable<Model.Check_CheckSpecial> getDataList = getDataLists;
if (!string.IsNullOrEmpty(projectId))
{
getDataList = getDataList.Where(e => e.ProjectId == projectId);
}
if (states != "-1")
{
getDataList = getDataList.Where(e => e.States == states);
}
if (checkType != "-1")
{
if (checkType == "1")
{
getDataList = getDataList.Where(e => e.CheckType == checkType);
}
else
{
getDataList = getDataList.Where(e => e.CheckType == checkType || e.CheckType == null );
}
}
if (!string.IsNullOrEmpty(checkItemSetId) && checkItemSetId != Const._Null)
{
getDataList = getDataList.Where(e => e.CheckItemSetId == checkItemSetId);
}
if (startTime.HasValue)
{
getDataList = getDataList.Where(e => e.CheckTime >= startTime);
}
if (endTime.HasValue)
{
getDataList = getDataList.Where(e => e.CheckTime <= endTime);
}
count = getDataList.Count();
if (count == 0)
{
return null;
}
getDataList = SortConditionHelper.SortingAndPaging(getDataList, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
return from x in getDataList
select new
{
x.CheckSpecialId,
x.CheckTime,
x.CheckSpecialCode,
CheckItemName =db.Technique_CheckItemSet .First(y=>y.CheckItemSetId ==x. CheckItemSetId).CheckItemName,
CheckTypeName = x.CheckType == "1" ? "联合检查" : "专项检查",
StatesName = x.States == "2" ? "已完成" : (x.States == "1" ? "待整改" : "待提交"),
};
}
#endregion
/// <summary>
/// 根据专项检查ID获取专项检查信息
/// </summary>