소스정리

main
이범준 1 year ago
parent 24df4d5e2d
commit 8858cf80a2

@ -401,42 +401,10 @@ $(document).ready(function(){
var childReq = pageObject.childReq.pop();
for(var reqKey in childReq) {
if(reqKey == "getCountStatus"){
parentRes[reqKey] = function(currentKey){
var ds = $P.crdnControl.dataset.getDataset();
var index = ds.findIndex(item => item.CRDN_ID == currentKey);
return (index+1) + " of " + ds.length;
};
}
else if(reqKey == "getNextKey"){
parentRes[reqKey] = function(currentKey){
var ds = $P.crdnControl.dataset.getDataset();
var index = ds.findIndex(item => item.CRDN_ID == currentKey);
if(ds.length > index+1){
return ds[index+1]["CRDN_ID"];
} else {
return "";
}
};
}
else if(reqKey == "getPrevKey"){
parentRes[reqKey] = function(currentKey){
var ds = $P.crdnControl.dataset.getDataset();
var index = ds.findIndex(item => item.CRDN_ID == currentKey);
if(index != 0 && ds.length > 1){
return ds[index-1]["CRDN_ID"];
} else {
return "";
}
};
}
else if(reqKey == "selectRow"){
parentRes[reqKey] = function(currentKey){
$P.clickCrdnList(currentKey);
};
}
else {
parentRes[reqKey] = function(){}
if($P.provide[reqKey]){
parentRes[reqKey] = $P.provide[reqKey];
} else {
parentRes[reqKey] = function(){};
}
}
@ -447,6 +415,36 @@ $(document).ready(function(){
});
}
$P.provide = {
"getCountStatus" : function(currentKey){
var ds = $P.crdnControl.dataset.getDataset();
var index = ds.findIndex(item => item.CRDN_ID == currentKey);
return (index+1) + " of " + ds.length;
},
"getNextKey" : function(currentKey){
var ds = $P.crdnControl.dataset.getDataset();
var index = ds.findIndex(item => item.CRDN_ID == currentKey);
if(ds.length > index+1){
return ds[index+1]["CRDN_ID"];
} else {
return "";
}
},
"getPrevKey" : function(currentKey){
var ds = $P.crdnControl.dataset.getDataset();
var index = ds.findIndex(item => item.CRDN_ID == currentKey);
if(index != 0 && ds.length > 1){
return ds[index-1]["CRDN_ID"];
} else {
return "";
}
},
"selectRow" : function(currentKey){
$P.clickCrdnList(currentKey);
}
};
/**************************************************************************
* element.on
**************************************************************************/

@ -73,7 +73,7 @@
</div>
<span class="container-window-btn-right">
<a href="#" id="btnOpenCvlcptOrgnl--${pageName}" class="btn btn-blue" title="민원원본보기">민원원본보기</a>
<a href="#" id="" class="btn btn-blue" title="답변미리보기">답변미리보기</a>
<a href="#" id="btnOpenAnswerPreview--${pageName}" class="btn btn-blue" title="민원원본보기">답변미리보기</a>
<a href="#" id="" class="btn btn-blue" title="선택자료답변등록실행">선택자료답변등록실행</a>
<a href="#" id="" class="btn btn-blue" title="답변완료로 수정">답변완료로 수정</a>
</span>
@ -90,6 +90,7 @@
<tr data-by="by--${pageName}" data-by-output="byOutput--${pageName}"
data-main-option="mainOption--${pageName}" data-sub-option="subOption--${pageName}">
<th style="min-width: 80px;">No.</th>
<th style="min-width: 50px;"><input type="checkbox" name="gridAllCheckbox" /></th>
<th onclick="searchFromGridTitle('CRDN_REG_SE_CD',this.innerText,'codeValue','FIM026');"
style="min-width: 80px;">등록구분</th>
<th onclick="searchFromGridTitle('VLTN_ARTCL',this.innerText);"
@ -120,6 +121,7 @@
<template id="crdnRow--${pageName}">
<tr data-key="{CRDN_ID}">
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-end">{ROW_NUM}</td>
<td class="text-end"><input type="checkbox" name="gridCheckbox" /></td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{CRDN_REG_SE_CD}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{VLTN_ARTCL}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{CVLCPT_APLCNT_NM}</td>
@ -136,7 +138,7 @@
</template>
<template id="crdnNotFound--${pageName}">
<tr>
<td valign="top" colspan="13" class="dataTables_empty text-center">민원 정보를 찾지 못했습니다.</td>
<td valign="top" colspan="14" class="dataTables_empty text-center">민원 정보를 찾지 못했습니다.</td>
</tr>
</template>
</table>
@ -312,42 +314,47 @@ $(document).ready(function(){
var childReq = pageObject.childReq.pop();
for(var reqKey in childReq) {
if(reqKey == "getCountStatus"){
parentRes[reqKey] = function(currentKey){
var ds = $P.crdnControl.dataset.getDataset();
var index = ds.findIndex(item => item.CRDN_ID == currentKey);
return (index+1) + " of " + ds.length;
};
if($P.provide[reqKey]){
parentRes[reqKey] = $P.provide[reqKey];
} else {
parentRes[reqKey] = function(){};
}
else if(reqKey == "getNextKey"){
parentRes[reqKey] = function(currentKey){
var ds = $P.crdnControl.dataset.getDataset();
var index = ds.findIndex(item => item.CRDN_ID == currentKey);
if(ds.length > index+1){
return ds[index+1]["CRDN_ID"];
} else {
return "";
}
};
}
else if(reqKey == "getPrevKey"){
parentRes[reqKey] = function(currentKey){
var ds = $P.crdnControl.dataset.getDataset();
var index = ds.findIndex(item => item.CRDN_ID == currentKey);
if(index != 0 && ds.length > 1){
return ds[index-1]["CRDN_ID"];
} else {
return "";
}
};
}
else if(reqKey == "selectRow"){
parentRes[reqKey] = function(currentKey){
$P.clickCrdnList(currentKey);
};
}
else {
parentRes[reqKey] = function(){}
}
pageObject.parentRes.push(parentRes);
}
});
}
});
}
$P.fnOpenAnswerPreview = () => {
var cur = $P.crdnControl.getCurrent();
if(cur == null){
return;
}
var taskSeCd = $("#frmSearch--${pageName} input[name='taskSeCd']:checked").val();
var dialogId = "cvlcptOrgnlDialog--${pageName}";
ajax.get({
url : wctx.url("/"+taskSeCd+"/crdn/crdn01/060/info.do"),
data : { crdnId : cur["CRDN_ID"] },
success : resp => {
dialog.open({
id : dialogId,
title : "민원내역 원본",
content : resp,
size : "xl",
init : () => {
var parentRes = new Object();
var childReq = pageObject.childReq.pop();
for(var reqKey in childReq) {
if($P.provide[reqKey]){
parentRes[reqKey] = $P.provide[reqKey];
} else {
parentRes[reqKey] = function(){};
}
}
@ -357,14 +364,47 @@ $(document).ready(function(){
}
});
}
$P.provide = {
"getCountStatus" : function(currentKey){
var ds = $P.crdnControl.dataset.getDataset();
var index = ds.findIndex(item => item.CRDN_ID == currentKey);
return (index+1) + " of " + ds.length;
},
"getNextKey" : function(currentKey){
var ds = $P.crdnControl.dataset.getDataset();
var index = ds.findIndex(item => item.CRDN_ID == currentKey);
if(ds.length > index+1){
return ds[index+1]["CRDN_ID"];
} else {
return "";
}
},
"getPrevKey" : function(currentKey){
var ds = $P.crdnControl.dataset.getDataset();
var index = ds.findIndex(item => item.CRDN_ID == currentKey);
if(index != 0 && ds.length > 1){
return ds[index-1]["CRDN_ID"];
} else {
return "";
}
},
"selectRow" : function(currentKey){
$P.clickCrdnList(currentKey);
}
};
/**************************************************************************
* element.on
**************************************************************************/
$('#btnReset--${pageName}').on('click', () => $P.fnReset());
$('#btnSearch--${pageName}').on('click', () => $P.searchCrdnList());
$("#btnOpenCvlcptOrgnl--${pageName}").on("click", () => $P.fnOpenCvlcptOrgnl());
$("#btnOpenAnswerPreview--${pageName}").on("click", () => $P.fnOpenAnswerPreview());
$("#table-responsive--${pageName}").scroll(function(){ $P.scrollEnd(this); });
/**************************************************************************
* 초기화
**************************************************************************/

@ -74,7 +74,7 @@
</div>
<script>
pageObject["${pageName}"] = {};
pageObject["${pageName}"].parentRes = {};
pageObject["${pageName}"].provided = {};
pageObject.childReq = [];
pageObject.childReq.push({
@ -90,9 +90,9 @@ $(document).ready(function() {
$P.taskSeCd = "${taskSeCd}";
if(pageObject.parentRes.length > 0){
$P.parentRes = pageObject.parentRes.pop();
$P.provided = pageObject.parentRes.pop();
} else {
$P.parentRes = pageObject.childReq.pop();
$P.provided = pageObject.childReq.pop();
}
/**************************************************************************
@ -123,14 +123,14 @@ $(document).ready(function() {
**************************************************************************/
$P.fnPrev = () => {
var prevKey = $P.parentRes.getPrevKey($("#crdnId--${pageName}").val());
var prevKey = $P.provided.getPrevKey($("#crdnId--${pageName}").val());
if(prevKey != ""){
$P.fnGo(prevKey);
}
}
$P.fnNext = () => {
var nextKey = $P.parentRes.getNextKey($("#crdnId--${pageName}").val());
var nextKey = $P.provided.getNextKey($("#crdnId--${pageName}").val());
if(nextKey != ""){
$P.fnGo(nextKey);
}
@ -148,9 +148,9 @@ $(document).ready(function() {
cvlcptInfo.CVLCPT_APLY_CN = escapeHTMLEntity(cvlcptInfo.CVLCPT_APLY_CN);
$P.cvlcptControl.setData([cvlcptInfo]);
var cs = $P.parentRes.getCountStatus($("#crdnId--${pageName}").val());
var cs = $P.provided.getCountStatus($("#crdnId--${pageName}").val());
$("#countStauts--${pageName}").val(cs);
$P.parentRes.selectRow(crdnId);
$P.provided.selectRow(crdnId);
}
});
}
@ -186,7 +186,7 @@ $(document).ready(function() {
var cvlcptInfo = ${cvlcptInfo};
cvlcptInfo.CVLCPT_APLY_CN = escapeHTMLEntity(cvlcptInfo.CVLCPT_APLY_CN);
$P.cvlcptControl.setData([cvlcptInfo]);
var cs = $P.parentRes.getCountStatus($("#crdnId--${pageName}").val());
var cs = $P.provided.getCountStatus($("#crdnId--${pageName}").val());
$("#countStauts--${pageName}").val(cs);
});
</script>
Loading…
Cancel
Save