From 2d7941c2f9754b291de41a8e6c0a96f8b9382797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=B8=A4=E6=97=AD=5BIrelia=5D?= <366601522@qq.com> Date: Thu, 13 Jul 2023 23:07:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AppBase/ZbxBase.cs | 89 ++++++++++++++++--- 1 file changed, 76 insertions(+), 13 deletions(-) diff --git a/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Application/AppBase/ZbxBase.cs b/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Application/AppBase/ZbxBase.cs index 55fb94d..e011fc4 100644 --- a/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Application/AppBase/ZbxBase.cs +++ b/Code/Be/Faster.Zheng.Winin/src/Faster.Zheng.Winin.Application/AppBase/ZbxBase.cs @@ -33,8 +33,6 @@ public class ZbxBase { private readonly IRepository _repository; - private readonly IMapper _mapper; - private Func _mapFunc; protected IStringLocalizer _localizer => LazyServiceProvider.LazyGetRequiredService>(); @@ -42,7 +40,6 @@ public class ZbxBase LazyServiceProvider.LazyGetRequiredService(); - public ZbxBase(IRepository repository) : base(repository) { _repository = repository; @@ -61,6 +58,8 @@ public class ZbxBase> GetPageListByFilterAsync(SfsRequestInputBase sfsRequestInputBase, bool includeDetails = false, CancellationToken cancellationToken = default) { + await CheckGetListPolicyAsync(); + var expression = sfsRequestInputBase.Condition.Filters?.Count > 0 ? sfsRequestInputBase.Condition.Filters.ToLambda() : p => true; @@ -286,7 +285,10 @@ public class ZbxBase p.Name == "Details"); - //从表 + // 子表 var detailList = (IEnumerable)mainAllProperties[detailsIndex].GetValue(mainDto); var startMainRowIndex = rowIndex; for (var datailCount = 0; datailCount < detailList.Count(); datailCount++) @@ -408,13 +412,17 @@ public class ZbxBase /// /// - private static ICellStyle SetExcelDetailsColor(IWorkbook workbook) + private static ICellStyle SetExcelDetailsCellStyle(IWorkbook workbook) + { + var cellStyle = workbook.CreateCellStyle(); + cellStyle.FillBackgroundColor = IndexedColors.Grey25Percent.Index; + cellStyle.FillForegroundColor = IndexedColors.Grey25Percent.Index; + cellStyle.FillPattern = FillPattern.SolidForeground; + return cellStyle; + } + + /// + /// 导出设置只有主表时的交替行 单元格样式 + /// + /// + /// + private static ICellStyle SetExcelOnlyMainCellStyle(IWorkbook workbook) + { + var cellStyle = workbook.CreateCellStyle(); + cellStyle.FillBackgroundColor = IndexedColors.Grey25Percent.Index; + cellStyle.FillForegroundColor = IndexedColors.Grey25Percent.Index; + cellStyle.FillPattern = FillPattern.SolidForeground; + return cellStyle; + } + + /// + /// 设置分割单元格的演示 + /// + /// + /// + private static ICellStyle SetSplitCellStyle(IWorkbook workbook) + { + var cellStyle = workbook.CreateCellStyle(); + cellStyle.BorderLeft = BorderStyle.MediumDashed; + cellStyle.BorderRight = BorderStyle.MediumDashed; + cellStyle.LeftBorderColor = IndexedColors.BrightGreen.Index; + cellStyle.RightBorderColor = IndexedColors.Grey25Percent.Index; + cellStyle.FillBackgroundColor = IndexedColors.White.Index; + cellStyle.FillForegroundColor = IndexedColors.White.Index; + cellStyle.FillPattern = FillPattern.ThickVerticalBands; + return cellStyle; + } + + /// + /// 导出设置表头单元格样式 + /// + /// + /// + private static ICellStyle SetExcelHeadCellStyle(IWorkbook workbook) { var cellStyle = workbook.CreateCellStyle(); cellStyle.FillBackgroundColor = IndexedColors.LightOrange.Index; @@ -559,4 +621,5 @@ public class ZbxBase