diff --git a/src/main/java/cokr/xit/fims/crdn/Crdn.java b/src/main/java/cokr/xit/fims/crdn/Crdn.java index dfd3ea32..65f5825f 100644 --- a/src/main/java/cokr/xit/fims/crdn/Crdn.java +++ b/src/main/java/cokr/xit/fims/crdn/Crdn.java @@ -12,6 +12,16 @@ import lombok.Setter; public class Crdn extends AbstractEntity { public static String INF_TYPE = "100"; + /** + * 수정할 파일키 목록 + */ + private String[] modifyFileKeyList; + + /** + * 삭제할 파일키 목록 + */ + private String[] deleteFileKeyList; + /** * 수정 처리할 정보 */ diff --git a/src/main/java/cokr/xit/fims/crdn/web/Crdn01Controller.java b/src/main/java/cokr/xit/fims/crdn/web/Crdn01Controller.java index 453aaded..d0e4c4f9 100644 --- a/src/main/java/cokr/xit/fims/crdn/web/Crdn01Controller.java +++ b/src/main/java/cokr/xit/fims/crdn/web/Crdn01Controller.java @@ -7,6 +7,7 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.ModelAndView; import cokr.xit.base.code.CommonCode; @@ -129,6 +130,8 @@ public class Crdn01Controller extends ApplicationController { DataObject info = crdn01Service.getCivilComplaintReceiptInitialDataInfo(req); mav.addObject("crdnInfo", json ? info : toJson(info)); + + mav.addObject("openerPageName", request.getParameter("openerPageName")); return mav; } @@ -183,6 +186,23 @@ public class Crdn01Controller extends ApplicationController { .addObject("saved", saved); } + /**지정한 민원자료를 저장한다. + * @param crdnId 단속대장 아이디 + * @return jsonView + *
 {
+	 *     "affected": 저장된 정보수
+	 *     "saved": 저장되었으면 true, 그렇지 않으면 false
+	 * }
+ */ + @RequestMapping(name="민원자료 저장", value="/020/save.do") + public ModelAndView saveCivilComplaint(Crdn crdn, MultipartFile[] newFileList, MultipartFile[] modifyFileList) { + + boolean saved = true;// TODO : crdn01Service.saveCivilComplaint + + return new ModelAndView("jsonView") + .addObject("saved", saved); + } + /** 민원내역 원본을 한글 파일로 작성한다. * @return hwp파일 */ diff --git a/src/main/java/cokr/xit/fims/crdn/web/Crdn05Controller.java b/src/main/java/cokr/xit/fims/crdn/web/Crdn05Controller.java index 180bbc25..75269d3a 100644 --- a/src/main/java/cokr/xit/fims/crdn/web/Crdn05Controller.java +++ b/src/main/java/cokr/xit/fims/crdn/web/Crdn05Controller.java @@ -121,14 +121,14 @@ public class Crdn05Controller extends ApplicationController { * } */ @PostMapping(name="단속자료 수기 등록", value="/030/create.do") - public ModelAndView createCrdnDataByManual(Crdn crdn, MultipartFile[] uploadFileList) { + public ModelAndView createCrdnDataByManual(Crdn crdn, MultipartFile[] newFileList) { boolean saved = false; crdn.setCrdnRegSeCd("01"); crdn.setCrdnInptSeCd("03");//TODO : 사용자 기관의 시청,구청 구분 - if(uploadFileList != null) { - List fileInfoList = new FileInfoFactory().makeFileInfos(null, uploadFileList); + if(newFileList != null) { + List fileInfoList = new FileInfoFactory().makeFileInfos(null, newFileList); saved = crdn05Service.create(crdn, fileInfoList); } else { saved = crdn05Service.create(crdn); diff --git a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn01010-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn01010-main.jsp index 7dd61604..02482bb2 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn01010-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn01010-main.jsp @@ -296,7 +296,10 @@ $(document).ready(function(){ ajax.get({ url : $P.crdnControl.urls.getInfo, - data : {"crdnId" : dataKey}, + data : { + "crdnId" : dataKey, + "openerPageName" : "${pageName}" + }, success : resp => { dialog.open({ id : dialogId, diff --git a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn01020-info.jsp b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn01020-info.jsp index 6511f94f..39808873 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn01020-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn01020-info.jsp @@ -253,7 +253,7 @@
- +
@@ -263,7 +263,8 @@
- + +
@@ -273,7 +274,7 @@
-
+
@@ -287,7 +288,7 @@
-
+
@@ -305,6 +306,8 @@ $(document).ready(function(){ var $P = pageObject["${pageName}"]; + $P.existFileArr = []; + $P.captureFileArr = []; $P.localUploadArr = []; $P.numberPlateArr = []; @@ -317,7 +320,7 @@ $(document).ready(function(){ $P.uploadSet = uploadSupport("#inputUploadSet--${pageName}"); $P.crdnControl = new DatasetControl({ - urls : { load : "", create : wctx.url("/${taskSeCd}/crdn/crdn01/020/save.do") }, + urls : { load : "", update : wctx.url("/${taskSeCd}/crdn/crdn01/020/save.do") }, keymapper:info => info ? info.CRDN_ID : "", dataGetter:obj => obj.crdnInfo, formats: { @@ -337,21 +340,31 @@ $(document).ready(function(){ formData.append(key,value); } - if(formData.get("uploadFileList").size == 0){ - formData.delete("uploadFileList"); - } + formData.delete("newFileList"); + formData.delete("modifyFileList"); if($P.localUploadArr.length > 0){ - $P.localUploadArr.forEach(item => formData.append("uploadFileList",item)); + $P.localUploadArr.forEach(item => formData.append("newFileList",item)); } if($P.numberPlateArr.length > 0){ - $P.numberPlateArr.forEach(item => formData.append("uploadFileList",item)); + $P.numberPlateArr.forEach(item => formData.append("newFileList",item)); } if($P.captureFileArr.length > 0){ - $P.captureFileArr.forEach(item => formData.append("uploadFileList",item)); + $P.captureFileArr.forEach(item => formData.append("newFileList",item)); } - //TODO : 편집된 파일, 삭제 사진 키값 + + + if($P.existFileArr.length > 0){ + for(var i=0; i < $P.existFileArr.length; i++){ + if($P.existFileArr[i].status == "delete"){ + formData.append("deleteFileKeyList", $P.existFileArr[i].FILE_ID); + } else if($P.existFileArr[i].status == "modified"){ + formData.append("modifyFileKeyList", $P.existFileArr[i].FILE_ID); + formData.append("modifyFileList", $P.existFileArr[i]); + } + } + } ajax.post({ url:!create ? $P.crdnControl.urls.update : $P.crdnControl.urls.create, @@ -371,14 +384,14 @@ $(document).ready(function(){ var files = $P.uploadSet.getDataset(); files.forEach(item => $P.localUploadArr.push(item)); - $P.fnDisplay(); + $P.fnDisplay(false); }; $P.uploadSet.onRemove = () => { }; $P.crdnControl.onSave = (resp) => { if (resp.saved) { dialog.alert("저장됐습니다."); - dialog.close("manualdialog"); + dialog.close("cvlcptInitialDataEditDialog--${openerPageName}"); } }; /************************************************************************** @@ -387,9 +400,13 @@ $(document).ready(function(){ $P.fnMakeImgForExistFile = (fileArr) => { var tagsText = ""; - for(var index = 0; index < fileArr.length; index++){ + for(var index = 0, j = 0; index < fileArr.length; index++){ var item = fileArr[index]; + if(item.status == "delete"){ + continue; + } + tagsText += ""; - if(index % 2 == 1){ - tagsText += "
" + if(j % 2 == 1){ + tagsText += "
"; } + + j++; } return tagsText; @@ -421,19 +440,31 @@ $(document).ready(function(){ tagsText += ""; if(index % 2 == 1){ - tagsText += "
" + tagsText += "
"; } } return tagsText; } - $P.fnDisplay = () => { - var displayArea = document.querySelector("#display--${pageName}"); - - var concatArr = $P.localUploadArr.concat($P.numberPlateArr).concat($P.captureFileArr); - var tagsText = $P.fnMakeImgForNewFile(concatArr); - displayArea.innerHTML = tagsText; + $P.fnDisplay = (isExist) => { + if(isExist){ + var displayArea = document.querySelector("#displayForExist--${pageName}"); + var tagsText = $P.fnMakeImgForExistFile($P.existFileArr); + + if(tagsText == ""){ + displayArea.innerHTML = "등록된 사진이 없습니다."; + $("#btnEditPhoto--crdn01020-info").hide(); + } else { + displayArea.innerHTML = tagsText; + $("#btnEditPhoto--crdn01020-info").show(); + } + } else { + var displayArea = document.querySelector("#displayForNew--${pageName}"); + var concatArr = $P.localUploadArr.concat($P.numberPlateArr).concat($P.captureFileArr); + var tagsText = $P.fnMakeImgForNewFile(concatArr); + displayArea.innerHTML = tagsText; + } }; $P.fnSave = () => { @@ -471,7 +502,7 @@ $(document).ready(function(){ file.url = (window.URL || window.webkitURL).createObjectURL(file); $P.captureFileArr.push(file); if(index === array.length - 1){ - $P.fnDisplay(); + $P.fnDisplay(false); } }); }); @@ -485,14 +516,19 @@ $(document).ready(function(){ if(isNumberPlate){ $P.numberPlateArr.push(modifiedFile); - $P.fnDisplay(); + $P.fnDisplay(false); } else { - // TODO : 편집된사진 표시 - } - - console.log(originalFileInfo); - + $P.existFileArr.forEach(function(item,index){ + if(item.FILE_ID == originalFileInfo.FILE_ID){ + modifiedFile.URL = modifiedFile.url; + modifiedFile.FILE_ID = originalFileInfo.FILE_ID; + modifiedFile.status = "modified"; + $P.existFileArr.splice(index, 1, modifiedFile); + }; + }); + $P.fnDisplay(true); + } } /************************************************************************** * element.on @@ -511,7 +547,7 @@ $(document).ready(function(){ ); }); $("#btnEditPhoto--${pageName}").on('click', () => { - var checked = $("#display0--${pageName}").find("[name='existPhoto']:checked"); + var checked = $("#displayForExist--${pageName}").find("[name='existPhoto']:checked"); if(checked.length < 1){ alert("선택된 사진이 없습니다."); return; @@ -526,11 +562,26 @@ $(document).ready(function(){ }); $("#btnDeleteExistPhoto--${pageName}").on('click', () => { - //기 등록 사진 삭제 + + var checked = $("#displayForExist--${pageName}").find("[name='existPhoto']:checked"); + if(checked.length < 1){ + alert("선택된 사진이 없습니다."); + return; + } + + var target = checked[0].value; + + $P.existFileArr.forEach(function(item){ + if(item.FILE_ID == target){ + item.status = "delete"; + } + }); + + $P.fnDisplay(true); }); $("#btnCancelAddFile--${pageName}").on('click', () => { - var checked = $("#display--${pageName}").find("[name='newPhoto']:checked"); + var checked = $("#displayForNew--${pageName}").find("[name='newPhoto']:checked"); if(checked.length < 1){ alert("선택된 사진이 없습니다."); return; @@ -545,7 +596,7 @@ $(document).ready(function(){ $P.localUploadArr = $P.localUploadArr.filter(item => checkedArr.indexOf(item.id) == -1); $P.numberPlateArr = $P.numberPlateArr.filter(item => checkedArr.indexOf(item.id) == -1); - $P.fnDisplay(); + $P.fnDisplay(false); }); /************************************************************************** @@ -585,7 +636,9 @@ $(document).ready(function(){ //보안모드 fn_securityModeToggle($("#securityMode--top").is(":checked")); - + + + var crdnInfo = ${crdnInfo}; crdnInfo.CVLCPT_APLY_CN = escapeHTMLEntity(crdnInfo.CVLCPT_APLY_CN); $P.crdnControl.setData([crdnInfo]); @@ -595,14 +648,13 @@ $(document).ready(function(){ } if(crdnInfo.fileList){ - var tagsText = $P.fnMakeImgForExistFile(crdnInfo.fileList); - $("#display0--${pageName}").append(tagsText); - } else { - - $("#display0--${pageName}").append("등록된 사진이 없습니다."); - $("#btnEditPhoto--crdn01020-info").hide(); - + crdnInfo.fileList.forEach(function(item){ + item.status = ""; + $P.existFileArr.push(item); + }); } + + $P.fnDisplay(true); }); diff --git a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn05030-info.jsp b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn05030-info.jsp index aa641cae..4cdee8dc 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn05030-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn05030-info.jsp @@ -237,7 +237,7 @@
- +
@@ -297,16 +297,14 @@ $(document).ready(function(){ formData.append(key,value); } - if(formData.get("uploadFileList").size == 0){ - formData.delete("uploadFileList"); - } - + formData.delete("newFileList"); + if($P.localUploadArr.length > 0){ - $P.localUploadArr.forEach(item => formData.append("uploadFileList",item)); + $P.localUploadArr.forEach(item => formData.append("newFileList",item)); } if($P.captureFileArr.length > 0){ - $P.captureFileArr.forEach(item => formData.append("uploadFileList",item)); + $P.captureFileArr.forEach(item => formData.append("newFileList",item)); } ajax.post({ @@ -349,7 +347,7 @@ $(document).ready(function(){ tagsText += ""; if(index % 2 == 1){ - tagsText += "
" + tagsText += "
"; } } diff --git a/src/main/webapp/WEB-INF/jsp/include/top.jsp b/src/main/webapp/WEB-INF/jsp/include/top.jsp index ae1b0735..a09921ec 100644 --- a/src/main/webapp/WEB-INF/jsp/include/top.jsp +++ b/src/main/webapp/WEB-INF/jsp/include/top.jsp @@ -40,7 +40,7 @@