+
@@ -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 @@