Commit 0e7acd0c by ruyun.zhang

提交验证,下载修改为统一样式

parent 43e9ea87
......@@ -812,29 +812,19 @@ public ApiResponse<AttendanceDeptDetail> DeptDetail(int allotId, string unitType
/// <param name="unitType">核算组别</param>
/// <param name="accountingUnit">核算单元</param>
/// <param name="searchTxet">工号/姓名</param>
/// <param name="fileName"></param>
/// <returns></returns>
[HttpPost]
[Route("dept/detail/download")]
public IActionResult DeptDetailDownload(int allotId, string unitType, string accountingUnit, string searchTxet, string? fileName)
public IActionResult DeptDetailDownload(int allotId, string unitType, string accountingUnit, string searchTxet)
{
fileName = string.IsNullOrWhiteSpace(fileName) ? "考勤上报审核结果" : Path.GetFileNameWithoutExtension(fileName);
var dpath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Files");
if (!Directory.Exists(dpath)) Directory.CreateDirectory(dpath);
string filepath = Path.Combine(dpath, $"{fileName}{DateTime.Now:yyyyMMdd}.xlsx");
if (!Enum.TryParse(unitType, out UnitType unitType1))
throw new PerformanceException("核算组别错误");
var res = _attendanceService.DeptDetail(allotId, unitType, accountingUnit, searchTxet);
var config = new ExcelDownloadRequest() { Name = "考勤上报审核结果" };
if (res.State == ResponseType.OK)
{
var items = JsonHelper.Deserialize<List<Dictionary<string, object>>>(JsonHelper.Serialize(res.Data.Data));
config.Rows = items;
var columns = res.Data.Columns.Select(w => new EColumn(w.Title, w.Field));
config.Columns = columns;
}
var heads = res.Data.Columns.Select(w => new ExcelDownloadHeads { Alias = w.Title, Name = w.Field }).ToList();
var rows = JsonHelper.Deserialize<List<Dictionary<string, object>>>(JsonHelper.Serialize(res.Data.Data));
UtilExtensions.Export(filepath, config);
var filepath = _attendanceService.ExcelDownload(rows, "科室考勤上报结果详情", allotId, heads);
var memoryStream = new MemoryStream();
using (var stream = new FileStream(filepath, FileMode.Open))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment