From 26f4b91cf7f0536e16391d7cbb5866ef01165aea Mon Sep 17 00:00:00 2001 From: zhichao lei <442149704@qq.com> Date: Fri, 11 Dec 2020 15:24:43 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E8=AF=8A=E6=89=93=E5=8D=A1=20?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=20=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/EpidemicSituationCopy/Index.cshtml | 22 ---------- .../EpidemicSituationCopy/IndexReport.cshtml | 10 ++--- .../EpidemicSituationCopy/IndexReport.js | 10 ++--- .../EpidemicSituationService.cs | 26 ++++++++++- .../Learun.DataBase.Repository/IRepository.cs | 1 + .../Learun.DataBase.Repository/Repository.cs | 44 +++++++++++++++++++ 6 files changed, 77 insertions(+), 36 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/EpidemicSituationCopy/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/EpidemicSituationCopy/Index.cshtml index c2f4b8818..10d01d354 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/EpidemicSituationCopy/Index.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/EpidemicSituationCopy/Index.cshtml @@ -7,28 +7,6 @@
-
-
-
-
-
填表人员
- -
-
-
类别
-
-
-
-
身份证号
- -
-
-
单位名称
- -
-
-
-
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/EpidemicSituationCopy/IndexReport.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/EpidemicSituationCopy/IndexReport.cshtml index cd5f06fdf..19d677a58 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/EpidemicSituationCopy/IndexReport.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/EpidemicSituationCopy/IndexReport.cshtml @@ -12,19 +12,15 @@
填表人员
- +
类别
-
身份证号
- -
-
-
单位名称
- +
系|专业|班级
+
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/EpidemicSituationCopy/IndexReport.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/EpidemicSituationCopy/IndexReport.js index 89963173f..a40972104 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/EpidemicSituationCopy/IndexReport.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/EpidemicSituationCopy/IndexReport.js @@ -5,6 +5,7 @@ * 描 述:疫情记录 */ var refreshGirdData; +var startTime, endTime; var bootstrap = function ($, learun) { "use strict"; var page = { @@ -13,10 +14,13 @@ var bootstrap = function ($, learun) { page.bind(); }, bind: function () { + + $('#multiple_condition_query').lrMultipleQuery(function (queryJson) { page.search(queryJson); }, 220, 400); $('#Type').lrDataItemSelect({ code: 'EUserType' }); + $('#Creater').lrDataSourceSelect({ code: 'BaseUser', value: 'f_userid', text: 'f_realname' }); // 刷新 $('#lr_refresh').on('click', function () { location.reload(); @@ -55,12 +59,6 @@ var bootstrap = function ($, learun) { } }, - { - label: "填报日期", name: "CreateTime", width: 100, align: "left", - formatter: function (value, row) { - return dateFormat("YYYY-mm-dd", new Date(value)); - } - }, { label: "类别", name: "Type", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/EpidemicSituation/EpidemicSituationService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/EpidemicSituation/EpidemicSituationService.cs index fa234e70e..26e75c01f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/EpidemicSituation/EpidemicSituationService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/EpidemicSituation/EpidemicSituationService.cs @@ -144,7 +144,31 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement list.Add(entity); } - list = this.BaseRepository("CollegeMIS").FindList(list, pagination).ToList(); + + + var expression = LinqExtensions.True(); + var queryParam = queryJson.ToJObject(); + // 填表人员 + if (!queryParam["Creater"].IsEmpty()) + { + string Creater = queryParam["Creater"].ToString(); + expression = expression.And(t => t.Creater.Equals(Creater)); + } + // 类别 + if (!queryParam["Type"].IsEmpty()) + { + int Type = 0; + int.TryParse(queryParam["Type"].ToString(), out Type); + expression = expression.And(t => t.Type.Equals(Type)); + } + // 学生来源 + if (!queryParam["StudentSource"].IsEmpty()) + { + string StudentSource = queryParam["StudentSource"].ToString(); + expression = expression.And(t => t.StudentSource.Contains(StudentSource)); + } + + list = this.BaseRepository("CollegeMIS").FindList(list, expression, pagination).ToList(); return list; diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Db/Learun.DataBase.Repository/IRepository.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Db/Learun.DataBase.Repository/IRepository.cs index 17e8f6022..dc84e68e5 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Db/Learun.DataBase.Repository/IRepository.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Db/Learun.DataBase.Repository/IRepository.cs @@ -233,6 +233,7 @@ namespace Learun.DataBase.Repository IEnumerable FindList(Pagination pagination) where T : class, new(); IEnumerable FindList(List data, Pagination pagination) where T : class, new(); + IEnumerable FindList(List data, Expression> condition, Pagination pagination) where T : class, new(); /// /// 查询列表(分页) /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Db/Learun.DataBase.Repository/Repository.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Db/Learun.DataBase.Repository/Repository.cs index 6bd529a08..397b9516c 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Db/Learun.DataBase.Repository/Repository.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Db/Learun.DataBase.Repository/Repository.cs @@ -447,11 +447,55 @@ namespace Learun.DataBase.Repository var property = typeof(T).GetProperty(_orderField); var propertyAccess = Expression.MakeMemberAccess(parameter, property); var orderByExp = Expression.Lambda(propertyAccess, parameter); + resultExp = Expression.Call(typeof(Queryable), isAsc ? "OrderBy" : "OrderByDescending", new Type[] { typeof(T), property.PropertyType }, tempData.Expression, Expression.Quote(orderByExp)); } } + if (resultExp != null) + { + tempData = tempData.Provider.CreateQuery(resultExp); + } + pagination.records = tempData.Count(); + tempData = tempData.Skip(pageSize * (pageIndex - 1)).Take(pageSize).AsQueryable(); + return tempData.ToList(); + } + + public IEnumerable FindList(List data, Expression> condition, Pagination pagination) where T : class, new() + { + var isAsc = pagination.sord.ToLower() == "asc" ? true : false; + var pageSize = pagination.rows; + var pageIndex = pagination.page; + string[] _order = pagination.sidx.Split(','); + MethodCallExpression resultExp = null; + var tempData = data.AsQueryable().Where(condition); + foreach (string item in _order) + { + if (!string.IsNullOrEmpty(item)) + { + string _orderPart = item; + _orderPart = Regex.Replace(_orderPart, @"\s+", " "); + string[] _orderArry = _orderPart.Split(' '); + string _orderField = _orderArry[0]; + bool sort = isAsc; + if (_orderArry.Length == 2) + { + isAsc = _orderArry[1].ToUpper() == "ASC" ? true : false; + } + var parameter = Expression.Parameter(typeof(T), "t"); + var property = typeof(T).GetProperty(_orderField); + var propertyAccess = Expression.MakeMemberAccess(parameter, property); + var orderByExp = Expression.Lambda(propertyAccess, parameter); + resultExp = Expression.Call(typeof(Queryable), isAsc ? "OrderBy" : "OrderByDescending", new Type[] { typeof(T), property.PropertyType }, tempData.Expression, Expression.Quote(orderByExp)); + + } + } + if (resultExp != null) + { + tempData = tempData.Provider.CreateQuery(resultExp); + } pagination.records = tempData.Count(); tempData = tempData.Skip(pageSize * (pageIndex - 1)).Take(pageSize).AsQueryable(); + return tempData.ToList(); }