화면 main 수정.

검색 list 수정.
main
jjh 1 year ago
parent 26f4e9bc46
commit b48d61c8af

@ -41,22 +41,17 @@ public class Excl01Controller extends ApplicationController {
*/ */
@RequestMapping(name = "부과제외 관리 메인", value = "/010/main.do") @RequestMapping(name = "부과제외 관리 메인", value = "/010/main.do")
public ModelAndView levyExclusionMain() { public ModelAndView levyExclusionMain() {
ModelAndView mav = getLevyExclusionList(new Excl01Query().setPageNum(1)); ModelAndView mav = new ModelAndView("fims/excl/excl01010-main");
// View(jsp)
mav.setViewName("fims/excl/excl01010-main");
// View(jsp)에서 사용할 공통코드를 조회 // View(jsp)에서 사용할 공통코드를 조회
Map<String, List<CommonCode>> commonCodes = getCodesOf("FIM021", "FIM054"); Map<String, List<CommonCode>> commonCodes = getCodesOf("FIM021", "FIM054");
mav.addObject("FIM021List", commonCodes.get("FIM021")); // 부과 제외 구분 코드(LEVY_EXCL_SE_CD) return mav.addObject("pageName", "excl01010") // View(jsp)에서 사용할 id 뒤에 붙일 suffix
mav.addObject("FIM054List", commonCodes.get("FIM054")); // 업무 구분 코드(TASK_SE_CD) .addObject("urlPrefix", "/excl/excl01") // URL로 사용할 prefix
addCodes(commonCodes, mav, "FIM021", "FIM054"); .addObject("infoPrefix", "levyExcl") // prefix
.addObject("FIM021List", commonCodes.get("FIM021")) // 부과 제외 구분 코드(LEVY_EXCL_SE_CD)
// View(jsp)에서 사용할 id 뒤에 붙일 suffix .addObject("FIM054List", commonCodes.get("FIM054")) // 업무 구분 코드(TASK_SE_CD)
mav.addObject("pageName", "excl01010"); ;
return mav;
} }
/** .<br /> /** .<br />
@ -144,4 +139,4 @@ public class Excl01Controller extends ApplicationController {
.addObject("saved", saved); .addObject("saved", saved);
} }
} }

@ -41,22 +41,17 @@ public class Excl02Controller extends ApplicationController {
*/ */
@RequestMapping(name = "의견제출 관리 메인", value = "/010/main.do") @RequestMapping(name = "의견제출 관리 메인", value = "/010/main.do")
public ModelAndView opinionSubmissionMain() { public ModelAndView opinionSubmissionMain() {
ModelAndView mav = getOpinionSubmissionList(new Excl02Query().setPageNum(1)); ModelAndView mav = new ModelAndView("fims/excl/excl02010-main");
// View(jsp)
mav.setViewName("fims/excl/excl02010-main");
// View(jsp)에서 사용할 공통코드를 조회 // View(jsp)에서 사용할 공통코드를 조회
Map<String, List<CommonCode>> commonCodes = getCodesOf("FIM031", "FIM054"); Map<String, List<CommonCode>> commonCodes = getCodesOf("FIM031", "FIM054");
mav.addObject("FIM031List", commonCodes.get("FIM031")); // 의견 제출 답변 결과(OPNN_SBMSN_STTS_CD) return mav.addObject("pageName", "excl02010") // View(jsp)에서 사용할 id 뒤에 붙일 suffix
mav.addObject("FIM054List", commonCodes.get("FIM054")); // 업무 구분 코드(TASK_SE_CD) .addObject("urlPrefix", "/excl/excl02") // URL로 사용할 prefix
addCodes(commonCodes, mav, "FIM031", "FIM054"); .addObject("infoPrefix", "opnnSbmsn") // prefix
.addObject("FIM031List", commonCodes.get("FIM031")) // 부과 제외 구분 코드(LEVY_EXCL_SE_CD)
// View(jsp)에서 사용할 id 뒤에 붙일 suffix .addObject("FIM054List", commonCodes.get("FIM054")) // 업무 구분 코드(TASK_SE_CD)
mav.addObject("pageName", "excl02010"); ;
return mav;
} }
/** .<br /> /** .<br />

@ -41,21 +41,16 @@ public class Excl03Controller extends ApplicationController {
*/ */
@RequestMapping(name = "단속 재등록 메인", value = "/010/main.do") @RequestMapping(name = "단속 재등록 메인", value = "/010/main.do")
public ModelAndView crackdownReRegistrationMain() { public ModelAndView crackdownReRegistrationMain() {
ModelAndView mav = getCrackdownReRegistrationList(new Excl03Query().setPageNum(1)); ModelAndView mav = new ModelAndView("fims/excl/excl03010-main");
// View(jsp)
mav.setViewName("fims/excl/excl03010-main");
// View(jsp)에서 사용할 공통코드를 조회 // View(jsp)에서 사용할 공통코드를 조회
Map<String, List<CommonCode>> commonCodes = getCodesOf("FIM054"); Map<String, List<CommonCode>> commonCodes = getCodesOf("FIM054");
mav.addObject("FIM054List", commonCodes.get("FIM054")); // 업무 구분 코드(TASK_SE_CD) return mav.addObject("pageName", "excl03010") // View(jsp)에서 사용할 id 뒤에 붙일 suffix
addCodes(commonCodes, mav, "FIM054"); .addObject("urlPrefix", "/excl/excl03") // URL로 사용할 prefix
.addObject("infoPrefix", "crdnRe") // prefix
// View(jsp)에서 사용할 id 뒤에 붙일 suffix .addObject("FIM054List", commonCodes.get("FIM054")) // 업무 구분 코드(TASK_SE_CD)
mav.addObject("pageName", "excl03010"); ;
return mav;
} }
/** .<br /> /** .<br />

@ -150,14 +150,16 @@
<span class="container-page-btn"> <span class="container-page-btn">
<!-- 건수, 페이지 표시 --> <!-- 건수, 페이지 표시 -->
<div class="d-flex flex-row justify-content-between"> <div class="d-flex flex-row justify-content-between">
<label id="paging--${pageName}PagingInfo" class="dataTables_info" role="status" aria-live="polite"></label> <label class="dataTables_info" id="paging--${pageName}PagingInfo" role="status" aria-live="polite"></label>
<ul id="paging--${pageName}" class="pagination pagination-primary"> <ul class="pagination pagination-primary" id="paging--${pageName}">
</ul> </ul>
</div> </div>
<span class="container-window-btn-right"> <span class="container-window-btn-right">
<!-- 업무 버튼 --> <!-- 업무 버튼 -->
<a href="#" class="btn btn-blue" id="" title="업무처리1">업무 처리1</a> <a href="#" class="btn btn-blue" id="btnNotLevyCreate--${pageName}" title="비부과 등록">비부과 등록</a>
<a href="#" class="btn btn-blue" id="" title="업무처리2">업무 처리2</a> <a href="#" class="btn btn-blue" id="btnWarningCreate--${pageName}" title="계고 등록">계고 등록</a>
<a href="#" class="btn btn-blue" id="btnUpdate--${pageName}" title="수정">수정</a>
<a href="#" class="btn btn-blue" id="btnRemove--${pageName}" title="삭제">삭제</a>
</span> </span>
</span> </span>
</div> </div>
@ -194,7 +196,7 @@
</thead> </thead>
<tbody id="tbody--${pageName}"> <tbody id="tbody--${pageName}">
</tbody> </tbody>
<template id="${infoPrefix}Row"> <template id="${infoPrefix}Row--${pageName}">
<tr data-key="{LEVY_EXCL_ID}"> <tr data-key="{LEVY_EXCL_ID}">
<td style="text-align:center;" {onclick} {ondblclick}>{ROW_NUM}</td> <td style="text-align:center;" {onclick} {ondblclick}>{ROW_NUM}</td>
<td style="text-align:center;"> <td style="text-align:center;">
@ -217,7 +219,7 @@
<td style="text-align:center;" {onclick} {ondblclick}>{MDFR}</td> <td style="text-align:center;" {onclick} {ondblclick}>{MDFR}</td>
</tr> </tr>
</template> </template>
<template id="${infoPrefix}NotFound"> <template id="${infoPrefix}NotFound--${pageName}">
<tr class="odd"> <tr class="odd">
<td valign="top" colspan="14" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td> <td valign="top" colspan="14" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td>
</tr> </tr>
@ -249,20 +251,7 @@
* Global Variable * Global Variable
**************************************************************************/ **************************************************************************/
// Control 생성 // Control 생성
var ${pageName}Control = new LevyExclControl(); var ${pageName}Control = new LevyExclControl("${urlPrefix}");
// 공통코드
var FIM021 = new CommonCodes(${FIM021});
var FIM054 = new CommonCodes(${FIM054});
// script 진입
$(document).ready(function() {
// 검색조건 초기값 셋팅
initSearch${pageName}();
// 이벤트
setEvent${pageName}();
});
/************************************************************************** /**************************************************************************
* 초기 셋팅 * 초기 셋팅
@ -281,10 +270,17 @@
// //
function setEvent${pageName}() { function setEvent${pageName}() {
// 검색 버튼 이벤트 // 버튼 이벤트
$("#btnSearch--${pageName}").on("click", () => searchList${pageName}()); $("#btnReset--${pageName}").on("click", () => searchList${pageName}()); // 초기화
$("#btnSearch--${pageName}").on("click", () => searchList${pageName}()); // 검색
// 테이블 스크롤 이벤트 $("#btnExcle--${pageName}").on("click", () => searchList${pageName}()); // 엑셀
$("#btnNotLevyCreate--${pageName}").on("click", () => searchList${pageName}()); // 비부과 등록
$("#btnWarningCreate--${pageName}").on("click", () => searchList${pageName}()); // 계고 등록
$("#btnUpdate--${pageName}").on("click", () => searchList${pageName}()); // 수정
$("#btnRemove--${pageName}").on("click", () => searchList${pageName}()); // 삭제
$("#term--${pageName}").onEnterPress(() => searchList${pageName}()); // 동적 검색
// DataTables 스크롤 이벤트
$("#table-responsive--${pageName}").scroll(function() { $("#table-responsive--${pageName}").scroll(function() {
let el = $(this); let el = $(this);
@ -299,6 +295,24 @@
/************************************************************************** /**************************************************************************
* Event * Event
**************************************************************************/ **************************************************************************/
// DataTables에 click, dbclick 이벤트
function renderList${pageName}() {
let ${infoPrefix}List = ${pageName}Control.dataset;
let empty = ${infoPrefix}List.empty;
let trs = empty ?
[document.getElementById("${infoPrefix}NotFound--${pageName}").innerHTML] : <%-- from template#${infoPrefix}NotFound --%>
${infoPrefix}List.inStrings(
document.getElementById("${infoPrefix}Row--${pageName}").innerHTML, <%-- from template#${infoPrefix}Row --%>
(str, dataItem) => str
.replace(/{onclick}/gi, 'onclick="${pageName}Control.setCurrent(\'' + dataItem.getValue("LEVY_EXCL_ID") + '\');"')
.replace(/{ondblclick}/gi, 'ondblclick="${pageName}Control.getInfo(\'' + 'levyExclId=' + dataItem.getValue("LEVY_EXCL_ID") + '\')"')
);
$("#tbody--${pageName}").html(trs.join());
$("th input[type='checkbox']").prop("checked", false);
}
// Dataset 변경 // Dataset 변경
${pageName}Control.onDatasetChange = obj => { ${pageName}Control.onDatasetChange = obj => {
renderList${pageName}(); renderList${pageName}();
@ -337,55 +351,48 @@
// $("#btnRemove${infoPrefix}s").prop("disabled", keys.length < 1); // $("#btnRemove${infoPrefix}s").prop("disabled", keys.length < 1);
}; };
//
$("#term").onEnterPress(searchList${pageName}());
/************************************************************************** /**************************************************************************
* * function
**************************************************************************/ **************************************************************************/
// 검색조건 파라미터 가져오기
function getParams${pageName}() {
let formFields = new FimsFormFields("#frmSearch--${pageName}");
let data = formFields.get();
data.sggCd = "41480"; // 시군구 코드 임시
data.fetchSize = 30; // 한번에 30건씩 조회
return data;
}
// 검색 // 검색
function searchList${pageName}(pageNumber) { function searchList${pageName}(pageNumber) {
// pageNumber 값 확인 // pageNumber 값 확인
if (!pageNumber) pageNumber = 1; if (!pageNumber) pageNumber = 1;
${pageName}Control.query = getParams${pageName}(); // 검색조건 ${pageName}Control.query = fnGetParams${pageName}(); // 검색조건
${pageName}Control.query.orderBy = "LEVY_EXCL_ID"; // 정렬 ${pageName}Control.query.orderBy = "LEVY_EXCL_ID"; // 정렬
${pageName}Control.load(pageNumber); ${pageName}Control.load(pageNumber);
} }
// 테이블에 click, dbclick 이벤트
function renderList${pageName}() {
let ${infoPrefix}List = ${pageName}Control.dataset;
let empty = ${infoPrefix}List.empty;
let trs = empty ?
[document.getElementById("${infoPrefix}NotFound").innerHTML] : <%-- from template#${infoPrefix}NotFound --%>
${infoPrefix}List.inStrings(
document.getElementById("${infoPrefix}Row").innerHTML, <%-- from template#${infoPrefix}Row --%>
(str, dataItem) => str
.replace(/{onclick}/gi, 'onclick="${pageName}Control.setCurrent(\'' + dataItem.getValue("{LEVY_EXCL_ID}") + '\');"')
.replace(/{ondblclick}/gi, 'ondblclick="${pageName}Control.getInfo(\'' + dataItem.getValue("{LEVY_EXCL_ID}") + '\')"')
);
$("#tbody--${pageName}").html(trs.join());
$("th input[type='checkbox']").prop("checked", false);
}
// 업무구분 변경 // 업무구분 변경
function fnResetAndChangeBiz(taskSeCd) { function fnResetAndChangeBiz(taskSeCd) {
$("tbody--${pageName}").html(""); $("tbody--${pageName}").html("");
} }
// 검색 조건 파라미터 가져오기
function fnGetParams${pageName}() {
let formFields = new FimsFormFields("#frmSearch--${pageName}");
let formData = formFields.get();
formData.sggCd = "41480"; // 시군구 코드 임시
formData.fetchSize = 30; // 한번에 30건씩 조회
return formData;
}
/**************************************************************************
* script 진입
**************************************************************************/
$(document).ready(function() {
// 검색조건 초기값 설정
initSearch${pageName}();
// 이벤트 설정
setEvent${pageName}();
${pageName}Control.addData(${levyExcl});
});
// #sourceURL=excl01010-main.jsp
</script> </script>

@ -151,8 +151,8 @@
<span class="container-page-btn"> <span class="container-page-btn">
<!-- 건수, 페이지 표시 --> <!-- 건수, 페이지 표시 -->
<div class="d-flex flex-row justify-content-between"> <div class="d-flex flex-row justify-content-between">
<label id="paging--${pageName}PagingInfo" class="dataTables_info" role="status" aria-live="polite"></label> <label class="dataTables_info" id="paging--${pageName}PagingInfo" role="status" aria-live="polite"></label>
<ul id="paging--${pageName}" class="pagination pagination-primary"> <ul class="pagination pagination-primary" id="paging--${pageName}">
</ul> </ul>
</div> </div>
<span class="container-window-btn-right"> <span class="container-window-btn-right">
@ -198,7 +198,7 @@
</thead> </thead>
<tbody id="tbody--${pageName}"> <tbody id="tbody--${pageName}">
</tbody> </tbody>
<template id="${infoPrefix}Row"> <template id="${infoPrefix}Row--${pageName}">
<tr data-key="{OPNN_ID}"> <tr data-key="{OPNN_ID}">
<td style="text-align:center;" {onclick} {ondblclick}>{ROW_NUM}</td> <td style="text-align:center;" {onclick} {ondblclick}>{ROW_NUM}</td>
<td style="text-align:center;"> <td style="text-align:center;">
@ -224,7 +224,7 @@
<td style="text-align:center;" {onclick} {ondblclick}>{MDFR}</td> <td style="text-align:center;" {onclick} {ondblclick}>{MDFR}</td>
</tr> </tr>
</template> </template>
<template id="${infoPrefix}NotFound"> <template id="${infoPrefix}NotFound--${pageName}">
<tr class="odd"> <tr class="odd">
<td valign="top" colspan="14" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td> <td valign="top" colspan="14" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td>
</tr> </tr>
@ -256,21 +256,7 @@
* Global Variable * Global Variable
**************************************************************************/ **************************************************************************/
// Control 생성 // Control 생성
var ${pageName}Control = new OpnnSbmsnControl(); var ${pageName}Control = new OpnnSbmsnControl("${urlPrefix}");
// 공통코드
var FIM031 = new CommonCodes(${FIM031});
var FIM054 = new CommonCodes(${FIM054});
// script 진입
$(document).ready(function() {
// 검색조건 초기값 셋팅
initSearch${pageName}();
// 이벤트
setEvent${pageName}();
});
/************************************************************************** /**************************************************************************
* 초기 셋팅 * 초기 셋팅
@ -289,8 +275,9 @@
// //
function setEvent${pageName}() { function setEvent${pageName}() {
// 검색 버튼 이벤트 // 버튼 이벤트
$("#btnSearch--${pageName}").on("click", () => searchList${pageName}()); $("#btnSearch--${pageName}").on("click", () => searchList${pageName}()); // 검색
$("#term--${pageName}").onEnterPress(() => searchList${pageName}()); // 동적 검색
// DataTables 스크롤 이벤트 // DataTables 스크롤 이벤트
$("#table-responsive--${pageName}").scroll(function() { $("#table-responsive--${pageName}").scroll(function() {
@ -298,8 +285,6 @@
if (el.scrollTop() == 0) return; if (el.scrollTop() == 0) return;
if (dataItem.getValue("{ROW_NUMBER}") >= dataItem.getValue("{TOT_CNT}") ) return;
if ((el[0].scrollHeight - el.scrollTop() + 15) == el.outerHeight()) { if ((el[0].scrollHeight - el.scrollTop() + 15) == el.outerHeight()) {
searchList${pageName}(${pageName}Control.query.pageNum + 1); searchList${pageName}(${pageName}Control.query.pageNum + 1);
} }
@ -309,6 +294,24 @@
/************************************************************************** /**************************************************************************
* Event * Event
**************************************************************************/ **************************************************************************/
// DataTables에 click, dbclick 이벤트
function renderList${pageName}() {
let ${infoPrefix}List = ${pageName}Control.dataset;
let empty = ${infoPrefix}List.empty;
let trs = empty ?
[document.getElementById("${infoPrefix}NotFound--${pageName}").innerHTML] : <%-- from template#${infoPrefix}NotFound --%>
${infoPrefix}List.inStrings(
document.getElementById("${infoPrefix}Row--${pageName}").innerHTML, <%-- from template#${infoPrefix}Row --%>
(str, dataItem) => str
.replace(/{onclick}/gi, 'onclick="${pageName}Control.setCurrent(\'' + dataItem.getValue("OPNN_ID") + '\');"')
.replace(/{ondblclick}/gi, 'ondblclick="${pageName}Control.getInfo(\'' + 'opnnId=' + dataItem.getValue("OPNN_ID") + '\')"')
);
$("#tbody--${pageName}").html(trs.join());
$("th input[type='checkbox']").prop("checked", false);
}
// Dataset 변경 // Dataset 변경
${pageName}Control.onDatasetChange = obj => { ${pageName}Control.onDatasetChange = obj => {
renderList${pageName}(); renderList${pageName}();
@ -347,55 +350,48 @@
// $("#btnRemove${infoPrefix}s").prop("disabled", keys.length < 1); // $("#btnRemove${infoPrefix}s").prop("disabled", keys.length < 1);
}; };
//
$("#term").onEnterPress(searchList${pageName}());
/************************************************************************** /**************************************************************************
* * function
**************************************************************************/ **************************************************************************/
// 검색조건 파라미터 가져오기
function getParams${pageName}() {
let formFields = new FimsFormFields("#frmSearch--${pageName}");
let data = formFields.get();
data.sggCd = "41480"; // 시군구 코드 임시
data.fetchSize = 30; // 한번에 30건씩 조회
return data;
}
// 검색 // 검색
function searchList${pageName}(pageNumber) { function searchList${pageName}(pageNumber) {
// pageNumber 값 확인 // pageNumber 값 확인
if (!pageNumber) pageNumber = 1; if (!pageNumber) pageNumber = 1;
${pageName}Control.query = getParams${pageName}(); // 검색조건 ${pageName}Control.query = fnGetParams${pageName}(); // 검색조건
${pageName}Control.query.orderBy = "OPNN_ID"; // 정렬 ${pageName}Control.query.orderBy = "OPNN_ID"; // 정렬
${pageName}Control.load(pageNumber); ${pageName}Control.load(pageNumber);
} }
// DataTables에 click, dbclick 이벤트
function renderList${pageName}() {
let ${infoPrefix}List = ${pageName}Control.dataset;
let empty = ${infoPrefix}List.empty;
let trs = empty ?
[document.getElementById("${infoPrefix}NotFound").innerHTML] : <%-- from template#${infoPrefix}NotFound --%>
${infoPrefix}List.inStrings(
document.getElementById("${infoPrefix}Row").innerHTML, <%-- from template#${infoPrefix}Row --%>
(str, dataItem) => str
.replace(/{onclick}/gi, 'onclick="${pageName}Control.setCurrent(\'' + dataItem.getValue("{OPNN_ID}") + '\');"')
.replace(/{ondblclick}/gi, 'ondblclick="${pageName}Control.getInfo(\'' + dataItem.getValue("{OPNN_ID}") + '\')"')
);
$("#tbody--${pageName}").html(trs.join());
$("th input[type='checkbox']").prop("checked", false);
}
// 업무구분 변경 // 업무구분 변경
function fnResetAndChangeBiz(taskSeCd) { function fnResetAndChangeBiz(taskSeCd) {
$("tbody--${pageName}").html(""); $("tbody--${pageName}").html("");
} }
// 검색 조건 파라미터 가져오기
function fnGetParams${pageName}() {
let formFields = new FimsFormFields("#frmSearch--${pageName}");
let formData = formFields.get();
formData.sggCd = "41480"; // 시군구 코드 임시
formData.fetchSize = 30; // 한번에 30건씩 조회
return formData;
}
/**************************************************************************
* script 진입
**************************************************************************/
$(document).ready(function() {
// 검색조건 초기값 설정
initSearch${pageName}();
// 이벤트 설정
setEvent${pageName}();
${pageName}Control.addData(${opnnSbmsn});
});
// #sourceURL=excl02010-main.jsp
</script> </script>

@ -112,8 +112,8 @@
<span class="container-page-btn"> <span class="container-page-btn">
<!-- 건수, 페이지 표시 --> <!-- 건수, 페이지 표시 -->
<div class="d-flex flex-row justify-content-between"> <div class="d-flex flex-row justify-content-between">
<label id="paging--${pageName}PagingInfo" class="dataTables_info" role="status" aria-live="polite"></label> <label class="dataTables_info" id="paging--${pageName}PagingInfo" role="status" aria-live="polite"></label>
<ul id="paging--${pageName}" class="pagination pagination-primary"> <ul class="pagination pagination-primary" id="paging--${pageName}">
</ul> </ul>
</div> </div>
<span class="container-window-btn-right"> <span class="container-window-btn-right">
@ -150,7 +150,7 @@
</thead> </thead>
<tbody id="tbody--${pageName}"> <tbody id="tbody--${pageName}">
</tbody> </tbody>
<template id="${infoPrefix}Row"> <template id="${infoPrefix}Row--${pageName}">
<tr data-key="{RE_REG_ID}"> <tr data-key="{RE_REG_ID}">
<td style="text-align:center;" {onclick} {ondblclick}>{ROW_NUM}</td> <td style="text-align:center;" {onclick} {ondblclick}>{ROW_NUM}</td>
<td style="text-align:center;"> <td style="text-align:center;">
@ -168,7 +168,7 @@
<td style="text-align:center;" {onclick} {ondblclick}>{RGTR}</td> <td style="text-align:center;" {onclick} {ondblclick}>{RGTR}</td>
</tr> </tr>
</template> </template>
<template id="${infoPrefix}NotFound"> <template id="${infoPrefix}NotFound--${pageName}">
<tr class="odd"> <tr class="odd">
<td valign="top" colspan="14" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td> <td valign="top" colspan="14" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td>
</tr> </tr>
@ -200,19 +200,7 @@
* Global Variable * Global Variable
**************************************************************************/ **************************************************************************/
// Control 생성 // Control 생성
var ${pageName}Control = new CrdnReControl(); var ${pageName}Control = new CrdnReControl("${urlPrefix}");
// 공통코드
var FIM054 = new CommonCodes(${FIM054});
// script 진입
$(document).ready(function() {
// 검색조건 초기값 셋팅
initSearch${pageName}();
// 이벤트
setEvent${pageName}();
});
/************************************************************************** /**************************************************************************
* 초기 셋팅 * 초기 셋팅
@ -231,10 +219,11 @@
// //
function setEvent${pageName}() { function setEvent${pageName}() {
// 검색 버튼 이벤트 // 버튼 이벤트
$("#btnSearch--${pageName}").on("click", () => searchList${pageName}()); $("#btnSearch--${pageName}").on("click", () => searchList${pageName}()); // 검색
$("#term--${pageName}").onEnterPress(() => searchList${pageName}()); // 동적 검색
// 테이블 스크롤 이벤트 // DataTables 스크롤 이벤트
$("#table-responsive--${pageName}").scroll(function() { $("#table-responsive--${pageName}").scroll(function() {
let el = $(this); let el = $(this);
@ -249,6 +238,23 @@
/************************************************************************** /**************************************************************************
* Event * Event
**************************************************************************/ **************************************************************************/
// DataTables에 click, dbclick 이벤트
function renderList${pageName}() {
let ${infoPrefix}List = ${pageName}Control.dataset;
let empty = ${infoPrefix}List.empty;
let trs = empty ?
[document.getElementById("${infoPrefix}NotFound--${pageName}").innerHTML] : <%-- from template#${infoPrefix}NotFound --%>
${infoPrefix}List.inStrings(
document.getElementById("${infoPrefix}Row--${pageName}").innerHTML, <%-- from template#${infoPrefix}Row --%>
(str, dataItem) => str
.replace(/{onclick}/gi, 'onclick="${pageName}Control.setCurrent(\'' + dataItem.getValue("RE_REG_ID") + '\');"')
);
$("#tbody--${pageName}").html(trs.join());
$("th input[type='checkbox']").prop("checked", false);
}
// Dataset 변경 // Dataset 변경
${pageName}Control.onDatasetChange = obj => { ${pageName}Control.onDatasetChange = obj => {
renderList${pageName}(); renderList${pageName}();
@ -287,55 +293,48 @@
// $("#btnRemove${infoPrefix}s").prop("disabled", keys.length < 1); // $("#btnRemove${infoPrefix}s").prop("disabled", keys.length < 1);
}; };
//
$("#term").onEnterPress(searchList${pageName}());
/************************************************************************** /**************************************************************************
* * function
**************************************************************************/ **************************************************************************/
// 검색조건 파라미터 가져오기
function getParams${pageName}() {
let formFields = new FimsFormFields("#frmSearch--${pageName}");
let data = formFields.get();
data.sggCd = "41480"; // 시군구 코드 임시
data.fetchSize = 30; // 한번에 30건씩 조회
return data;
}
// 검색 // 검색
function searchList${pageName}(pageNumber) { function searchList${pageName}(pageNumber) {
// pageNumber 값 확인 // pageNumber 값 확인
if (!pageNumber) pageNumber = 1; if (!pageNumber) pageNumber = 1;
${pageName}Control.query = getParams${pageName}(); // 검색조건 ${pageName}Control.query = fnGetParams${pageName}(); // 검색조건
${pageName}Control.query.orderBy = "RE_REG_ID"; // 정렬 ${pageName}Control.query.orderBy = "RE_REG_ID"; // 정렬
${pageName}Control.load(pageNumber); ${pageName}Control.load(pageNumber);
} }
// 테이블에 click, dbclick 이벤트
function renderList${pageName}() {
let ${infoPrefix}List = ${pageName}Control.dataset;
let empty = ${infoPrefix}List.empty;
let trs = empty ?
[document.getElementById("${infoPrefix}NotFound").innerHTML] : <%-- from template#${infoPrefix}NotFound --%>
${infoPrefix}List.inStrings(
document.getElementById("${infoPrefix}Row").innerHTML, <%-- from template#${infoPrefix}Row --%>
(str, dataItem) => str
.replace(/{onclick}/gi, 'onclick="${pageName}Control.setCurrent(\'' + dataItem.getValue("{RE_REG_ID}") + '\');"')
.replace(/{ondblclick}/gi, 'ondblclick="${pageName}Control.getInfo(\'' + dataItem.getValue("{RE_REG_ID}") + '\')"')
);
$("#tbody--${pageName}").html(trs.join());
$("th input[type='checkbox']").prop("checked", false);
}
// 업무구분 변경 // 업무구분 변경
function fnResetAndChangeBiz(taskSeCd) { function fnResetAndChangeBiz(taskSeCd) {
$("tbody--${pageName}").html(""); $("tbody--${pageName}").html("");
} }
// 검색 조건 파라미터 가져오기
function fnGetParams${pageName}() {
let formFields = new FimsFormFields("#frmSearch--${pageName}");
let formData = formFields.get();
formData.sggCd = "41480"; // 시군구 코드 임시
formData.fetchSize = 30; // 한번에 30건씩 조회
return formData;
}
/**************************************************************************
* script 진입
**************************************************************************/
$(document).ready(function() {
// 검색조건 초기값 설정
initSearch${pageName}();
// 이벤트 설정
setEvent${pageName}();
${pageName}Control.addData(${crdnRe});
});
// #sourceURL=excl03010-main.jsp
</script> </script>

@ -1,6 +1,6 @@
/* Copyright (c) 2020 Emjay Khan. All rights reserved. */ /* Copyright (c) 2020 Emjay Khan. All rights reserved. */
/**@file Classes and objects to help control user data in HTML pages /**@file Classes and objects to help control user data in HTML pages
*/ */
function lpad(v) { function lpad(v) {
@ -26,7 +26,7 @@ const numberFormat = {
} }
}, },
/**Formats the value /**Formats the value
* @param {number} value value to format * @param {number} value value to format
* @returns {string} formatted value * @returns {string} formatted value
*/ */
@ -38,13 +38,13 @@ const numberFormat = {
/** value format for dates */ /** value format for dates */
const dateFormat = { const dateFormat = {
/**Formats the value /**Formats the value
* @param {number} value value to format * @param {number} value value to format
* @returns {string} formatted value * @returns {string} formatted value
*/ */
format(value) { format(value) {
if (isEmpty(value)) return ""; if (isEmpty(value)) return "";
let _format = v => { let _format = v => {
let date = "number" == typeof v ? new Date(v) : v; let date = "number" == typeof v ? new Date(v) : v;
let year = date.getFullYear(), let year = date.getFullYear(),
@ -52,7 +52,7 @@ const dateFormat = {
day = lpad(date.getDate()); day = lpad(date.getDate());
return year + "-" + month + "-" + day; return year + "-" + month + "-" + day;
}; };
switch (value instanceof Date ? "date" : typeof value) { switch (value instanceof Date ? "date" : typeof value) {
case "number": case "number":
case "date": return _format(value); case "date": return _format(value);
@ -64,7 +64,7 @@ const dateFormat = {
/** value format for time */ /** value format for time */
const timeFormat = { const timeFormat = {
/**Formats the value /**Formats the value
* @param {number} value value to format * @param {number} value value to format
* @returns {string} formatted value * @returns {string} formatted value
*/ */
@ -76,7 +76,7 @@ const timeFormat = {
seconds = lpad(date.getSeconds()); seconds = lpad(date.getSeconds());
return hours + ":" + minutes + ":" + seconds; return hours + ":" + minutes + ":" + seconds;
}; };
switch (value instanceof Date ? "date" : typeof value) { switch (value instanceof Date ? "date" : typeof value) {
case "number": case "number":
case "date": return _format(value); case "date": return _format(value);
@ -90,7 +90,7 @@ const timeFormat = {
/** value format for datetimes */ /** value format for datetimes */
const datetimeFormat = { const datetimeFormat = {
/**Formats the value /**Formats the value
* @param {number} value value to format * @param {number} value value to format
* @returns {string} formatted value * @returns {string} formatted value
*/ */
@ -114,8 +114,8 @@ const datetimeFormat = {
* key0: numberFormat, * key0: numberFormat,
* key1: dateFormat, * key1: dateFormat,
* key2: { * key2: {
* format(value) {...}, * format(value) {...},
* parse(value) {...} * parse(value) {...}
* } * }
* })</code></pre> * })</code></pre>
*/ */
@ -137,24 +137,24 @@ class ValueFormat {
* <ul> <li>parser associated with the key</li> * <ul> <li>parser associated with the key</li>
* <li>if not found for the key, default parser</li> * <li>if not found for the key, default parser</li>
* </ul> * </ul>
*/ */
parser(key) { parser(key) {
let parser = this._formats[key]; let parser = this._formats[key];
return parser && parser.parse ? parser.parse : ValueFormat.Default.parse; return parser && parser.parse ? parser.parse : ValueFormat.Default.parse;
} }
/**Returns a formatter associated with the key. /**Returns a formatter associated with the key.
* @param {string} key key associated with a value format * @param {string} key key associated with a value format
* @returns {function} * @returns {function}
* <ul> <li>formatter associated with the key</li> * <ul> <li>formatter associated with the key</li>
* <li>if not found for the key, default formatter</li> * <li>if not found for the key, default formatter</li>
* </ul> * </ul>
*/ */
formatter(key) { formatter(key) {
let formatter = this._formats[key]; let formatter = this._formats[key];
return formatter && formatter.format ? formatter.format : ValueFormat.Default.format; return formatter && formatter.format ? formatter.format : ValueFormat.Default.format;
} }
regexp(key) { regexp(key) {
let expr = this._exprs[key]; let expr = this._exprs[key];
if (!expr) if (!expr)
@ -172,7 +172,7 @@ ValueFormat.Default = {
/** Represents an invalid value. */ /** Represents an invalid value. */
ValueFormat.InvalidValue = "^invalid^value^"; ValueFormat.InvalidValue = "^invalid^value^";
/**Wraps a user data and traces the manipulation performed on it and consequent status. /**Wraps a user data and traces the manipulation performed on it and consequent status.
*/ */
class DataItem { class DataItem {
/** user data */ /** user data */
@ -183,7 +183,7 @@ class DataItem {
selected; selected;
/** state of the user data */ /** state of the user data */
state; state;
/**Creates a new DataItem. /**Creates a new DataItem.
* @param {any} data user data * @param {any} data user data
* @param {object} formats value formatters of the user data's property * @param {object} formats value formatters of the user data's property
@ -273,7 +273,7 @@ class DataItem {
/**Returns a string converted from the template using the property values of the user data. /**Returns a string converted from the template using the property values of the user data.
* In the template, placeholder for the properties of the user data is specified like {property name}. * In the template, placeholder for the properties of the user data is specified like {property name}.
* @param {string} template template string * @param {string} template template string
* @param {function} formatter function to format a row string with custom property placeholders * @param {function} formatter function to format a row string with custom property placeholders
* @returns {string} string converted from the template using the property values of the user data * @returns {string} string converted from the template using the property values of the user data
*/ */
inString(template, formatter) { inString(template, formatter) {
@ -291,7 +291,7 @@ class DataItem {
/**Manages user data wrapped in {@link DataItem}s, tracing the state after manipulation performed on them. /**Manages user data wrapped in {@link DataItem}s, tracing the state after manipulation performed on them.
* <p>For a Dataset to work properly, it needs a keymapper to identify user data. * <p>For a Dataset to work properly, it needs a keymapper to identify user data.
* And you specify it in a Dataset's configuration. * And you specify it in a Dataset's configuration.
* <pre><code>let dataset = new Dataset({ * <pre><code>let dataset = new Dataset({
* keymapper: function(info) {return info.keyProperty;}, * keymapper: function(info) {return info.keyProperty;},
* ... * ...
@ -338,12 +338,12 @@ class Dataset {
_items; _items;
_byKeys; _byKeys;
_current; _current;
/**Dataset configuration /**Dataset configuration
*/ */
conf; conf;
_formats; _formats;
/**Creates a new Dataset with a configuration. /**Creates a new Dataset with a configuration.
* The configuration is an object with which you specify * The configuration is an object with which you specify
* <ul> <li>keymapper - function that returns a key of a user data. Used to identify user data in the Dataset. Mandatory.</li> * <ul> <li>keymapper - function that returns a key of a user data. Used to identify user data in the Dataset. Mandatory.</li>
@ -359,21 +359,21 @@ class Dataset {
* <li>{@link Dataset#onRemove onRemove}</li> * <li>{@link Dataset#onRemove onRemove}</li>
* <li>{@link Dataset#onErase onErase}</li> * <li>{@link Dataset#onErase onErase}</li>
* <li>{@link Dataset#onDirtiesChange onDirtiesChange}</li> * <li>{@link Dataset#onDirtiesChange onDirtiesChange}</li>
* </ul> * </ul>
* </li> * </li>
* <li>trace - true to enable message logging</li> * <li>trace - true to enable message logging</li>
* </ul> * </ul>
* @param conf {object} configuration * @param conf {object} configuration
*/ */
constructor(conf) { constructor(conf) {
this._items = []; this._items = [];
this._byKeys = {}; this._byKeys = {};
this._current = null; this._current = null;
this.conf = notEmpty(conf, "conf is required but missing"); this.conf = notEmpty(conf, "conf is required but missing");
notEmpty(conf.keymapper, "keymapper is required but missing"); notEmpty(conf.keymapper, "keymapper is required but missing");
this._formats = new ValueFormat(conf.formats); this._formats = new ValueFormat(conf.formats);
if (!conf.trace) if (!conf.trace)
this.log = () => {}; this.log = () => {};
@ -428,12 +428,12 @@ class Dataset {
* let added = dirties.added; * let added = dirties.added;
* let modified = dirties.modified; * let modified = dirties.modified;
* let removed = dirties.removed; * let removed = dirties.removed;
*/ */
getKeys(status){ getKeys(status){
let dataset = this.getDataset(status); let dataset = this.getDataset(status);
if ("dirty" != status) if ("dirty" != status)
return dataset.map(e => this.getKey(e)); return dataset.map(e => this.getKey(e));
let result = {}; let result = {};
for (let prop in dataset) { for (let prop in dataset) {
result[prop] = dataset[prop].map(e => this.getKey(e)); result[prop] = dataset[prop].map(e => this.getKey(e));
@ -474,7 +474,7 @@ class Dataset {
let state = this.state; let state = this.state;
this._byKeys = {}; this._byKeys = {};
this._current = null; this._current = null;
let data = this._getDataItems(obj = obj || {}); let data = this._getDataItems(obj = obj || {});
this._items = data.items; this._items = data.items;
this._byKeys = data.byKeys; this._byKeys = data.byKeys;
@ -483,7 +483,7 @@ class Dataset {
let array = Array.isArray(obj) ? obj : this.conf.dataGetter(obj) || []; let array = Array.isArray(obj) ? obj : this.conf.dataGetter(obj) || [];
if (!Array.isArray(array)) if (!Array.isArray(array))
throw new Error("The data must be an array"); throw new Error("The data must be an array");
this._items = array.map(e => new DataItem(e, this._formats)); this._items = array.map(e => new DataItem(e, this._formats));
this._items.forEach(item => { this._items.forEach(item => {
let key = "key-" + this.getKey(item.data); let key = "key-" + this.getKey(item.data);
@ -493,28 +493,28 @@ class Dataset {
this.onDatasetChange(obj); this.onDatasetChange(obj);
this.setState(!Array.isArray(obj) ? obj.state : state); this.setState(!Array.isArray(obj) ? obj.state : state);
this.onDirtiesChange(this.dirty); this.onDirtiesChange(this.dirty);
return this; return this;
} }
_getDataItems(obj) { _getDataItems(obj) {
let array = Array.isArray(obj) ? obj : this.conf.dataGetter(obj) || []; let array = Array.isArray(obj) ? obj : this.conf.dataGetter(obj) || [];
if (!Array.isArray(array)) if (!Array.isArray(array))
throw new Error("The data must be an array"); throw new Error("The data must be an array");
let _items = array.map(e => new DataItem(e, this._formats)), let _items = array.map(e => new DataItem(e, this._formats)),
_byKeys = {}; _byKeys = {};
_items.forEach(item => { _items.forEach(item => {
let key = "key-" + this.getKey(item.data); let key = "key-" + this.getKey(item.data);
_byKeys[key] = item; _byKeys[key] = item;
}); });
return { return {
items: _items, items: _items,
byKeys: _byKeys byKeys: _byKeys
}; };
} }
/**Adds user data to the Dataset. /**Adds user data to the Dataset.
* To get user data from an object, the dataGetter configured is called. * To get user data from an object, the dataGetter configured is called.
* After user data is set, the methods * After user data is set, the methods
@ -530,7 +530,7 @@ class Dataset {
addData(obj) { addData(obj) {
if (this.empty) if (this.empty)
return this.setData(obj); return this.setData(obj);
let state = this.state; let state = this.state;
let data = this._getDataItems(obj = obj || {}); let data = this._getDataItems(obj = obj || {});
this._items = this._items.concat(data.items); this._items = this._items.concat(data.items);
@ -538,17 +538,17 @@ class Dataset {
...this._byKeys, ...this._byKeys,
...data.byKeys ...data.byKeys
}; };
this.onDatasetChange(obj); this.onDatasetChange(obj);
this.setState(!Array.isArray(obj) ? obj.state : state); this.setState(!Array.isArray(obj) ? obj.state : state);
this.onDirtiesChange(this.dirty); this.onDirtiesChange(this.dirty);
return this; return this;
} }
/**Clears the Dataset's user data. /**Clears the Dataset's user data.
* @returns {Dataset} the Dataset * @returns {Dataset} the Dataset
*/ */
clear() { clear() {
this.setData(null); this.setData(null);
@ -588,7 +588,7 @@ class Dataset {
/**Sets the user data as current that is associated with the key. /**Sets the user data as current that is associated with the key.
* @param {string} key key to a user data * @param {string} key key to a user data
* After the data is set, the method * After the data is set, the method
* <ul> <li>{@link Dataset#onCurrentChange}</li> * <ul> <li>{@link Dataset#onCurrentChange}</li>
* </ul> * </ul>
* is called back. * is called back.
@ -621,7 +621,7 @@ class Dataset {
} }
/**Sets the state to the Dataset. /**Sets the state to the Dataset.
* After the state is set, the methods * After the state is set, the methods
* <ul> <li>{@link Dataset#onCurrentChange}</li> * <ul> <li>{@link Dataset#onCurrentChange}</li>
* <li>{@link Dataset#onSelectionChange}</li> * <li>{@link Dataset#onSelectionChange}</li>
* </ul> * </ul>
@ -719,7 +719,7 @@ class Dataset {
} }
if ("item" == option) if ("item" == option)
return result; return result;
let getData = item => item.data; let getData = item => item.data;
if ("dirty" != status) if ("dirty" != status)
return "item" == option ? result : result.map(e => getData(e)); return "item" == option ? result : result.map(e => getData(e));
@ -818,13 +818,13 @@ class Dataset {
*/ */
append(data) { append(data) {
if (!data) return this; if (!data) return this;
let notDirty = !this.dirty, let notDirty = !this.dirty,
array = Array.isArray(data) ? data : [data]; array = Array.isArray(data) ? data : [data];
array.forEach(e => { array.forEach(e => {
let item = new DataItem(e, this._formats); let item = new DataItem(e, this._formats);
this._items.push(item); this._items.push(item);
let key = this.getKey(e); let key = this.getKey(e);
this._byKeys["key-" + key] = item; this._byKeys["key-" + key] = item;
item.state = "added"; item.state = "added";
@ -834,10 +834,10 @@ class Dataset {
this.onAppend(array); this.onAppend(array);
state.currentKey = this.getKey(array[array.length - 1]); state.currentKey = this.getKey(array[array.length - 1]);
this.setState(state); this.setState(state);
if (notDirty) if (notDirty)
this.onDirtiesChange(true); this.onDirtiesChange(true);
return this; return this;
}; };
@ -865,11 +865,11 @@ class Dataset {
*/ */
modify(key, modifier) { modify(key, modifier) {
if (!modifier) return this; if (!modifier) return this;
let item = this.getData(key, "item"); let item = this.getData(key, "item");
if (!item) if (!item)
return log("Item not found with " + key); return log("Item not found with " + key);
let notDirty = !this.dirty, let notDirty = !this.dirty,
data = item.data, data = item.data,
prev = Object.assign({}, data), prev = Object.assign({}, data),
@ -883,11 +883,11 @@ class Dataset {
} }
return changed; return changed;
}; };
let current = data == this.getCurrent(), let current = data == this.getCurrent(),
revert = modifier(item) == ValueFormat.InvalidValue, revert = modifier(item) == ValueFormat.InvalidValue,
changed = modifiedProps(prev, data); changed = modifiedProps(prev, data);
if (changed.length > 0) { if (changed.length > 0) {
if (!item.state) if (!item.state)
item.state = "modified"; item.state = "modified";
@ -931,30 +931,30 @@ class Dataset {
*/ */
replace(replacement) { replace(replacement) {
if (isEmpty(replacement)) return this; if (isEmpty(replacement)) return this;
let before = this.dirty, let before = this.dirty,
replacements = Array.isArray(replacement) ? replacement : [replacement], replacements = Array.isArray(replacement) ? replacement : [replacement],
replacing = []; replacing = [];
replacements.forEach(obj => { replacements.forEach(obj => {
let data = obj.data; let data = obj.data;
if (!data) return; if (!data) return;
let key = obj.key || this.getKey(data); let key = obj.key || this.getKey(data);
if (!key) return; if (!key) return;
let oldItem = this.getData(key, "item"), let oldItem = this.getData(key, "item"),
newItem = new DataItem(data, this._formats), newItem = new DataItem(data, this._formats),
pos = oldItem ? this._items.indexOf(oldItem) : -1; pos = oldItem ? this._items.indexOf(oldItem) : -1;
newItem.selected = oldItem && oldItem.selected; newItem.selected = oldItem && oldItem.selected;
if (pos > -1) if (pos > -1)
this._items[pos] = newItem; this._items[pos] = newItem;
else else
this._items.push(newItem); this._items.push(newItem);
delete this._byKeys["key-" + key]; delete this._byKeys["key-" + key];
this._byKeys["key-" + this.getKey(data)] = newItem; this._byKeys["key-" + this.getKey(data)] = newItem;
if (this._current == oldItem) if (this._current == oldItem)
this._current = newItem; this._current = newItem;
@ -984,7 +984,7 @@ class Dataset {
*/ */
remove(key) { remove(key) {
if (!key || this.empty) return this; if (!key || this.empty) return this;
let before = this.dirty, let before = this.dirty,
keys = Array.isArray(key) ? key : [key], keys = Array.isArray(key) ? key : [key],
removed = this._items.filter(item => { removed = this._items.filter(item => {
@ -997,13 +997,13 @@ class Dataset {
}), }),
currentPos = this._items.indexOf(this._current), currentPos = this._items.indexOf(this._current),
state = this.state; state = this.state;
if (currentPos > -1) { if (currentPos > -1) {
let newKey = null; let newKey = null;
for (let i = currentPos, length = this._items.length; i < length; ++i) { for (let i = currentPos, length = this._items.length; i < length; ++i) {
let item = this._items[i]; let item = this._items[i];
if (item.unreachable) continue; if (item.unreachable) continue;
newKey = this.getKey(item); newKey = this.getKey(item);
break; break;
} }
@ -1011,7 +1011,7 @@ class Dataset {
for (let i = this._items.length - 1; i > 0; --i) { for (let i = this._items.length - 1; i > 0; --i) {
let item = this._items[i]; let item = this._items[i];
if (item.unreachable) continue; if (item.unreachable) continue;
newKey = this.getKey(item); newKey = this.getKey(item);
break; break;
} }
@ -1022,7 +1022,7 @@ class Dataset {
let after = this.dirty; let after = this.dirty;
if (before != after) if (before != after)
this.onDirtiesChange(after); this.onDirtiesChange(after);
return this; return this;
} }
@ -1035,7 +1035,7 @@ class Dataset {
* </ul> * </ul>
* are called. * are called.
* Note that unlike {@link Dataset#remove} this method deletes user data completely from the Dataset * Note that unlike {@link Dataset#remove} this method deletes user data completely from the Dataset
* and the erased user data are not traced as dirty user data. * and the erased user data are not traced as dirty user data.
* @param {string|array} key key or keys to user data * @param {string|array} key key or keys to user data
* @returns {Dataset} the Dataset * @returns {Dataset} the Dataset
* @example * @example
@ -1044,7 +1044,7 @@ class Dataset {
*/ */
erase(key) { erase(key) {
if (!key || this.empty) return; if (!key || this.empty) return;
let before = this.dirty, let before = this.dirty,
keys = Array.isArray(key) ? key : [key], keys = Array.isArray(key) ? key : [key],
erased = this._items.filter(item => { erased = this._items.filter(item => {
@ -1055,16 +1055,16 @@ class Dataset {
} }
return erase; return erase;
}); });
let currentPos = erased.indexOf(this._current) > -1 ? this._items.indexOf(this._current) : -1, let currentPos = erased.indexOf(this._current) > -1 ? this._items.indexOf(this._current) : -1,
state = this.state; state = this.state;
if (currentPos > -1) { if (currentPos > -1) {
let newKey = null; let newKey = null;
for (let i = currentPos + 1, length = this._items.length; i < length; ++i) { for (let i = currentPos + 1, length = this._items.length; i < length; ++i) {
let item = this._items[i]; let item = this._items[i];
if (item.unreachable || erased.includes(item)) continue; if (item.unreachable || erased.includes(item)) continue;
newKey = this.getKey(item); newKey = this.getKey(item);
break; break;
} }
@ -1072,7 +1072,7 @@ class Dataset {
for (let i = this._items.length - 1; i > 0; --i) { for (let i = this._items.length - 1; i > 0; --i) {
let item = this._items[i]; let item = this._items[i];
if (item.unreachable || erased.includes(item)) continue; if (item.unreachable || erased.includes(item)) continue;
newKey = this.getKey(item); newKey = this.getKey(item);
break; break;
} }
@ -1090,7 +1090,7 @@ class Dataset {
/**Returns an array of strings converted from the template using the property values of the Dataset's user data. /**Returns an array of strings converted from the template using the property values of the Dataset's user data.
* In the template, placeholder for the properties of the user data is specified like {property name}. * In the template, placeholder for the properties of the user data is specified like {property name}.
* @param {string} template template string * @param {string} template template string
* @param {function} formatter function to format a row string with custom property placeholders * @param {function} formatter function to format a row string with custom property placeholders
* @returns {array} array of strings converted from the template using the property values of the user data * @returns {array} array of strings converted from the template using the property values of the user data
*/ */
inStrings(template, formatter) { inStrings(template, formatter) {
@ -1122,7 +1122,7 @@ class Dataset {
break; break;
default: return null; default: return null;
} }
let item = this.getData(key, "item"); let item = this.getData(key, "item");
return item ? item.getValue(property) : undefined; return item ? item.getValue(property) : undefined;
} }
@ -1143,7 +1143,7 @@ class Dataset {
*/ */
setValue(...args) { setValue(...args) {
let key = null, let key = null,
property = null, property = null,
value = null; value = null;
switch (args.length) { switch (args.length) {
case 2: case 2:
@ -1167,46 +1167,46 @@ class Dataset {
* @param {object|array} obj object that has user data or an array of user data * @param {object|array} obj object that has user data or an array of user data
*/ */
onDatasetChange(obj) {this.log("Dataset changed", obj);} onDatasetChange(obj) {this.log("Dataset changed", obj);}
/**Called back when current user data is changed. /**Called back when current user data is changed.
* @param {DataItem} currentItem current dataItem * @param {DataItem} currentItem current dataItem
*/ */
onCurrentChange(currentItem) {this.log("Current changed", currentItem);} onCurrentChange(currentItem) {this.log("Current changed", currentItem);}
/**Called back when user data selection changes. /**Called back when user data selection changes.
* @param {array} selected array of selected user data * @param {array} selected array of selected user data
*/ */
onSelectionChange(selected) {this.log("Selection changed", selected);} onSelectionChange(selected) {this.log("Selection changed", selected);}
/**Called back when user data is appended. /**Called back when user data is appended.
* @param {object|array} appended user data or array of user data * @param {object|array} appended user data or array of user data
*/ */
onAppend(appended) {this.log("Data appended", appended);} onAppend(appended) {this.log("Data appended", appended);}
/**Called back when user data is modified. /**Called back when user data is modified.
* @param {array} props names of changed properties * @param {array} props names of changed properties
* @param {DataItem} modified modified user dataItem * @param {DataItem} modified modified user dataItem
* @param {boolean} current whether current user data is modified * @param {boolean} current whether current user data is modified
*/ */
onModify(props, modified, current) {this.log("Data modified", props, modified, current ? "current" : "");} onModify(props, modified, current) {this.log("Data modified", props, modified, current ? "current" : "");}
/**Called back when user data are replaced. /**Called back when user data are replaced.
* @param {array} replacing array of user dataItems replacing the old ones * @param {array} replacing array of user dataItems replacing the old ones
*/ */
onReplace(replacing) {this.log("Data replaced", replacing);} onReplace(replacing) {this.log("Data replaced", replacing);}
/**Called back when user data are removed. /**Called back when user data are removed.
* @param {array} removed array of removed dataItems * @param {array} removed array of removed dataItems
*/ */
onRemove(removed) {this.log("Data removed", removed)} onRemove(removed) {this.log("Data removed", removed)}
/**Called back when user data are erased. /**Called back when user data are erased.
* @param {array} erased array of erased dataItems * @param {array} erased array of erased dataItems
*/ */
onErase(erased) {this.log("Data erased", erased)} onErase(erased) {this.log("Data erased", erased)}
/**Called back when the Dataset gets dirty or not dirty. /**Called back when the Dataset gets dirty or not dirty.
* @param {boolean} dirty * @param {boolean} dirty
* <ul> <li>true if the Dataset is dirty</li> * <ul> <li>true if the Dataset is dirty</li>
* <li>false otherwise</li> * <li>false otherwise</li>
* </ul> * </ul>
@ -1221,9 +1221,9 @@ class DatasetControl {
this.prefixName = conf.prefixName; this.prefixName = conf.prefixName;
this.infoSize = conf.infoSize; this.infoSize = conf.infoSize;
this.appendData = conf.appendData; this.appendData = conf.appendData;
this.query = {}; this.query = {};
conf.onDatasetChange = obj => this.onDatasetChange(obj), conf.onDatasetChange = obj => this.onDatasetChange(obj),
conf.onCurrentChange = item => this.onCurrentChange(item), conf.onCurrentChange = item => this.onCurrentChange(item),
conf.onSelectionChange = selected => this.onSelectionChange(selected), conf.onSelectionChange = selected => this.onSelectionChange(selected),
@ -1236,7 +1236,7 @@ class DatasetControl {
} }
this.dataset = new Dataset(conf); this.dataset = new Dataset(conf);
this.urls = conf.urls || { this.urls = conf.urls || {
load:this.url("/list.do"), load:this.url("/list.do"),
getInfo:this.url("/info.do"), getInfo:this.url("/info.do"),
@ -1245,11 +1245,11 @@ class DatasetControl {
remove:this.url("/remove.do") remove:this.url("/remove.do")
}; };
} }
prefixed(str) { prefixed(str) {
return (this.prefix || "") + str; return (this.prefix || "") + str;
} }
url(str) { url(str) {
return wctx.url("/" + this.prefixed(str)); return wctx.url("/" + this.prefixed(str));
} }
@ -1278,7 +1278,7 @@ class DatasetControl {
setData(obj) { setData(obj) {
this.dataset.setData(obj); this.dataset.setData(obj);
} }
addData(obj) { addData(obj) {
this.dataset.addData(obj); this.dataset.addData(obj);
} }
@ -1286,7 +1286,7 @@ class DatasetControl {
onDatasetChange(obj) { onDatasetChange(obj) {
debug("onDatasetChange", obj); debug("onDatasetChange", obj);
} }
getCurrent(option) { getCurrent(option) {
return this.dataset.getCurrent(option); return this.dataset.getCurrent(option);
} }
@ -1328,42 +1328,42 @@ class DatasetControl {
else else
this.setInfo(info); this.setInfo(info);
} }
setInfo(info) {} setInfo(info) {}
newInfo(obj) { newInfo(obj) {
this.dataset.append(obj || {}); this.dataset.append(obj || {});
this.getInfo(); this.getInfo();
} }
getValue(name) { getValue(name) {
return this.dataset.getValue(name); return this.dataset.getValue(name);
} }
setValue(name, value) { setValue(name, value) {
this.dataset.setValue(name, value); this.dataset.setValue(name, value);
} }
onAppend(items) { onAppend(items) {
debug("on append", items); debug("on append", items);
} }
onModify(props, modified, current) { onModify(props, modified, current) {
debug("on modify", props, "modified", modified, "current", current); debug("on modify", props, "modified", modified, "current", current);
} }
save(info) { save(info) {
if (!info) return; if (!info) return;
let item = this.getCurrent("item"), let item = this.getCurrent("item"),
create = "added" == item.state; create = "added" == item.state;
ajax.post({ ajax.post({
url:!create ? this.urls.update : this.urls.create, url:!create ? this.urls.update : this.urls.create,
data:info, data:info,
success:resp => this.onSave(resp) success:resp => this.onSave(resp)
}); });
} }
onSave(resp) { onSave(resp) {
if (resp.saved) { if (resp.saved) {
dialog.alert("저장됐습니다."); dialog.alert("저장됐습니다.");
@ -1371,7 +1371,7 @@ class DatasetControl {
this._load(); this._load();
} }
} }
remove(params) { remove(params) {
let selected = this.dataset.getKeys("selected"); let selected = this.dataset.getKeys("selected");
if (selected.length < 1) return; if (selected.length < 1) return;
@ -1380,14 +1380,14 @@ class DatasetControl {
params = {}; params = {};
params[this.prefixed("IDs")] = selected.join(","); params[this.prefixed("IDs")] = selected.join(",");
} }
ajax.post({ ajax.post({
url:this.urls.remove, url:this.urls.remove,
data:params, data:params,
success:resp => this.onRemove(selected, resp) success:resp => this.onRemove(selected, resp)
}); });
} }
onRemove(selected, resp) { onRemove(selected, resp) {
if (resp.saved) if (resp.saved)
this._load(); this._load();

@ -1,16 +1,19 @@
class LevyExclControl extends DatasetControl { class LevyExclControl extends DatasetControl {
constructor(conf) { constructor(prefixUrl) {
super(conf || { let conf = {
prefix : "levyExcl" prefix : "levyExcl"
, prefixName : "부과제외" , prefixName : "부과제외"
, infoSize : "xl" , infoSize : "xl"
, urls : {
load : wctx.url("/excl/excl01/010/list.do")
, getInfo : wctx.url("/excl/excl01/020/info.do")
}
, keymapper : info => info ? info.LEVY_EXCL_ID : "" , keymapper : info => info ? info.LEVY_EXCL_ID : ""
, dataGetter : obj => obj.levyExclList , dataGetter : obj => obj.levyExclList
, appendData : true , appendData : true
, urls : {
load : wctx.url(prefixUrl + "/010/list.do")
, getInfo : wctx.url(prefixUrl + "/020/info.do")
, create : wctx.url(prefixUrl + "/020/create.do")
, update : wctx.url(prefixUrl + "/020/update.do")
, remove : wctx.url(prefixUrl + "/020/remove.do")
}
, formats : { , formats : {
LEVY_EXCL_YMD : dateFormat LEVY_EXCL_YMD : dateFormat
, CRDN_YMD_TM : datetimeFormat , CRDN_YMD_TM : datetimeFormat
@ -18,6 +21,7 @@ class LevyExclControl extends DatasetControl {
, REG_DT : datetimeFormat , REG_DT : datetimeFormat
, MDFCN_DT : datetimeFormat , MDFCN_DT : datetimeFormat
} }
}); }
super(conf);
} }
} }

@ -1,16 +1,19 @@
class OpnnSbmsnControl extends DatasetControl { class OpnnSbmsnControl extends DatasetControl {
constructor(conf) { constructor(prefixUrl) {
super(conf || { let conf = {
prefix : "opnnSbmsn" prefix : "opnnSbmsn"
, prefixName : "의견제출" , prefixName : "의견제출"
, infoSize : "xl" , infoSize : "xl"
, urls : {
load : wctx.url("/excl/excl02/010/list.do")
, getInfo : wctx.url("/excl/excl02/020/info.do")
}
, keymapper : info => info ? info.OPNN_ID : "" , keymapper : info => info ? info.OPNN_ID : ""
, dataGetter : obj => obj.opnnSbmsnList , dataGetter : obj => obj.opnnSbmsnList
, appendData : true , appendData : true
, urls : {
load : wctx.url(prefixUrl + "/010/list.do")
, getInfo : wctx.url(prefixUrl + "/020/info.do")
, create : wctx.url(prefixUrl + "/020/create.do")
, update : wctx.url(prefixUrl + "/020/update.do")
, remove : wctx.url(prefixUrl + "/020/remove.do")
}
, formats : { , formats : {
RCPT_YMD : dateFormat RCPT_YMD : dateFormat
, ANS_YMD : dateFormat , ANS_YMD : dateFormat
@ -19,7 +22,7 @@ class OpnnSbmsnControl extends DatasetControl {
, REG_DT : datetimeFormat , REG_DT : datetimeFormat
, MDFCN_DT : datetimeFormat , MDFCN_DT : datetimeFormat
} }
}); }
super(conf);
} }
} }

@ -1,22 +1,25 @@
class CrdnReControl extends DatasetControl { class CrdnReControl extends DatasetControl {
constructor(conf) { constructor(prefixUrl) {
super(conf || { let conf = {
prefix : "crdnRe" prefix : "crdnRe"
, prefixName : "단속재등록" , prefixName : "단속재등록"
, infoSize : "xl" , infoSize : "xl"
, urls : {
load : wctx.url("/excl/excl03/010/list.do")
, getInfo : wctx.url("/excl/excl03/020/info.do")
}
, keymapper : info => info ? info.RE_REG_ID : "" , keymapper : info => info ? info.RE_REG_ID : ""
, dataGetter : obj => obj.crdnReList , dataGetter : obj => obj.crdnReList
, appendData : true , appendData : true
, urls : {
load : wctx.url(prefixUrl + "/010/list.do")
, create : wctx.url(prefixUrl + "/010/create.do")
, update : wctx.url(prefixUrl + "/010/update.do")
, remove : wctx.url(prefixUrl + "/010/remove.do")
}
, formats : { , formats : {
CRDN_REG_YMD : dateFormat CRDN_REG_YMD : dateFormat
, CRDN_YMD_TM : datetimeFormat , CRDN_YMD_TM : datetimeFormat
, REG_DT : datetimeFormat , REG_DT : datetimeFormat
} }
}); }
super(conf);
} }
} }

Loading…
Cancel
Save