资金监控改成字节流导出

This commit is contained in:
吴方海
2025-06-03 13:25:44 +08:00
parent ee3321bc36
commit 1cc195cb78
4 changed files with 35 additions and 12 deletions
+8 -1
View File
@@ -924,7 +924,14 @@ namespace YLErp.Web.Controllers
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
new ExcelTemplateGenerator().SetTemplateFile(sourceFileName).SetTemplateData(modleDict).OutputToFile(result.PhysicalPath);
return JsonSuccess("导出资金监控成功", result.WebPath);
// 读取字节流
byte[] fileBytes = System.IO.File.ReadAllBytes(result.PhysicalPath);
// 删除临时文件
System.IO.File.Delete(result.PhysicalPath);
// 返回文件流
return File(fileBytes, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", targetFileName);
}
[HttpPost]