From 3f903d859da470493807b48c58f8c86990bf8fd4 Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Fri, 19 Jan 2024 13:36:31 +0900 Subject: [PATCH] =?UTF-8?q?pdf=EC=B6=9C=EB=A0=A5=EC=8B=9C=20=EC=83=88?= =?UTF-8?q?=EC=B0=BD=EC=97=90=EC=84=9C=20=EB=AF=B8=EB=A6=AC=EB=B3=B4?= =?UTF-8?q?=EA=B8=B0=20=ED=99=94=EB=A9=B4=EC=9D=B4=20=ED=91=9C=EC=8B=9C?= =?UTF-8?q?=EB=90=98=EB=8F=84=EB=A1=9D=20=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/sprt/sprt01140-info.jsp | 13 +++++++------ .../WEB-INF/jsp/fims/sprt/sprt01150-info.jsp | 13 +++++++------ .../WEB-INF/jsp/fims/sprt/sprt01200-main.jsp | 10 +--------- .../js/fims/framework/cmm/cmmUtil.js | 19 +++++++++++++++++++ 4 files changed, 34 insertions(+), 21 deletions(-) diff --git a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01140-info.jsp b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01140-info.jsp index 3c9b668a..64f5ccfc 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01140-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01140-info.jsp @@ -143,12 +143,13 @@ $(document).ready(function(){ data : submitParam, success : (resp) => { if(resp.filePath != null && resp.filePath != ""){ - var a = document.createElement("a"); - a.href = resp.filePath; - a.download = resp.fileName; - document.getElementById("tempArea--${pageName}").appendChild(a); - a.click(); - document.getElementById("tempArea--${pageName}").removeChild(a); + + 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/sprt/sprt01150-info.jsp b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01150-info.jsp index db2b3573..8c923866 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01150-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01150-info.jsp @@ -141,12 +141,13 @@ $(document).ready(function(){ data : submitParam, success : (resp) => { if(resp.filePath != null && resp.filePath != ""){ - var a = document.createElement("a"); - a.href = resp.filePath; - a.download = resp.fileName; - document.getElementById("tempArea--${pageName}").appendChild(a); - a.click(); - document.getElementById("tempArea--${pageName}").removeChild(a); + + 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/sprt/sprt01200-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01200-main.jsp index 4d6974d5..ba12701a 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01200-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01200-main.jsp @@ -764,15 +764,7 @@ $(document).ready(function(){ data : submitParam, success : (resp) => { if(resp.filePath != null && resp.filePath != ""){ - - var samplePath = resp.filePath; - samplePath = samplePath.replaceAll("\\","%5c"); - - window.open( - wctx.url("/resources/html/pdf.html"+"?"+"path="+samplePath) - ,"pdf_sample" - ,'top=10, left=10' - ); + openPDF(resp.filePath, resp.fileName, "pdf_sample"); } } }); diff --git a/src/main/webapp/resources/js/fims/framework/cmm/cmmUtil.js b/src/main/webapp/resources/js/fims/framework/cmm/cmmUtil.js index 9996b7c9..840c8b79 100644 --- a/src/main/webapp/resources/js/fims/framework/cmm/cmmUtil.js +++ b/src/main/webapp/resources/js/fims/framework/cmm/cmmUtil.js @@ -1,3 +1,22 @@ +function download(filePath, fileName, tempAreaId){ + var a = document.createElement("a"); + a.href = resp.filePath; + a.download = resp.fileName; + document.getElementById(tempAreaId).appendChild(a); + a.click(); + document.getElementById(tempAreaId).removeChild(a); +} + +function openPDF(filePath, fileName, windowName){ + filePath = filePath.replaceAll("\\","%5c"); + + window.open( + wctx.url("/resources/html/pdf.html"+"?"+"path="+filePath) + ,windowName + ,'top=10, left=10' + ); +} + //엑셀 파일 생성 정보 function getCellDefs($th, $td){ var cellDefs = [];