From 1d115d476b60489869e5da4619cfce41b3b2e944 Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Mon, 14 Aug 2023 18:53:32 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B6=80=EA=B3=BC=20=EC=A0=9C=EC=99=B8=20?= =?UTF-8?q?=EB=93=B1=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/crdn/crdn06020-main.jsp | 5 +- .../WEB-INF/jsp/fims/cvlc/cvlc01020-info.jsp | 94 ++++++++++--------- 2 files changed, 53 insertions(+), 46 deletions(-) diff --git a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn06020-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn06020-main.jsp index ea638697..459e33bb 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn06020-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn06020-main.jsp @@ -621,8 +621,7 @@ $(document).ready(function(){ var params = { "crdnId" : info.data.CRDN_ID, "levyExclSeCd" : levyExclSeCd, - "openerPageName" : "crdn06020-main", - "callbackFuncName" : "pageObject['crdn06020-main']['exclCallback']", + "savedCallbackFuncName" : "pageObject['crdn06020-main']['exclSavedCallback']", }; ajax.get({ @@ -648,7 +647,7 @@ $(document).ready(function(){ }); }; - $P.exclCallback = (saved) => { + $P.exclSavedCallback = (saved) => { if(saved){ $P.refreshInspectionList(); } diff --git a/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc01020-info.jsp b/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc01020-info.jsp index 050351bd..a3abcaee 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc01020-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/cvlc/cvlc01020-info.jsp @@ -357,7 +357,8 @@ $(document).ready(function(){ urls : { load : "", getInfo : wctx.url("/${taskSeCd}/cvlc/cvlc01/020/info.do"), - update : wctx.url("/${taskSeCd}/cvlc/cvlc01/020/save.do") + update : wctx.url("/${taskSeCd}/cvlc/cvlc01/020/save.do"), + create : "" }, keymapper:info => info ? info.CRDN_ID : "", dataGetter:obj => obj.crdnInfo, @@ -367,11 +368,9 @@ $(document).ready(function(){ }); - $P.crdnControl.save = (info) => { + $P.crdnControl.save = (info, accept) => { if (!info) return; - var item = $P.crdnControl.getCurrent("item"), - create = "added" == item.state; - + var formData = new FormData(document.getElementById("frmFile--${pageName}")); for(var key in info) { var value = info[key]; @@ -391,8 +390,6 @@ $(document).ready(function(){ $P.captureFileArr.forEach(item => formData.append("newFileList",item)); } - - if($P.existFileArr.length > 0){ for(var i=0; i < $P.existFileArr.length; i++){ if($P.existFileArr[i].status == "delete"){ @@ -404,12 +401,16 @@ $(document).ready(function(){ } } - formData.append("acceptYn", "Y"); + if(accept){ + formData.append("acceptYn", "Y"); + } else { + formData.append("acceptYn", "N"); + } ajax.post({ - url:!create ? $P.crdnControl.urls.update : $P.crdnControl.urls.create, - data: formData, contentType : false, processData : false, - success:resp => $P.crdnControl.onSave(resp) + url : $P.crdnControl.urls.update, + data : formData, contentType : false, processData : false, + success : resp => { $P.crdnControl.onSave(resp); } }); }; @@ -430,8 +431,35 @@ $(document).ready(function(){ $P.crdnControl.onSave = (resp) => { if (resp.saved) { + dialog.alert("저장됐습니다."); - dialog.close("cvlcptInitialDataEditDialog--${openerPageName}"); + + if($("#levyExcldialog--${pageName}").length > 0){ + dialog.close("levyExcldialog--${pageName}"); + } + + var crdnId = $("#crdnId--${pageName}").val(); + + var cursorKey = ""; + + var nextKey = $P.provided.getNextKey(crdnId); + if(nextKey != ""){ + cursorKey = nextKey; + } else { + var prevKey = $P.provided.getPrevKey(crdnId); + if(prevKey != ""){ + cursorKey = prevKey; + } + } + + $P.provided.refreshList(); + + if(cursorKey != ""){ + $P.fnGo(cursorKey); + } else { + dialog.close("cvlcptInitialDataEditDialog--${openerPageName}"); + } + } }; /************************************************************************** @@ -540,7 +568,7 @@ $(document).ready(function(){ dialog.alert({ content:"현재 단속 정보를 저장하시겠습니까?", onOK:() => { - $P.crdnControl.save($P.formFields.get()); + $P.crdnControl.save($P.formFields.get(), true); } }); @@ -604,8 +632,7 @@ $(document).ready(function(){ var params = { "crdnId" : crdnId, "levyExclSeCd" : levyExclSeCd, - "openerPageName" : "cvlc01020-info", - "callbackFuncName" : "pageObject['cvlc01020-info']['exclCallback']", + "saveCallbackFuncName" : "pageObject['cvlc01020-info']['exclSaveCallback']" }; ajax.get({ @@ -614,7 +641,7 @@ $(document).ready(function(){ success : resp => { dialog.open({ - id : "levyExcldialog", + id : "levyExcldialog--${pageName}", title : "부과제외 정보", content : resp, size : "lg", @@ -625,32 +652,13 @@ $(document).ready(function(){ }); }; - $P.exclCallback = function(saved){ - if(saved){ - - var crdnId = $("#crdnId--${pageName}").val(); - - var cursorKey = ""; - - var nextKey = $P.provided.getNextKey(crdnId); - if(nextKey != ""){ - cursorKey = nextKey; - } else { - var prevKey = $P.provided.getPrevKey(crdnId); - if(prevKey != ""){ - cursorKey = prevKey; - } - } - - $P.provided.refreshList(); - - if(cursorKey != ""){ - $P.fnGo(cursorKey); - } else { - dialog.close("cvlcptInitialDataEditDialog--${openerPageName}"); - } - } - }; + + $P.exclSaveCallback = function(exclInfo){ + + var mergeInfo = {...$P.formFields.get(), ...exclInfo} + + $P.crdnControl.save(mergeInfo, false); + } $P.fnPrev = () => { var prevKey = $P.provided.getPrevKey($("#crdnId--${pageName}").val()); @@ -715,7 +723,7 @@ $(document).ready(function(){ dialog.alert({ content : "현 자료의 복사본을 생성하겠습니까?", onOK : () => { - + //$P.crdnControl.copy($P.formFields.get()); } }); }