diff --git "a/AntJob.Data/Entity/\344\275\234\344\270\232\344\273\273\345\212\241.Biz.cs" "b/AntJob.Data/Entity/\344\275\234\344\270\232\344\273\273\345\212\241.Biz.cs" index 3b4aaa5..e401a25 100644 --- "a/AntJob.Data/Entity/\344\275\234\344\270\232\344\273\273\345\212\241.Biz.cs" +++ "b/AntJob.Data/Entity/\344\275\234\344\270\232\344\273\273\345\212\241.Biz.cs" @@ -137,13 +137,15 @@ public static IList FindAllByJobIDAndDataTime(Int32 jobId, DateTime dat /// /// /// + /// + /// /// /// /// /// /// /// - public static IEnumerable Search(Int32 id, Int32 appid, Int32 jobid, JobStatus status, DateTime start, DateTime end, String client, String key, PageParameter p) + public static IEnumerable Search(Int32 id, Int32 appid, Int32 jobid, JobStatus status, DateTime dataStart, DateTime dataEnd, DateTime start, DateTime end, String client, String key, PageParameter p) { var exp = new WhereExpression(); @@ -153,6 +155,8 @@ public static IEnumerable Search(Int32 id, Int32 appid, Int32 jobid, Jo if (status >= JobStatus.就绪) exp &= _.Status == status; if (!client.IsNullOrEmpty()) exp &= _.Client == client; if (!key.IsNullOrEmpty()) exp &= _.Data.Contains(key) | _.Message.Contains(key) | _.Key == key; + + exp &= _.DataTime.Between(dataStart, dataEnd); exp &= _.DataTime.Between(start, end); return FindAll(exp, p); @@ -180,7 +184,7 @@ public static IList Search(Int32 taskid, DateTime start, DateTime end, if (start.Year > 2000) exp &= _.UpdateTime >= start; if (end.Year > 2000) exp &= _.UpdateTime < end; - return FindAll(exp, _.ID.Asc(), null, 0, count); + return FindAll(exp, _.UpdateTime.Asc(), null, 0, count); } #endregion diff --git a/AntJob.Web/Areas/Ant/Controllers/JobTaskController.cs b/AntJob.Web/Areas/Ant/Controllers/JobTaskController.cs index 1618f5f..72733e4 100644 --- a/AntJob.Web/Areas/Ant/Controllers/JobTaskController.cs +++ b/AntJob.Web/Areas/Ant/Controllers/JobTaskController.cs @@ -6,7 +6,6 @@ using Microsoft.AspNetCore.Mvc; using NewLife; using NewLife.Cube; -using NewLife.Cube.Entity; using NewLife.Cube.Extensions; using NewLife.Cube.ViewModels; using NewLife.Data; @@ -137,16 +136,19 @@ protected override IEnumerable Search(Pager p) var jobid = p["JobID"].ToInt(-1); var appid = p["AppID"].ToInt(-1); var status = (JobStatus)p["Status"].ToInt(-1); + var client = p["Client"]; + + var dataStart = p["dataStart"].ToDateTime(); + var dataEnd = p["dataEnd"].ToDateTime(); var start = p["dtStart"].ToDateTime(); var end = p["dtEnd"].ToDateTime(); - var client = p["Client"]; if (jobid > 0) { ListFields.RemoveField("JobID"); } - return JobTask.Search(id, appid, jobid, status, start, end, client, p["q"], p); + return JobTask.Search(id, appid, jobid, status, dataStart, dataEnd, start, end, client, p["q"], p); } /// 修改状态 diff --git a/AntJob.Web/Areas/Ant/Views/JobTask/_DataRange.cshtml b/AntJob.Web/Areas/Ant/Views/JobTask/_DataRange.cshtml new file mode 100644 index 0000000..bc5bac2 --- /dev/null +++ b/AntJob.Web/Areas/Ant/Views/JobTask/_DataRange.cshtml @@ -0,0 +1,42 @@ +@using NewLife; +@{ + var fmt = Model as String; + var formatStr = !fmt.IsNullOrEmpty() ? fmt : "yyyy-MM-dd"; + var p = ViewBag.Page as Pager; + + var dataStart = p["dataStart"].ToDateTime(); + var dataEnd = p["dataEnd"].ToDateTime(); + var step = (Int32)(dataEnd - dataStart).TotalDays + 1; +} +
+ +
+ @if (formatStr == "yyyy-MM-dd" && (dataStart.Year > 2000 || dataEnd.Year > 2000)) + { + var url = p.GetBaseUrl(true, true, true, new[] { "dataStart", "dataEnd" }); + if (dataStart.Year > 2000 && dataEnd.Year > 2000) url.UrlParam("dataStart", dataStart.AddDays(-step).ToString("yyyy-MM-dd")); + if (dataStart.Year > 2000 && dataEnd.Year > 2000) url.UrlParam("dataEnd", dataEnd.AddDays(-step).ToString("yyyy-MM-dd")); + + } + else + { + + } + +
+ @if (formatStr == "yyyy-MM-dd" && (dataStart.Year > 2000 || dataEnd.Year > 2000)) + { + var url = p.GetBaseUrl(true, true, true, new[] { "dataStart", "dataEnd" }); + if (dataStart.Year > 2000 && dataEnd.Year > 2000) url.UrlParam("dataStart", dataStart.AddDays(step).ToString("yyyy-MM-dd")); + if (dataStart.Year > 2000 && dataEnd.Year > 2000) url.UrlParam("dataEnd", dataEnd.AddDays(step).ToString("yyyy-MM-dd")); + + } + else + { + + } +
+ @**@ + +
+
\ No newline at end of file