diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/ExportUtil.java b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/ExportUtil.java index 1db130bd..f1f29914 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/ExportUtil.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/ExportUtil.java @@ -29,7 +29,8 @@ public class ExportUtil { response.setCharacterEncoding(UTF_8); response.setContentType("application/vnd.ms-excel"); String name = URLEncoder.encode(fileName, UTF_8); - response.setHeader("Content-disposition", "attachment;filename=" + name); + response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); + response.setHeader("Content-Disposition", "attachment;filename=" + name); return response.getOutputStream(); } @@ -37,7 +38,8 @@ public class ExportUtil { response.setCharacterEncoding(UTF_8); response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); String name = URLEncoder.encode(fileName, UTF_8); - response.setHeader("Content-disposition", "attachment;filename=" + name); + response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); + response.setHeader("Content-Disposition", "attachment;filename=" + name); return response.getOutputStream(); } @@ -53,7 +55,8 @@ public class ExportUtil { response.setCharacterEncoding(UTF_8); response.setContentType("application/octet-stream"); String name = URLEncoder.encode(fileName, UTF_8); - response.setHeader("Content-disposition", "attachment;filename=" + name); + response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); + response.setHeader("Content-Disposition", "attachment;filename=" + name); return response.getWriter(); } @@ -61,7 +64,8 @@ public class ExportUtil { response.setCharacterEncoding(UTF_8); response.setContentType("text/html"); String name = URLEncoder.encode(fileName, UTF_8); - response.setHeader("Content-disposition", "attachment;filename=" + name); + response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); + response.setHeader("Content-Disposition", "attachment;filename=" + name); return response.getWriter(); } diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GammaServiceImpl.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GammaServiceImpl.java index 121b085a..4d93ad02 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GammaServiceImpl.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GammaServiceImpl.java @@ -4491,6 +4491,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi //设置响应类型 response.setContentType("application/octet-stream"); //解决中文不能生成文件 + response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); response.setHeader("Content-Disposition", "attachment; fileName=" + URLEncoder.encode(txtFileName,"UTF-8")); fos = response.getOutputStream(); fos.write(strBuild.toString().getBytes()); @@ -4643,6 +4644,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi //设置响应类型 response.setContentType("application/octet-stream"); //解决中文不能生成文件 + response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); response.setHeader("Content-Disposition", "attachment; fileName=" + URLEncoder.encode(phdFileName,"UTF-8")); fos = response.getOutputStream(); fos.write(spectrum.getBytes());