Commit 0e7acd0c by ruyun.zhang

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

parent 43e9ea87
...@@ -812,29 +812,19 @@ public ApiResponse<AttendanceDeptDetail> DeptDetail(int allotId, string unitType ...@@ -812,29 +812,19 @@ public ApiResponse<AttendanceDeptDetail> DeptDetail(int allotId, string unitType
/// <param name="unitType">核算组别</param> /// <param name="unitType">核算组别</param>
/// <param name="accountingUnit">核算单元</param> /// <param name="accountingUnit">核算单元</param>
/// <param name="searchTxet">工号/姓名</param> /// <param name="searchTxet">工号/姓名</param>
/// <param name="fileName"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
[Route("dept/detail/download")] [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); if (!Enum.TryParse(unitType, out UnitType unitType1))
var dpath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Files"); throw new PerformanceException("核算组别错误");
if (!Directory.Exists(dpath)) Directory.CreateDirectory(dpath);
string filepath = Path.Combine(dpath, $"{fileName}{DateTime.Now:yyyyMMdd}.xlsx");
var res = _attendanceService.DeptDetail(allotId, unitType, accountingUnit, searchTxet); var res = _attendanceService.DeptDetail(allotId, unitType, accountingUnit, searchTxet);
var config = new ExcelDownloadRequest() { Name = "考勤上报审核结果" }; var heads = res.Data.Columns.Select(w => new ExcelDownloadHeads { Alias = w.Title, Name = w.Field }).ToList();
if (res.State == ResponseType.OK) var rows = JsonHelper.Deserialize<List<Dictionary<string, object>>>(JsonHelper.Serialize(res.Data.Data));
{
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;
}
UtilExtensions.Export(filepath, config); var filepath = _attendanceService.ExcelDownload(rows, "科室考勤上报结果详情", allotId, heads);
var memoryStream = new MemoryStream(); var memoryStream = new MemoryStream();
using (var stream = new FileStream(filepath, FileMode.Open)) 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