From c550301b4ad65c7baee197e8d1d03d4745e9f3e0 Mon Sep 17 00:00:00 2001 From: jjh Date: Thu, 15 Feb 2024 18:04:02 +0900 Subject: [PATCH] =?UTF-8?q?=EC=82=AC=EC=A0=84=ED=86=B5=EC=A7=80=EC=84=9C,?= =?UTF-8?q?=20=EA=B3=A0=EC=A7=80=EC=84=9C=EC=B6=9C=EB=A0=A5(pdf)=20?= =?UTF-8?q?=EC=88=98=EC=A0=95.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WEB-INF/jsp/fims/sndb/sndb01080-info.jsp | 56 +++++++++---- .../WEB-INF/jsp/fims/sndb/sndb01100-info.jsp | 78 +++++++++++++++---- .../WEB-INF/jsp/fims/sprt/sprt02020-info.jsp | 35 +++++---- 3 files changed, 126 insertions(+), 43 deletions(-) diff --git a/src/main/webapp/WEB-INF/jsp/fims/sndb/sndb01080-info.jsp b/src/main/webapp/WEB-INF/jsp/fims/sndb/sndb01080-info.jsp index 54e1d948..8c7e12e8 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/sndb/sndb01080-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/sndb/sndb01080-info.jsp @@ -530,28 +530,52 @@ url = wctx.url("/" + taskSeCd + $P.PrefixUrl + "/080/makeAdvntceOutsourcing.do"); } - let params = {}; + let params = { + sndngId : $P.control.dataset.getValue("SNDNG_ID") // 발송 ID + , taskSeCd : taskSeCd + }; - params.sndngId = $P.control.dataset.getValue("SNDNG_ID") // 발송 ID - params.taskSeCd = taskSeCd; + let inBrowser = false; if (fileType == "pdf") { params.paperSeCd = paper; + inBrowser = true; } - ajax.post({ - url : url - , data : params - , success : (resp) => { - if (resp.filePath != null && resp.filePath != "") { - if (fileType == "pdf") { - openPDF(resp.filePath, resp.fileName, resp.fileName); - } else { - downloadFile(resp.filePath, resp.fileName, "tempArea--${pageName}"); - } - } - } - }); + if (inBrowser) { + let parameter = toQuery(params); + let filenameInHeader = ""; + + fetch(url + "?" + parameter) + .then((response) => { + let header = response.headers.get('Content-Disposition'); + let parts = header.split(';'); + filenameInHeader = decodeURIComponent(parts[1].split('=')[1]); + + return response.blob(); + }) + .then((blob) => { + openPDF(blob, filenameInHeader); + }); + } else { + let parameter = toQuery(submitParam); + document.location.href = url + "?" + parameter; + } + + +// ajax.post({ +// url : url +// , data : params +// , success : (resp) => { +// if (resp.filePath != null && resp.filePath != "") { +// if (fileType == "pdf") { +// openPDF(resp.filePath, resp.fileName, resp.fileName); +// } else { +// downloadFile(resp.filePath, resp.fileName, "tempArea--${pageName}"); +// } +// } +// } +// }); } // 반송확인 버튼 이벤트 diff --git a/src/main/webapp/WEB-INF/jsp/fims/sndb/sndb01100-info.jsp b/src/main/webapp/WEB-INF/jsp/fims/sndb/sndb01100-info.jsp index 6da223fe..d559039e 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/sndb/sndb01100-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/sndb/sndb01100-info.jsp @@ -27,11 +27,14 @@ - - +