|
|
|
@ -153,6 +153,8 @@
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<form id="frmMultipart--${pageName}" method="post" enctype="multipart/form-data"></form>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
pageObject["${pageName}"] = {};
|
|
|
|
|
|
|
|
|
@ -160,6 +162,8 @@ $(document).ready(function(){
|
|
|
|
|
|
|
|
|
|
var $P = pageObject["${pageName}"];
|
|
|
|
|
|
|
|
|
|
$P.tempGroup = {};
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
|
* DatasetControl
|
|
|
|
|
**************************************************************************/
|
|
|
|
@ -201,37 +205,9 @@ $(document).ready(function(){
|
|
|
|
|
/**************************************************************************
|
|
|
|
|
* pageObject.function
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
$P.renderCrdnList = (total) => {
|
|
|
|
|
var crdnList = $P.crdnControl.dataset;
|
|
|
|
|
var empty = crdnList.empty;
|
|
|
|
|
var notFound = [document.getElementById("crdnNotFound--${pageName}").innerHTML];
|
|
|
|
|
var found = document.getElementById("crdnRow--${pageName}").innerHTML;
|
|
|
|
|
var replacer = (str, dataItem) => str
|
|
|
|
|
.replace(/{onclick}/gi, "pageObject['${pageName}'].clickCrdnList('" + dataItem.getValue("FILE_NAME") + "');");
|
|
|
|
|
|
|
|
|
|
var trs = empty ? notFound : crdnList.inStrings(found,replacer);
|
|
|
|
|
|
|
|
|
|
$("#crdnTbody--${pageName}").html(trs.join());
|
|
|
|
|
|
|
|
|
|
if(!empty){
|
|
|
|
|
fnDownsizeCheck(document.getElementById("DataTables_Table_0--${pageName}"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$P.clickCrdnList = (dataKey) => {
|
|
|
|
|
if(dataKey == ""){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$P.crdnControl.setCurrent(dataKey);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
|
* element.on
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
$("#btnSearch--${pageName}").on("click", function(){
|
|
|
|
|
if($("#entType--${pageName}").val() == ""){
|
|
|
|
|
$P.searchFileList = () => {
|
|
|
|
|
if($("#entType--${pageName}").val() == ""){
|
|
|
|
|
dialog.alert("장비업체를 선택하세요.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -254,11 +230,10 @@ $(document).ready(function(){
|
|
|
|
|
$P.crdnControl.setData(resp);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$("#btnFileUpload--${pageName}").on("click", function(){
|
|
|
|
|
|
|
|
|
|
if($("#entType--${pageName}").val() == ""){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$P.uploadLocalFile = () => {
|
|
|
|
|
if($("#entType--${pageName}").val() == ""){
|
|
|
|
|
dialog.alert("장비업체를 선택하세요.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -278,13 +253,75 @@ $(document).ready(function(){
|
|
|
|
|
|
|
|
|
|
dialog.alert("주정차,전용차로,미세먼지 과태료 파일 등록 기능은 서비스 준비 중입니다.");
|
|
|
|
|
return;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$P.renderCrdnList = (total) => {
|
|
|
|
|
var crdnList = $P.crdnControl.dataset;
|
|
|
|
|
var empty = crdnList.empty;
|
|
|
|
|
var notFound = [document.getElementById("crdnNotFound--${pageName}").innerHTML];
|
|
|
|
|
var found = document.getElementById("crdnRow--${pageName}").innerHTML;
|
|
|
|
|
var replacer = (str, dataItem) => str
|
|
|
|
|
.replace(/{onclick}/gi, "pageObject['${pageName}'].clickCrdnList('" + dataItem.getValue("FILE_NAME") + "');");
|
|
|
|
|
|
|
|
|
|
var trs = empty ? notFound : crdnList.inStrings(found,replacer);
|
|
|
|
|
|
|
|
|
|
$("#crdnTbody--${pageName}").html(trs.join());
|
|
|
|
|
|
|
|
|
|
if(!empty){
|
|
|
|
|
fnDownsizeCheck(document.getElementById("DataTables_Table_0--${pageName}"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$("#btnInsertCrdn--${pageName}").on("click", function(){
|
|
|
|
|
$P.clickCrdnList = (dataKey) => {
|
|
|
|
|
if(dataKey == ""){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
$P.crdnControl.setCurrent(dataKey);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$("#btnDelete--${pageName}").on("click", function(){
|
|
|
|
|
$P.createCrdn = () => {
|
|
|
|
|
|
|
|
|
|
if($.isEmptyObject($P.tempGroup)){
|
|
|
|
|
dialog.alert("모든 자료가 처리 완료되었습니다.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var firstGroupKey = Object.keys($P.tempGroup)[0];
|
|
|
|
|
var formData = new FormData(document.getElementById("frmMultipart--${pageName}"));
|
|
|
|
|
formData.append("entType", $("#entType--${pageName}").val());
|
|
|
|
|
for(var i=0; i<$P.tempGroup[firstGroupKey].length; i++){
|
|
|
|
|
formData.append("linkFileInfos", JSON.stringify($P.tempGroup[firstGroupKey][i]));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ajax.post({
|
|
|
|
|
url : wctx.url("/${taskSeCd}/crdn/crdn05/020/create.do"),
|
|
|
|
|
contentType : false, processData : false,
|
|
|
|
|
data : formData,
|
|
|
|
|
success : (resp) => {
|
|
|
|
|
|
|
|
|
|
var removedFileName = $P.tempGroup[firstGroupKey].map(item => item.FILE_NAME);
|
|
|
|
|
|
|
|
|
|
delete $P.tempGroup[firstGroupKey];
|
|
|
|
|
|
|
|
|
|
if(resp.saved){
|
|
|
|
|
|
|
|
|
|
$P.removeCallback(removedFileName);
|
|
|
|
|
|
|
|
|
|
if(resp.alertMessage){
|
|
|
|
|
alert(alertMessage);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
alert(resp.failReason);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//다음자료 진행
|
|
|
|
|
//$P.createCrdn();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$P.deleteFile = () => {
|
|
|
|
|
var current = $P.crdnControl.getCurrent();
|
|
|
|
|
if(current == null) return;
|
|
|
|
|
|
|
|
|
@ -298,17 +335,50 @@ $(document).ready(function(){
|
|
|
|
|
},
|
|
|
|
|
success : (resp) => {
|
|
|
|
|
if(resp.saved){
|
|
|
|
|
$P.crdnControl.dataset.remove(fileName);
|
|
|
|
|
|
|
|
|
|
var fileListTable = document.getElementById("DataTables_Table_0--${pageName}");
|
|
|
|
|
var tr = $(fileListTable).find("tbody").find("tr[data-key='"+fileName+"']");
|
|
|
|
|
var trIndex = $(fileListTable).find("tbody tr").index(tr);
|
|
|
|
|
fileListTable.deleteRow(trIndex+1);
|
|
|
|
|
$P.removeCallback(fileName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$P.removeCallback = (removedFileName) => {
|
|
|
|
|
$P.crdnControl.dataset.remove(removedFileName);
|
|
|
|
|
$P.removeTableRow(removedFileName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$P.removeTableRow = (removedFileName) => {
|
|
|
|
|
var fileListTable = document.getElementById("DataTables_Table_0--${pageName}");
|
|
|
|
|
|
|
|
|
|
var targetArr = [];
|
|
|
|
|
if(Array.isArray(removedFileName)){
|
|
|
|
|
targetArr = removedFileName;
|
|
|
|
|
} else {
|
|
|
|
|
targetArr = [removedFileName];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for(var i = 0; i < targetArr.length; i++){
|
|
|
|
|
var target = targetArr[i];
|
|
|
|
|
var tr = $(fileListTable).find("tbody").find("tr[data-key='"+target+"']");
|
|
|
|
|
var trIndex = $(fileListTable).find("tbody tr").index(tr);
|
|
|
|
|
fileListTable.deleteRow(trIndex+1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
|
* element.on
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
$("#btnSearch--${pageName}").on("click", function(){ $P.searchFileList(); });
|
|
|
|
|
|
|
|
|
|
$("#btnFileUpload--${pageName}").on("click", function(){ $P.uploadLocalFile(); });
|
|
|
|
|
|
|
|
|
|
$("#btnInsertCrdn--${pageName}").on("click", function(){
|
|
|
|
|
$P.tempGroup = Object.groupBy($P.crdnControl.dataset.getDataset(), ({ TEMP_GROUP_ID }) => "temp"+TEMP_GROUP_ID);
|
|
|
|
|
$P.createCrdn();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$("#btnDelete--${pageName}").on("click", function(){ $P.deleteFile(); });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$P.crdnControl.setData([]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|