소스정리

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

@ -401,15 +401,27 @@ $(document).ready(function(){
var childReq = pageObject.childReq.pop(); var childReq = pageObject.childReq.pop();
for(var reqKey in childReq) { for(var reqKey in childReq) {
if(reqKey == "getCountStatus"){ if($P.provide[reqKey]){
parentRes[reqKey] = function(currentKey){ parentRes[reqKey] = $P.provide[reqKey];
} else {
parentRes[reqKey] = function(){};
}
}
pageObject.parentRes.push(parentRes);
}
});
}
});
}
$P.provide = {
"getCountStatus" : function(currentKey){
var ds = $P.crdnControl.dataset.getDataset(); var ds = $P.crdnControl.dataset.getDataset();
var index = ds.findIndex(item => item.CRDN_ID == currentKey); var index = ds.findIndex(item => item.CRDN_ID == currentKey);
return (index+1) + " of " + ds.length; return (index+1) + " of " + ds.length;
}; },
} "getNextKey" : function(currentKey){
else if(reqKey == "getNextKey"){
parentRes[reqKey] = function(currentKey){
var ds = $P.crdnControl.dataset.getDataset(); var ds = $P.crdnControl.dataset.getDataset();
var index = ds.findIndex(item => item.CRDN_ID == currentKey); var index = ds.findIndex(item => item.CRDN_ID == currentKey);
if(ds.length > index+1){ if(ds.length > index+1){
@ -417,10 +429,8 @@ $(document).ready(function(){
} else { } else {
return ""; return "";
} }
}; },
} "getPrevKey" : function(currentKey){
else if(reqKey == "getPrevKey"){
parentRes[reqKey] = function(currentKey){
var ds = $P.crdnControl.dataset.getDataset(); var ds = $P.crdnControl.dataset.getDataset();
var index = ds.findIndex(item => item.CRDN_ID == currentKey); var index = ds.findIndex(item => item.CRDN_ID == currentKey);
if(index != 0 && ds.length > 1){ if(index != 0 && ds.length > 1){
@ -428,24 +438,12 @@ $(document).ready(function(){
} else { } else {
return ""; return "";
} }
}; },
} "selectRow" : function(currentKey){
else if(reqKey == "selectRow"){
parentRes[reqKey] = function(currentKey){
$P.clickCrdnList(currentKey); $P.clickCrdnList(currentKey);
};
}
else {
parentRes[reqKey] = function(){}
}
} }
};
pageObject.parentRes.push(parentRes);
}
});
}
});
}
/************************************************************************** /**************************************************************************
* element.on * element.on

@ -73,7 +73,7 @@
</div> </div>
<span class="container-window-btn-right"> <span class="container-window-btn-right">
<a href="#" id="btnOpenCvlcptOrgnl--${pageName}" class="btn btn-blue" title="민원원본보기">민원원본보기</a> <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>
<a href="#" id="" class="btn btn-blue" title="답변완료로 수정">답변완료로 수정</a> <a href="#" id="" class="btn btn-blue" title="답변완료로 수정">답변완료로 수정</a>
</span> </span>
@ -90,6 +90,7 @@
<tr data-by="by--${pageName}" data-by-output="byOutput--${pageName}" <tr data-by="by--${pageName}" data-by-output="byOutput--${pageName}"
data-main-option="mainOption--${pageName}" data-sub-option="subOption--${pageName}"> data-main-option="mainOption--${pageName}" data-sub-option="subOption--${pageName}">
<th style="min-width: 80px;">No.</th> <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');" <th onclick="searchFromGridTitle('CRDN_REG_SE_CD',this.innerText,'codeValue','FIM026');"
style="min-width: 80px;">등록구분</th> style="min-width: 80px;">등록구분</th>
<th onclick="searchFromGridTitle('VLTN_ARTCL',this.innerText);" <th onclick="searchFromGridTitle('VLTN_ARTCL',this.innerText);"
@ -120,6 +121,7 @@
<template id="crdnRow--${pageName}"> <template id="crdnRow--${pageName}">
<tr data-key="{CRDN_ID}"> <tr data-key="{CRDN_ID}">
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-end">{ROW_NUM}</td> <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">{CRDN_REG_SE_CD}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{VLTN_ARTCL}</td> <td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{VLTN_ARTCL}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{CVLCPT_APLCNT_NM}</td> <td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{CVLCPT_APLCNT_NM}</td>
@ -136,7 +138,7 @@
</template> </template>
<template id="crdnNotFound--${pageName}"> <template id="crdnNotFound--${pageName}">
<tr> <tr>
<td valign="top" colspan="13" class="dataTables_empty text-center">민원 정보를 찾지 못했습니다.</td> <td valign="top" colspan="14" class="dataTables_empty text-center">민원 정보를 찾지 못했습니다.</td>
</tr> </tr>
</template> </template>
</table> </table>
@ -312,15 +314,64 @@ $(document).ready(function(){
var childReq = pageObject.childReq.pop(); var childReq = pageObject.childReq.pop();
for(var reqKey in childReq) { for(var reqKey in childReq) {
if(reqKey == "getCountStatus"){ if($P.provide[reqKey]){
parentRes[reqKey] = function(currentKey){ parentRes[reqKey] = $P.provide[reqKey];
} 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(){};
}
}
pageObject.parentRes.push(parentRes);
}
});
}
});
}
$P.provide = {
"getCountStatus" : function(currentKey){
var ds = $P.crdnControl.dataset.getDataset(); var ds = $P.crdnControl.dataset.getDataset();
var index = ds.findIndex(item => item.CRDN_ID == currentKey); var index = ds.findIndex(item => item.CRDN_ID == currentKey);
return (index+1) + " of " + ds.length; return (index+1) + " of " + ds.length;
}; },
} "getNextKey" : function(currentKey){
else if(reqKey == "getNextKey"){
parentRes[reqKey] = function(currentKey){
var ds = $P.crdnControl.dataset.getDataset(); var ds = $P.crdnControl.dataset.getDataset();
var index = ds.findIndex(item => item.CRDN_ID == currentKey); var index = ds.findIndex(item => item.CRDN_ID == currentKey);
if(ds.length > index+1){ if(ds.length > index+1){
@ -328,10 +379,8 @@ $(document).ready(function(){
} else { } else {
return ""; return "";
} }
}; },
} "getPrevKey" : function(currentKey){
else if(reqKey == "getPrevKey"){
parentRes[reqKey] = function(currentKey){
var ds = $P.crdnControl.dataset.getDataset(); var ds = $P.crdnControl.dataset.getDataset();
var index = ds.findIndex(item => item.CRDN_ID == currentKey); var index = ds.findIndex(item => item.CRDN_ID == currentKey);
if(index != 0 && ds.length > 1){ if(index != 0 && ds.length > 1){
@ -339,32 +388,23 @@ $(document).ready(function(){
} else { } else {
return ""; return "";
} }
}; },
} "selectRow" : function(currentKey){
else if(reqKey == "selectRow"){
parentRes[reqKey] = function(currentKey){
$P.clickCrdnList(currentKey); $P.clickCrdnList(currentKey);
};
}
else {
parentRes[reqKey] = function(){}
}
} }
};
pageObject.parentRes.push(parentRes);
}
});
}
});
}
/************************************************************************** /**************************************************************************
* element.on * element.on
**************************************************************************/ **************************************************************************/
$('#btnReset--${pageName}').on('click', () => $P.fnReset()); $('#btnReset--${pageName}').on('click', () => $P.fnReset());
$('#btnSearch--${pageName}').on('click', () => $P.searchCrdnList()); $('#btnSearch--${pageName}').on('click', () => $P.searchCrdnList());
$("#btnOpenCvlcptOrgnl--${pageName}").on("click", () => $P.fnOpenCvlcptOrgnl()); $("#btnOpenCvlcptOrgnl--${pageName}").on("click", () => $P.fnOpenCvlcptOrgnl());
$("#btnOpenAnswerPreview--${pageName}").on("click", () => $P.fnOpenAnswerPreview());
$("#table-responsive--${pageName}").scroll(function(){ $P.scrollEnd(this); }); $("#table-responsive--${pageName}").scroll(function(){ $P.scrollEnd(this); });
/************************************************************************** /**************************************************************************
* 초기화 * 초기화
**************************************************************************/ **************************************************************************/

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