diff --git a/Tiobon.Core.Services/CommonServices.cs b/Tiobon.Core.Services/CommonServices.cs index d35f2a04..3ab780ec 100644 --- a/Tiobon.Core.Services/CommonServices.cs +++ b/Tiobon.Core.Services/CommonServices.cs @@ -937,6 +937,17 @@ public partial class CommonServices : BaseServices>, ICommon toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "CopyYN").FirstOrDefault(); if (toolbar != null) { toolbar.fnKey = "TBD4YN"; } + index = result.JM_PageControlT1.Toolbar.FindIndex(x => x.fnKey == "TBD2YN"); + result.JM_PageControlT1.Toolbar.Insert(index + 1, new Toolbar() + { + display = true, + fnKey = "TBD5YN", + fnTitle = "下载", + fnType = "row", + icon = "ghr-icon-download", + position = "left" + }); + break; case "F_Training_Course_Draft": diff --git a/Tiobon.Core.Services/Ghre/Ghre_CourseWareServices.cs b/Tiobon.Core.Services/Ghre/Ghre_CourseWareServices.cs index 17ac99f9..d5fe5bc2 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_CourseWareServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_CourseWareServices.cs @@ -86,15 +86,19 @@ namespace Tiobon.Core.Services public override async Task> QueryFilterPage(QueryBody body) { var result = await base.QueryFilterPage(body); - result.result.DT_TableDataT1.ForEach(async x => + var data = result.result.DT_TableDataT1; + var attachmentIds = data.Select(x => x.Id).ToList(); + var attachments = await _ghre_CourseWareAttachmentServices.Query(x => x.CourseWareId != null && attachmentIds.Contains(x.CourseWareId.Value)); + data.ForEach(async x => { if (!string.IsNullOrWhiteSpace(x.CourseIds)) x.CourseIds2 = JsonConvert.DeserializeObject>(x.CourseIds); x.StudyDuration = $"{x.Hours}小时{x.Minutes}分钟"; x.SourceLabel = await GetParaLabel("CourseWareSource", x.Source); + x.Attachments = attachments.Where(a=> a.CourseWareId == x.Id).ToList(); }); - + result.result.DT_TableDataT1 = data; return result; }