工单导入模板下载
This commit is contained in:
parent
45bfff43e1
commit
82e4d55664
@ -68,7 +68,25 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
// return File(stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",fileName);
|
||||
}
|
||||
|
||||
protected IActionResult ExportExcel2(string path, string fileName)
|
||||
{
|
||||
if (!Path.Exists(path))
|
||||
{
|
||||
throw new CustomException(fileName + "文件不存在");
|
||||
}
|
||||
|
||||
var stream = Io.File.OpenRead(path);
|
||||
|
||||
// 设置响应头
|
||||
Response.Headers.Add("Access-Control-Expose-Headers", "Content-Disposition");
|
||||
|
||||
// 对文件名进行编码(使用RFC 5987标准)
|
||||
var encodedFileName = Uri.EscapeDataString(fileName);
|
||||
Response.Headers.Add("Content-Disposition",
|
||||
$"attachment; filename*=UTF-8''{encodedFileName}");
|
||||
|
||||
return File(stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
}
|
||||
#region 方法
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -59,7 +59,7 @@ namespace ZR.Admin.WebApi.Controllers.mes.pro
|
||||
public IActionResult ImportTemplateExcel()
|
||||
{
|
||||
(string, string) result = DownloadImportTemplate("日生产计划模板");//返回文件名和路径
|
||||
return ExportExcel(result.Item2, result.Item1);
|
||||
return ExportExcel2(result.Item2, result.Item1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user