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 = [];