임대기업 관리 수정.

main
jjh 3 months ago
parent 802338ea63
commit 7092c778a2

@ -1,23 +1,23 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%> <%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<c:set var="prefixName" scope="request">임대기업</c:set> <c:set var="prefixName" scope="request">임대기업 관리</c:set>
<!-- inner page html --> <!-- inner page html -->
<div class="content-wrapper"> <div class="content-wrapper" data-doctx="${pageName}">
<!-- Content --> <!-- Content -->
<div class="container-xxl flex-grow-1 px-0"> <div class="container-xxl flex-grow-1 px-0">
<div class="card wrapper-list"> <div class="card wrapper-list">
<!-- 상단 버튼 --> <!-- 상단 버튼 -->
<div class="container-page-btn"> <div class="container-page-btn">
<button type="button" class="btn btn-outline-dark w-px-120" id="btnReset--${pageName}" title="초기화"> <button type="button" class="btn btn-outline-dark w-px-120" name="btnReset" title="초기화">
초기화 초기화
</button> </button>
<span class="container-window-btn-right"> <span class="container-window-btn-right">
<button type="button" class="btn btn-search w-px-120" id="btnSearch--${pageName}" title="검색"> <button type="button" class="btn btn-search w-px-120" name="btnSearch" title="검색">
검색 검색
</button> </button>
<button type="button" class="btn btn-excel w-px-120" id="btnExcel--${pageName}" title="엑셀"> <button type="button" class="btn btn-excel w-px-120" name="btnExcel" title="엑셀">
엑셀 엑셀
</button> </button>
</span> </span>
@ -25,18 +25,17 @@
<!-- 상단 버튼 --> <!-- 상단 버튼 -->
<!-- 검색 조건 영역 --> <!-- 검색 조건 영역 -->
<form id="frmSearch--${pageName}" name="frmSearch"> <form name="frmSearch">
<!-- hidden --> <!-- hidden -->
<input type="hidden" id="sggCd--${pageName}" name="sggCd" /> <input type="hidden" name="userId" />
<input type="hidden" id="userId--${pageName}" name="userId" />
<!-- 메인 조건 --> <!-- 메인 조건 -->
<div class="container-search"> <div class="container-search">
<div class="row g-1"> <div class="row g-1">
<!-- 사용자 계정 --> <!-- 사용자 계정 -->
<div class="col-4"> <div class="col-4">
<label class="form-label fw-bold form-search-title w-px-120 text-end" for="schUserAcnt--${pageName}">사용자계정</label> <label is="name-label" class="form-label fw-bold form-search-title w-px-120 text-end" for="schUserAcnt">사용자계정</label>
<input type="text" class="form-control w-px-160" id="schUserAcnt--${pageName}" name="schUserAcnt" readonly autocomplete="off" /> <input is="id-input" type="text" class="form-control w-px-160" name="schUserAcnt" autocomplete="off" readonly />
</div> </div>
</div> </div>
</div> <!-- 메인 조건 --> </div> <!-- 메인 조건 -->
@ -48,16 +47,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">
<span class="dataTables_info" id="paging--${pageName}PagingInfo" role="status" aria-live="polite"></span> <span is="paging-info" class="dataTables_info" name="dataPagingInfo" role="status" aria-live="polite"></span>
<ul class="pagination pagination-primary" id="paging--${pageName}"> <ul class="pagination pagination-primary" name="dataPaging">
</ul> </ul>
</div> </div>
<!-- 업무 버튼 --> <!-- 업무 버튼 -->
<span class="container-window-btn-right"> <span class="container-window-btn-right">
<button type="button" class="btn btn-primary w-px-120" id="btnCreate--${pageName}" title="임대기업 매핑 등록"> <button type="button" class="btn btn-primary w-px-120" name="btnCreate" title="임대기업 매핑 등록">
매핑 등록 매핑 등록
</button> </button>
<button type="button" class="btn btn-primary w-px-120" id="btnRemove--${pageName}" title="임대기업 매핑 삭제"> <button type="button" class="btn btn-primary w-px-120" name="btnRemove" title="임대기업 매핑 삭제">
매핑 삭제 매핑 삭제
</button> </button>
</span> </span>
@ -67,21 +66,22 @@
<!-- DataTables(그리드) --> <!-- DataTables(그리드) -->
<div class="card-datatable text-nowrap"> <div class="card-datatable text-nowrap">
<div class="dataTables_wrapper dt-bootstrap5 no-footer" id="DataTables_Table_0_wrapper--${pageName}"> <div class="dataTables_wrapper dt-bootstrap5 no-footer">
<div class="table-responsive ox-scroll oy-scroll h-px-500" id="table-responsive--${pageName}"> <div class="table-responsive ox-scroll oy-scroll h-px-500" name="table-responsive">
<table class="table-layout-fixed dataTable datatables-ajax table table-bordered no-footer" id="DataTables_Table_0--${pageName}" aria-describedby="DataTables_Table_0_info"> <table class="table-layout-fixed dataTable datatables-ajax table table-bordered no-footer" name="DataTables_Table_0" aria-describedby="DataTables_Table_0_info">
<thead class="sticky-thead"> <thead class="sticky-thead">
<tr id="theadTr--${pageName}" <tr name="theadTr" data-search-target="[data-doctx='${pageName}']">
data-by="by--${pageName}" data-by-output="byOutput--${pageName}" data-main-option="mainOption--${pageName}" data-sub-option="subOption--${pageName}">
<th class="cmn" style="width: 72px;">No.</th> <th class="cmn" style="width: 72px;">No.</th>
<th class="cmn" style="width: 56px;"><input type="checkbox" class="form-check-input" id="gridAllCheckbox--${pageName}" onchange="pageObject['${pageName}'].control.select(this.checked);" /></th> <th class="cmn" style="width: 56px;"><input type="checkbox" class="form-check-input" name="gridAllCheckbox" onchange="pageObject['${pageName}'].dataTableCheckbox(this, this.checked);" /></th>
<th class="cmn" style="width: 160px;" onclick="searchFromGridTitle('USER_ACNT', this.innerText, 'match', 'part');">사용자계정</th>
<th class="cmn" style="width: 120px;" onclick="searchFromGridTitle('USER_NM', this.innerText, 'match', 'part');">사용자명</th>
<th class="cmn" style="width: 120px;" onclick="searchFromGridTitle('ENT_SE_CD', this.innerText, 'codeValue', 'FIM088');">기업구분</th> <th class="cmn" style="width: 120px;" onclick="searchFromGridTitle('ENT_SE_CD', this.innerText, 'codeValue', 'FIM088');">기업구분</th>
<th class="cmn" style="width: 160px;" onclick="searchFromGridTitle('ENT_NM', this.innerText, 'ymd', '');">기업명</th> <th class="cmn" style="width: 200px;" onclick="searchFromGridTitle('ENT_NM', this.innerText, 'match', 'part');">기업명</th>
<th class="cmn" style="width: 200px;" onclick="searchFromGridTitle('ENT_NO', this.innerText, 'match', 'part');">법인(사업자)번호</th> <th class="cmn" style="width: 160px;" onclick="searchFromGridTitle('ENT_NO', this.innerText, 'match', 'part');">법인(사업자)번호</th>
<th class="cmn" style="width: 160px;" onclick="searchFromGridTitle('RPRSV_NM', this.innerText, 'ymd', '');">대표자명</th> <th class="cmn" style="width: 120px;" onclick="searchFromGridTitle('RPRSV_NM', this.innerText, 'match', 'part');">대표자명</th>
<th class="cmn" style="width: 160px;" onclick="searchFromGridTitle('ENT_TELNO', this.innerText, 'match', 'part');">전화번호</th> <th class="cmn" style="width: 160px;" onclick="searchFromGridTitle('ENT_TELNO', this.innerText, 'match', 'part');">전화번호</th>
<th class="cmn" style="width: 120px;" onclick="searchFromGridTitle('ENT_FXNO', this.innerText, 'match', 'part');">팩스번호</th> <th class="cmn" style="width: 160px;" onclick="searchFromGridTitle('ENT_FXNO', this.innerText, 'match', 'part');">팩스번호</th>
<th class="cmn" style="width: 280px;" onclick="searchFromGridTitle('ENT_EML_ADDR', this.innerText, 'match', 'part');">이메일주소</th> <th class="cmn" style="width: 240px;" onclick="searchFromGridTitle('ENT_EML_ADDR', this.innerText, 'match', 'part');">이메일주소</th>
<th class="cmn" style="width: 100px;" onclick="searchFromGridTitle('ENT_ZIP', this.innerText, 'match', 'part');">우편번호</th> <th class="cmn" style="width: 100px;" onclick="searchFromGridTitle('ENT_ZIP', this.innerText, 'match', 'part');">우편번호</th>
<th class="cmn" style="width: 280px;" onclick="searchFromGridTitle('ENT_ADDR', this.innerText, 'match', 'part');">주소</th> <th class="cmn" style="width: 280px;" onclick="searchFromGridTitle('ENT_ADDR', this.innerText, 'match', 'part');">주소</th>
<th class="cmn" style="width: 320px;" onclick="searchFromGridTitle('ENT_DTL_ADDR', this.innerText, 'match', 'part');">상세주소</th> <th class="cmn" style="width: 320px;" onclick="searchFromGridTitle('ENT_DTL_ADDR', this.innerText, 'match', 'part');">상세주소</th>
@ -90,30 +90,32 @@
<th class="cmn dummy-th"></th> <th class="cmn dummy-th"></th>
</tr> </tr>
</thead> </thead>
<tbody id="tbody--${pageName}"> <tbody name="tbodyList">
</tbody> </tbody>
<template id="${infoPrefix}Row--${pageName}"> <template is="curly-brackets" name="dataRow">
<tr data-key="{MPNG_ID}"> <tr data-key="MPNG_ID">
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{ROW_NUM}</td> <td class="cmn text-center" onclick ondblclick>{ROW_NUM}</td>
<td class="cmn text-center"><input type="checkbox" class="form-check-input" name="gridCheckbox" value="{MPNG_ID}" onchange="pageObject['${pageName}'].control.select('{MPNG_ID}', this.checked);"></td> <td class="cmn text-center"><input type="checkbox" class="form-check-input" name="gridCheckbox" value="MPNG_ID" onchange="pageObject['${pageName}'].dataTableCheckbox(this, this.checked);" /></td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{ENT_SE_NM}</td> <td class="cmn text-start" onclick ondblclick>{USER_ACNT}</td>
<td class="cmn text-start" onclick="{onclick}" ondblclick="{ondblclick}">{ENT_NM}</td> <td class="cmn text-center" onclick ondblclick>{USER_NM}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{ENT_NO}</td> <td class="cmn text-center" onclick ondblclick>{ENT_SE_NM}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{RPRSV_NM}</td> <td class="cmn text-start" onclick ondblclick>{ENT_NM}</td>
<td class="cmn text-start" onclick="{onclick}" ondblclick="{ondblclick}">{ENT_TELNO}</td> <td class="cmn text-center" onclick ondblclick>{ENT_NO}</td>
<td class="cmn text-start" onclick="{onclick}" ondblclick="{ondblclick}">{ENT_FXNO}</td> <td class="cmn text-center" onclick ondblclick>{RPRSV_NM}</td>
<td class="cmn text-start" onclick="{onclick}" ondblclick="{ondblclick}">{ENT_EML_ADDR}</td> <td class="cmn text-center" onclick ondblclick>{ENT_TELNO}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{ENT_ZIP}</td> <td class="cmn text-center" onclick ondblclick>{ENT_FXNO}</td>
<td class="cmn text-start" onclick="{onclick}" ondblclick="{ondblclick}">{ENT_ADDR}</td> <td class="cmn text-start" onclick ondblclick>{ENT_EML_ADDR}</td>
<td class="cmn text-start" onclick="{onclick}" ondblclick="{ondblclick}">{ENT_DTL_ADDR}</td> <td class="cmn text-center" onclick ondblclick>{ENT_ZIP}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{REG_DT}</td> <td class="cmn text-start" onclick ondblclick>{ENT_ADDR}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{RGTR_NM}</td> <td class="cmn text-start" onclick ondblclick>{ENT_DTL_ADDR}</td>
<td class="cmn text-center" onclick ondblclick>{REG_DT}</td>
<td class="cmn text-center" onclick ondblclick>{RGTR_NM}</td>
<td class="cmn dummy-td"></td> <td class="cmn dummy-td"></td>
</tr> </tr>
</template> </template>
<template id="${infoPrefix}NotFound--${pageName}"> <template name="dataNotFound">
<tr class="odd"> <tr class="odd">
<td valign="top" colspan="15" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td> <td valign="top" colspan="17" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td>
</tr> </tr>
</template> </template>
</table> </table>
@ -133,7 +135,7 @@
/************************************************************************** /**************************************************************************
* Global Variable * Global Variable
**************************************************************************/ **************************************************************************/
pageObject["${pageName}"] = {}; pageObject["${pageName}"] = newDoctxFinder("${pageName}");
/************************************************************************** /**************************************************************************
* script 진입 * script 진입
@ -143,240 +145,250 @@
let $P = pageObject["${pageName}"]; let $P = pageObject["${pageName}"];
// FormFields // FormFields
$P.formFields = new FimsFormFields("#frmSearch--${pageName}"); $P.formFields = new FimsFormFields($P.selector("frmSearch"));
/************************************************************************** /**************************************************************************
* DatasetControl * DatasetControl
**************************************************************************/ **************************************************************************/
$P.control = new DatasetControl({ $P.ctrl = new DatasetControl({
prefix: "userRentEntMpng" prefix: "userRentEntMpng"
, prefixName: "사용자 임대기업" , prefixName: "임대기업 매핑"
, keymapper: info => info ? info.MPNG_ID : "" , keymapper: info => info ? info.MPNG_ID : ""
, dataGetter: obj => obj.${infoPrefix}List , dataGetter: obj => obj["List"]
, appendData: true , appendData: true
, infoSize: "xl" , infoSize: "xl"
, urls: {
load: wctx.url("${prefixUrl}" + "/010/list.do") // 임대기업 매핑 검색
, remove: wctx.url("${prefixUrl}" + "/010/removeMpng.do") // 임대기업 매핑 삭제
, getInfo: wctx.url("${prefixUrl}" + "/020/info.do") // 임대기업 매핑 상세 정보
}
, formats: { , formats: {
REG_DT: datetimeFormat REG_DT: datetimeFormat
} }
}); });
// $P.control 설정 // 검색 조건
$P.control.defaultFetchSize = FETCH_XS; // 1 페이지당 조회되는 자료 건수 index.jsp에서 확인 FETCH_XS = 30 $P.ctrl.query = { pageNum: 1, fetchSize: DEFAULT_FETCH_SIZE }; // 1 페이지당 자료 건수 index.jsp에서 확인
$P.control.query = { pageNum : 1, fetchSize : $P.control.defaultFetchSize };
$P.control.beforeCurrent = null;
/************************************************************************** /**************************************************************************
* DatasetControl 이벤트 * DatasetControl 이벤트
**************************************************************************/ **************************************************************************/
// Dataset 변경 이벤트 // Dataset 변경 이벤트
$P.control.onDatasetChange = (obj, option) => { $P.ctrl.onDatasetChange = (obj, option) => {
$P.renderList(obj.${infoPrefix}Total, option); $P.renderList(obj["Total"], option);
$("#paging--${pageName}").setPagingInfo({ // datasetPaging
list: $P.control.dataset Apply.fromDataset.paging($P.ctrl.dataset, obj, $P.find("dataPaging"), $P.find("dataPagingInfo"));
, prefix: "paging--${pageName}"
, start: obj.${infoPrefix}Start
, totalSize: obj.${infoPrefix}Total
, fetchSize: obj.${infoPrefix}Fetch
, func: "pageObject['${pageName}'].control.load({index})"
});
}; };
// 현재 선택 자료 변경 이벤트 // 현재 선택 자료 변경 이벤트
$P.control.onCurrentChange = (item) => { $P.ctrl.onCurrentChange = (item) => {
if (!item) return; if (!item) return;
let key = item.data.MPNG_ID; let key = item.data.MPNG_ID;
$("#tbody--${pageName}").setCurrentRow(key); $P.$find("tbodyList").setCurrentRow(key);
}; };
// 선택(체크) 변경 이벤트 // 선택(체크) 변경 이벤트
$P.control.onSelectionChange = (selected) => { $P.ctrl.onSelectionChange = (selected) => {
let ${infoPrefix}List = $P.control.dataset; Apply.fromDataset.gridCheckbox($P.ctrl.dataset, $P.find("tbodyList"), 1, selected);
let keys = selected.map(e => ${infoPrefix}List.getKey(e)); Apply.fromDataset.gridButton($P.ctrl.dataset, $P.find("btnRemove"), selected); // 삭제 버튼
$("#tbody--${pageName} input[type='checkbox']").each(function() {
let checkbox = $(this);
checkbox.prop("checked", keys.includes(checkbox.val()));
});
// 삭제 버튼
$("#btnRemove--${pageName}").prop("disabled", keys.length < 1);
// DataTables(그리드) 전체 선택(checkbox)
if (keys.length < 1) {
$("#DataTables_Table_0--${pageName} th input[type='checkbox']").prop("checked", false); // 체크 해제
} else if (keys.length == ${infoPrefix}List.length) {
$("#DataTables_Table_0--${pageName} th input[type='checkbox']").prop("checked", true); // 체크 설정
} else {
$("#DataTables_Table_0--${pageName} th input[type='checkbox']").prop("checked", false); // 체크 해제
}
}; };
// 상세정보 dialog // 상세정보 dialog
$P.control.getInfo = (mpngId) => { $P.ctrl.getInfo = (params) => {
let params = {}; if (!params) return;
if (typeof mpngId == "undefined" || mpngId == null || mpngId == "") {
params.callPurpose = "create";
} else {
params.callPurpose = "update";
params.mpngId = mpngId;
params.schEntNo = $P.control.dataset.getValue("ENT_NO");
}
ajax.get({ ajax.get({
url: $P.control.urls.getInfo + "?openerPageName=${pageName}" url: $P.ctrl.urls.getInfo
, data: params || {} , data: params || {}
, success: resp => { , success: (resp) => {
let dialogName = $P.ctrl.prefixed("Dialog");
let dialogId = dialogName + "-" + uuid();
dialog.open({ dialog.open({
id: "rentEntDialog--${pageName}" id: dialogId
, title: "임대기업 매핑" , title: $P.ctrl.prefixName + " 정보"
, size: $P.ctrl.infoSize
, content: resp , content: resp
, size: $P.control.infoSize , init: () => {
, onClose: () => { $P.fnRefreshList(); } // 자료 재조회 setDialogZindex();
$("#" + dialogId).attr("name", dialogName);
$("#" + dialogId).attr("data-ref-doctx", "${pageName}");
}
, onClose: () => {
$P.ctrl.reload({ all: true });
}
}); });
} }
}); });
} }
// 삭제 callback
$P.control.onRemove = (resp) => {
let btnTitle = $("#btnRemove--${pageName}").attr("title");
let showMessage = resp.rtnMsg.replace(/[S]|[F]/g, btnTitle);
// 메시지 출력
dialog.alert({
content: showMessage
, init: () => { setDialogZindex(); }
, onOK: () => { }
});
if (resp.saved) { $P.fnRefreshList(); } // 자료 재조회
}
// 삭제 // 삭제
$P.control.remove = (params) => { $P.ctrl.remove = (params) => {
if (!params) return; if (!params) return;
ajax.post({ ajax.post({
url: $P.control.urls.remove url: $P.ctrl.urls.remove
, data: params || {} , data: params || {}
, success: resp => $P.control.onRemove(resp) , success: (resp) => {
let showMessage = resp.rtnMsg.replace(/[S]|[F]/g, $P.ctrl.prefixName);
// 메시지 출력
dialog.alert({
content: showMessage
, init: () => { setDialogZindex(); }
, onOK: () => { }
, onClose: () => {
if (resp.saved) { $P.ctrl.reload({ all: true }); }
}
});
}
}); });
} }
/************************************************************************** /**************************************************************************
* DataTables 이벤트 * DataTable 이벤트
**************************************************************************/ **************************************************************************/
// DataTables에 click, dbclick 이벤트 // DataTable에 click, dbclick 이벤트
$P.renderList = (totalSize, option) => { $P.renderList = (totalSize, option) => {
let ${infoPrefix}List = $P.control.dataset; let dataList = $P.ctrl.dataset;
let empty = ${infoPrefix}List.empty; let empty = dataList.empty;
let trs = empty ? let trs = empty ? [$P.find("dataNotFound").innerHTML] :
[document.getElementById("${infoPrefix}NotFound--${pageName}").innerHTML] : <%-- from template#${infoPrefix}NotFound --%> dataList.inStrings($P.find("dataRow").innerHTML, (str, dataItem) => str
${infoPrefix}List.inStrings( .replace(/{onclick}/gi, "pageObject['${pageName}'].dataTableClick('" + dataItem.getValue("MPNG_ID") + "');")
document.getElementById("${infoPrefix}Row--${pageName}").innerHTML, <%-- from template#${infoPrefix}Row --%> .replace(/{ondblclick}/gi, "pageObject['${pageName}'].dataTableDblClick('" + dataItem.getValue("MPNG_ID") + "');")
(str, dataItem) => str );
.replace(/{onclick}/gi, "pageObject['${pageName}'].control.setCurrent('" + dataItem.getValue("MPNG_ID") + "');")
.replace(/{ondblclick}/gi, "pageObject['${pageName}'].control.getInfo('" + dataItem.getValue("MPNG_ID") + "');")
);
let noMore = (${infoPrefix}List.length >= totalSize); let noMore = (dataList.length >= totalSize);
let initScroll = ($P.control.query.pageNum < 2); let initScroll = ($P.ctrl.query.pageNum < 2);
if (option != null && option.reloaded) { if (option != null && option.reloaded) {
initScroll = false; initScroll = false;
} }
$("#table-responsive--${pageName}")[0].changeContent(trs.join(), initScroll, noMore); $P.find("table-responsive").changeContent(trs.join(), initScroll, noMore);
// checkbox 체크 해제 // checkbox 체크 해제
$("#DataTables_Table_0--${pageName} th input[type='checkbox']").prop("checked", false); $P.$find("gridAllCheckbox").prop("checked", false);
//보안모드 //보안모드
fn_securityModeToggle($("#securityMode--top").is(":checked")); fn_securityModeToggle($("#securityMode--top").is(":checked"));
} }
// dataTable 체크박스 클릭 이벤트
$P.dataTableCheckbox = (element, bool) => {
GRID.checkbox.sync(element, bool);
let atLeastOne = GRID.checkbox.countChecked(element) > 0;
$P.$find("btnRemove").prop("disabled", !atLeastOne);
Apply.toDataset.selection($P.ctrl.dataset, element, bool);
}
// dataTable 클릭 이벤트
$P.dataTableClick = (dataKey) => {
if (dataKey == "") return;
$P.$find("tbodyList").setCurrentRow(dataKey);
Apply.toDataset.current($P.ctrl.dataset, dataKey);
}
// dataTable 더블 클릭 이벤트
$P.dataTableDblClick = (dataKey) => {
let params = {
callPurpose: "update"
, mpngId: dataKey
, userId: $P.$find("userId").val()
, schEntNo: $P.ctrl.getValue("ENT_NO")
};
$P.ctrl.getInfo(params);
}
// DataTables에 스크롤이 맨 밑으로 이동했을 때 이벤트 // DataTables에 스크롤이 맨 밑으로 이동했을 때 이벤트
$P.scrollDataList = () => { $P.scrollDataList = () => {
$P.control.load($P.control.query.pageNum + 1); $P.ctrl.load($P.ctrl.query.pageNum + 1);
} }
/************************************************************************** /**************************************************************************
* 사용자 함수(function) * 사용자 함수(function)
**************************************************************************/ **************************************************************************/
// 검색 자료 재조회
$P.fnRefreshList = () => {
$P.control.reload({all : true});
}
/************************************************************************** /**************************************************************************
* 버튼 clickEvent * 버튼 clickEvent
**************************************************************************/ **************************************************************************/
// 업무 구분 변경 이벤트 // 업무 구분 변경 이벤트
$P.fnResetAndChangeBiz = () => { $P.fnReset = () => {
// 초기 기본 설정 // 화면 초기화
$P.initForm(); $P.find("frmSearch").reset();
// 업무 구분별 설정
$P.setTask();
// dataset 초기화 // dataset 초기화
$P.control.dataset.clear(); $P.ctrl.dataset.clear();
// 기본 데이터 설정
$P.$find("userId").val("${userId}"); // 사용자 ID
$P.$find("schUserAcnt").val("${userAcnt}"); // 사용자 계정
} }
// 검색 버튼 이벤트 // 검색 버튼 이벤트
$P.fnSearchList = () => { $P.fnSearchList = () => {
// 검색조건 // 검색조건
$P.control.query = $P.formFields.get(); // 검색 조건 $P.ctrl.query = $P.formFields.get(); // 검색 조건
$P.control.query.fetchSize = $P.control.defaultFetchSize; // 한번에 조회되는 자료 건수 $P.ctrl.query.fetchSize = DEFAULT_FETCH_SIZE; // 한번에 조회되는 자료 건수
$P.control.query.delYn = "N"; // 삭제 여부 $P.ctrl.query.delYn = "N"; // 삭제 여부
$P.control.load(1); $P.ctrl.load(1);
} }
// 엑셀 버튼 이벤트 // 엑셀 버튼 이벤트
$P.fnExcel = () => { $P.fnExcel = () => {
if ($P.control.dataset.empty) { if ($P.ctrl.dataset.empty) {
dialog.alert({ dialog.alert({
content: "검색된 자료가 없습니다." content: "검색된 자료가 없습니다."
, init: () => { setDialogZindex(); }
, onOK: () => { } , onOK: () => { }
}); });
return; return;
} }
// DataTables(그리드) // DataTables(그리드)
let cellDefs = getCellDefs($("#theadTr--${pageName} th").not(".dummy-th").not(":eq(0)") $P.ctrl.query.cellDefs =
, $($("#${infoPrefix}Row--${pageName}")[0].content).find("td").not(".dummy-td").not(":eq(0)") getCellDefs($P.$find("theadTr").find("th").not(".dummy-th").not(":eq(0)")
, getCellDefsForPrivacyCell); , $($P.find("dataRow").content).find("td").not(".dummy-td").not(":eq(0)"));
$P.control.query.cellDefs = cellDefs;
$P.control.download(); $P.ctrl.download();
} }
// 임대기업 매핑 등록 버튼 이벤트 // 임대기업 매핑 등록 버튼 이벤트
$P.fnCreate = (title) => { $P.fnCreate = () => {
$P.control.getInfo(); let params = {
callPurpose: "create"
, userId: $P.$find("userId").val()
, schEntNo: ""
};
$P.ctrl.getInfo(params);
} }
// 임대기업 매핑 삭제 버튼 이벤트 // 임대기업 매핑 삭제 버튼 이벤트
$P.fnRemove = (title) => { $P.fnRemove = () => {
let selected = $P.control.dataset.getKeys("selected"); let selected = $P.ctrl.dataset.getKeys("selected");
if (selected.length < 1) return; if (selected.length < 1) return;
let params = {};
params.sggCd = $("#sggCd--${pageName}").val(); // 시군구 코드
params.taskSeCd = $("#frmSearch--${pageName} input[name='taskSeCd']:checked").val(); // 업무 구분 코드
params.mpngIds = selected.join(",");
dialog.alert({ dialog.alert({
content: "선택한 " + $P.control.prefixName + " 정보를 삭제하시겠습니까?" content: "선택한 " + $P.ctrl.prefixName + " 정보를 삭제하시겠습니까?"
, onOK: () => { , onOK: () => {
$P.control.remove(params); let params = {
callPurpose: "create"
, mpngIds: selected.join(",")
}
$P.ctrl.remove(params);
} }
}); });
} }
@ -387,62 +399,19 @@
// 이벤트 설정 // 이벤트 설정
$P.setEvent = () => { $P.setEvent = () => {
// 기본 버튼 이벤트 // 기본 버튼 이벤트
$("#btnReset--${pageName}").on("click", () => $P.fnResetAndChangeBiz()); // 초기화 $P.$find("btnReset").on("click", () => { $P.fnReset() }); // 초기화
$("#btnSearch--${pageName}").on("click", () => $P.fnSearchList()); // 검색 $P.$find("btnSearch").on("click", () => { $P.fnSearchList() }); // 검색
$("#btnExcel--${pageName}").on("click", () => $P.fnExcel()); // 엑셀 $P.$find("btnExcel").on("click", () => { $P.fnExcel() }); // 엑셀
// form-date 항목에서 키보드로 입력시 날짜 포맷팅 적용
$("#frmSearch--${pageName}").find(".form-date").each(function() {
$(this).on("input", function() {
let value = this.value.replaceAll("-", "");
if (value.length > 7) {
this.value = value.substring(0, 4) + "-" + value.substring(4, 6) + "-" + value.substring(6);
} else if(value.length > 5) {
this.value = value.substring(0, 4) + "-" + value.substring(4);
}
});
});
// 버튼 이벤트 // 업무 버튼 이벤트
$("#btnCreate--${pageName}").on("click", function() { $P.$find("btnCreate").on("click", () => { $P.fnCreate(); }); // 등록
$P.fnCreate($(this).attr("title")); // 등록 $P.$find("btnRemove").on("click", () => { $P.fnRemove(); }); // 삭제
});
$("#btnRemove--${pageName}").on("click", function() {
$P.fnRemove($(this).attr("title")); // 삭제
});
// DataTables width 변경 조정 업무별 그리드가 존재 한다면.. crdn06010-main.jsp 참고 // DataTables width 변경 조정
fnMakeResizableTable($("#table-responsive--${pageName}")[0]); fnMakeResizableTable($P.find("table-responsive"));
// DataTables 스크롤 이벤트 생성 // DataTables 스크롤 이벤트 생성
fnMakeScrollableTable($("#table-responsive--${pageName}")[0], $P.scrollDataList); fnMakeScrollableTable($P.find("table-responsive"), $P.scrollDataList);
}
// 초기 화면 설정
$P.initForm = () => {
// 화면 초기화
$("#frmSearch--${pageName}")[0].reset();
// input, select 초기화
let searchForm = $("#frmSearch--${pageName}");
searchForm.find("input[type='checkbox']").prop("checked", false);
searchForm.find("input[type='text']").val("");
searchForm.find("input[type='hidden']").val("");
searchForm.find("select").each(function() { $(this).find("option:eq(0)").prop("selected", true); });
// 기본 데이터 설정
$("#sggCd--${pageName}").val("${sggCd}"); // 시군구 코드
$("#userId--${pageName}").val("${userId}"); // 사용자 ID
$("#schUserAcnt--${pageName}").val("${userAcnt}"); // 사용자 계정
}
// 업무 구분별 설정
$P.setTask = () => {
// 업무구분에 따른 URL 설정
$P.control.urls.load = wctx.url("${infoPrefixUrl}" + "/010/list.do"); // 검색
$P.control.urls.getInfo = wctx.url("${infoPrefixUrl}" + "/020/info.do"); // 상세 조회
$P.control.urls.remove = wctx.url("${infoPrefixUrl}" + "/010/removeMpng.do"); // 삭제
} }
/************************************************************************** /**************************************************************************
@ -451,8 +420,8 @@
// 1. 이벤트 설정 // 1. 이벤트 설정
$P.setEvent(); $P.setEvent();
// 2. 초기 설정 및 업무 구분 변경 // 2. 초기 설정
$P.fnResetAndChangeBiz(); $P.fnReset();
// 3. 보안모드 // 3. 보안모드
fn_securityModeToggle($("#securityMode--top").is(":checked")); fn_securityModeToggle($("#securityMode--top").is(":checked"));

@ -4,17 +4,20 @@
<c:set var="prefixName" scope="request">임대기업 매핑 정보</c:set> <c:set var="prefixName" scope="request">임대기업 매핑 정보</c:set>
<!-- inner page html --> <!-- inner page html -->
<div class="content-pop"> <div class="content-pop" data-doctx="${pageName}">
<!-- Content --> <!-- Content -->
<div class="container flex-grow-1 px-0"> <div class="container flex-grow-1 px-0">
<div class="card"> <div class="card">
<!-- 상단 버튼 --> <!-- 상단 버튼 -->
<div class="container-page-btn"> <div class="container-page-btn">
<button type="button" class="btn btn-outline-dark w-px-120" name="btnReset" title="초기화">
초기화
</button>
<span class="container-window-btn-right"> <span class="container-window-btn-right">
<button type="button" class="btn btn-search w-px-120" id="btnSearch--${pageName}" title="검색"> <button type="button" class="btn btn-search w-px-120" name="btnSearch" title="검색">
검색 검색
</button> </button>
<button type="button" class="btn btn-primary w-px-120" id="btnOK--${pageName}" title="임대기업 선택 확인"> <button type="button" class="btn btn-primary w-px-120" name="btnOK" title="임대기업 선택 확인">
선택 확인 선택 확인
</button> </button>
</span> </span>
@ -22,26 +25,25 @@
<!-- 상단 버튼 --> <!-- 상단 버튼 -->
<!-- 검색 조건 영역 --> <!-- 검색 조건 영역 -->
<form id="frmSearch--${pageName}" name="frmSearch"> <form name="frmSearch">
<!-- hidden --> <!-- hidden -->
<input type="hidden" id="userId--${pageName}" name="userId" /> <input type="hidden" name="userId" />
<!-- 메인 조건 --> <!-- 메인 조건 -->
<div class="container-search"> <div class="container-search">
<div class="row g-1"> <div class="row g-1">
<!-- 기업 번호 --> <!-- 기업 번호 -->
<div class="col-6"> <div class="col-6">
<label class="form-label fw-bold form-search-title w-px-120 text-end" for="schEntNo--${pageName}">법인(사업자)번호</label> <label is="name-label" class="form-label fw-bold form-search-title w-px-120 text-end" for="schEntNo">법인(사업자)번호</label>
<input type="text" class="form-control w-px-160" id="schEntNo--${pageName}" name="schEntNo" autocomplete="off" /> <input is="id-input" type="text" class="form-control w-px-160" name="schEntNo" autocomplete="off" />
</div> </div>
<!-- 기업 명 --> <!-- 기업 명 -->
<div class="col-6"> <div class="col-6">
<label class="form-label fw-bold form-search-title w-px-120 text-end" for="schEntNm--${pageName}">기업명</label> <label is="name-label" class="form-label fw-bold form-search-title w-px-120 text-end" for="schEntNm">기업명</label>
<input type="text" class="form-control w-px-200" id="schEntNm--${pageName}" name="schEntNm" autocomplete="off" /> <input is="id-input" type="text" class="form-control w-px-200" name="schEntNm" autocomplete="off" />
</div> </div>
</div> </div>
</div> </div> <!-- 메인 조건 -->
<!-- 메인 조건 -->
</form> </form>
<!-- 검색 조건 영역 --> <!-- 검색 조건 영역 -->
@ -50,12 +52,21 @@
<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">
<span class="dataTables_info" id="paging--${pageName}PagingInfo" role="status" aria-live="polite"></span> <span is="paging-info" class="dataTables_info" name="dataPagingInfo" role="status" aria-live="polite"></span>
<ul class="pagination pagination-primary" id="paging--${pageName}"> <ul class="pagination pagination-primary" name="dataPaging">
</ul> </ul>
</div> </div>
<!-- 업무 버튼 --> <!-- 업무 버튼 -->
<span class="container-window-btn-right"> <span class="container-window-btn-right">
<button type="button" class="btn btn-primary w-px-120" name="btnCreate" title="임대기업 등록">
기업 등록
</button>
<button type="button" class="btn btn-primary w-px-120" name="btnUpdate" title="임대기업 수정">
기업 수정
</button>
<button type="button" class="btn btn-primary w-px-120" name="btnRemove" title="임대기업 삭제">
기업 삭제
</button>
</span> </span>
</span> </span>
</div> </div>
@ -63,124 +74,51 @@
<!-- DataTables(그리드) --> <!-- DataTables(그리드) -->
<div class="card-datatable text-nowrap"> <div class="card-datatable text-nowrap">
<div class="dataTables_wrapper dt-bootstrap5 no-footer" id="DataTables_Table_0_wrapper--${pageName}"> <div class="dataTables_wrapper dt-bootstrap5 no-footer">
<div class="table-responsive ox-scroll oy-scroll h-px-300" id="table-responsive--${pageName}"> <div class="table-responsive ox-scroll oy-scroll h-px-300" name="table-responsive">
<table class="table-layout-fixed dataTable datatables-ajax table table-bordered no-footer" id="DataTables_Table_0--${pageName}" aria-describedby="DataTables_Table_0_info"> <table class="table-layout-fixed dataTable datatables-ajax table table-bordered no-footer" name="DataTables_Table_0" aria-describedby="DataTables_Table_0_info">
<thead class="sticky-thead"> <thead class="sticky-thead">
<tr id="theadTr--${pageName}" <tr name="theadTr" data-search-target="[data-doctx='${pageName}']">
data-by="by--${pageName}" data-by-output="byOutput--${pageName}" data-main-option="mainOption--${pageName}" data-sub-option="subOption--${pageName}">
<th class="cmn" style="width: 72px;">No.</th> <th class="cmn" style="width: 72px;">No.</th>
<th class="cmn" style="width: 56px;"><input type="checkbox" class="form-check-input" name="gridAllCheckbox" onchange="pageObject['${pageName}'].dataTableCheckbox(this, this.checked);" /></th>
<th class="cmn" style="width: 200px;">기업명</th> <th class="cmn" style="width: 200px;">기업명</th>
<th class="cmn" style="width: 160px;">법인(사업자)번호</th> <th class="cmn" style="width: 160px;">법인(사업자)번호</th>
<th class="cmn" style="width: 120px;">대표자명</th> <th class="cmn" style="width: 120px;">대표자명</th>
<th class="cmn" style="width: 160px;">전화번호</th>
<th class="cmn" style="width: 160px;">팩스번호</th>
<th class="cmn" style="width: 100px;">우편번호</th> <th class="cmn" style="width: 100px;">우편번호</th>
<th class="cmn" style="width: 280px;">주소</th> <th class="cmn" style="width: 280px;">주소</th>
<th class="cmn" style="width: 180px;">등록일시</th> <th class="cmn" style="width: 180px;">등록일시</th>
<th class="cmn dummy-th"></th> <th class="cmn dummy-th"></th>
</tr> </tr>
</thead> </thead>
<tbody id="tbody--${pageName}"> <tbody name="tbodyList">
</tbody> </tbody>
<template id="${infoPrefix}Row--${pageName}"> <template is="curly-brackets" name="dataRow">
<tr data-key="{ENT_ID}"> <tr data-key="ENT_ID">
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{ROW_NUM}</td> <td class="cmn text-center" onclick ondblclick>{ROW_NUM}</td>
<td class="cmn text-start" onclick="{onclick}" ondblclick="{ondblclick}">{ENT_NM}</td> <td class="cmn text-center"><input type="checkbox" class="form-check-input" name="gridCheckbox" value="ENT_ID" onchange="pageObject['${pageName}'].dataTableCheckbox(this, this.checked);" /></td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{ENT_NO}</td> <td class="cmn text-start" onclick ondblclick>{ENT_NM}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{RPRSV_NM}</td> <td class="cmn text-center" onclick ondblclick>{ENT_NO}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{ENT_ZIP}</td> <td class="cmn text-center" onclick ondblclick>{RPRSV_NM}</td>
<td class="cmn text-start" onclick="{onclick}" ondblclick="{ondblclick}">{ENT_ADDR}</td> <td class="cmn text-center" onclick ondblclick>{ENT_TELNO}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{REG_DT}</td> <td class="cmn text-center" onclick ondblclick>{ENT_FXNO}</td>
<td class="cmn text-center" onclick ondblclick>{ENT_ZIP}</td>
<td class="cmn text-start" onclick ondblclick>{ENT_ADDR}</td>
<td class="cmn text-center" onclick ondblclick>{REG_DT}</td>
<td class="cmn dummy-td"></td> <td class="cmn dummy-td"></td>
</tr> </tr>
</template> </template>
<template id="${infoPrefix}NotFound--${pageName}"> <template name="dataNotFound">
<tr class="odd"> <tr class="odd">
<td valign="top" colspan="8" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td> <td valign="top" colspan="11" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td>
</tr> </tr>
</template> </template>
</table> </table>
</div> </div>
</div> </div>
</div> <!-- DataTables(그리드) --> </div>
<!-- DataTables(그리드) -->
<!-- 입력 영역 -->
<form id="frmEdit--${pageName}" name="frmEdit">
<!-- 업무 버튼 -->
<div class="container-page-btn">
<button type="button" class="btn btn-outline-dark w-px-120" id="btnReset--${pageName}" title="초기화">
초기화
</button>
<!-- 버튼 우측 정렬 -->
<span class="container-window-btn-right">
<button type="button" class="btn btn-primary w-px-120" id="btnCreate--${pageName}" title="임대기업 등록">
등록
</button>
<button type="button" class="btn btn-primary w-px-120" id="btnUpdate--${pageName}" title="임대기업 수정">
수정
</button>
<button type="button" class="btn btn-primary w-px-120" id="btnRemove--${pageName}" title="임대기업 삭제">
삭제
</button>
</span>
</div> <!-- <div class="container-page-btn"> -->
<div class="row g-1">
<!-- 기업 구분 코드 -->
<div class="col-md-6">
<label class="w-px-120 bg-lighter pe-2 col-form-label text-sm-end required" for="entSeCd--${pageName}">기업구분</label>
<select class="form-select" id="entSeCd--${pageName}" name="entSeCd" data-map="ENT_SE_CD" required>
<option value="">선택하세요</option>
<c:forEach items="${FIM088List}" var="item">
<option value="${item.code}">${item.value}</option>
</c:forEach>
</select>
</div>
<!-- 기업 번호 -->
<div class="col-md-6">
<label class="w-px-120 bg-lighter pe-2 col-form-label text-sm-end required" for="entNo--${pageName}">법인(사업자)번호</label>
<input type="text" class="form-control w-30" id="entNo--${pageName}" name="entNo" data-map="ENT_NO" autocomplete="off" />
</div>
<!-- 기업 명 -->
<div class="col-md-6">
<label class="w-px-120 bg-lighter pe-2 col-form-label text-sm-end required" for="entNm--${pageName}">기업명</label>
<input type="text" class="form-control w-40" id="entNm--${pageName}" name="entNm" data-map="ENT_NM" autocomplete="off" />
</div>
<!-- 대표자 명 -->
<div class="col-md-6">
<label class="w-px-120 bg-lighter pe-2 col-form-label text-sm-end" for="rprsvNm--${pageName}">대표자명</label>
<input type="text" class="form-control w-30" id="rprsvNm--${pageName}" name="rprsvNm" data-map="RPRSV_NM" autocomplete="off" />
</div>
<!-- 기업 전화번호 -->
<div class="col-md-6">
<label class="w-px-120 bg-lighter pe-2 col-form-label text-sm-end" for="entTelno--${pageName}">전화번호</label>
<input type="text" class="form-control w-30" id="entTelno--${pageName}" name="entTelno" data-map="ENT_TELNO" autocomplete="off" />
</div>
<!-- 기업 팩스번호 -->
<div class="col-md-6">
<label class="w-px-120 bg-lighter pe-2 col-form-label text-sm-end" for="entFxno--${pageName}">팩스번호</label>
<input type="text" class="form-control w-30" id="entFxno--${pageName}" name="entFxno" data-map="ENT_FXNO" autocomplete="off" />
</div>
<!-- 기업 이메일 -->
<div class="col-md-12">
<label class="w-px-120 bg-lighter pe-2 col-form-label text-sm-end" for="entEmlAddr--${pageName}">이메일</label>
<input type="text" class="form-control w-30" id="entEmlAddr--${pageName}" name="entEmlAddr" data-map="ENT_EML_ADDR" />
</div>
<!-- 주소 --><!-- 우편번호 -->
<div class="col-md-12">
<label class="w-px-120 bg-lighter pe-2 col-form-label text-sm-end" for="entAddr--${pageName}">주소</label>
<input type="text" class="form-control w-70" id="entAddr--${pageName}" name="entAddr" data-map="ENT_ADDR" autocomplete="off" />
<input type="text" class="form-control w-px-100" id="entZip--${pageName}" name="entZip" data-map="ENT_ZIP" autocomplete="off" />
<button type="button" class="btn btn-sm btn-outline-dark" id="btnZipCode--${pageName}" title="우편번호검색">
검색
</button>
</div>
<!-- 상세주소 -->
<div class="col-md-12">
<label class="w-px-120 bg-lighter pe-2 col-form-label text-sm-end" for="entDtlAddr--${pageName}">상세주소</label>
<input type="text" class="form-control w-85" id="entDtlAddr--${pageName}" name="entDtlAddr" data-map="ENT_DTL_ADDR" autocomplete="off" />
</div>
</div>
</form>
</div> <!-- <div class="card"> --> </div> <!-- <div class="card"> -->
</div> <!-- <div class="container flex-grow-1 px-0"> --> </div> <!-- <div class="container flex-grow-1 px-0"> -->
<!-- Content --> <!-- Content -->
@ -191,7 +129,7 @@
/************************************************************************** /**************************************************************************
* Global Variable * Global Variable
**************************************************************************/ **************************************************************************/
pageObject["${pageName}"] = {}; pageObject["${pageName}"] = newDoctxFinder("${pageName}");
/************************************************************************** /**************************************************************************
* script 진입 * script 진입
@ -201,318 +139,317 @@
let $P = pageObject["${pageName}"]; let $P = pageObject["${pageName}"];
// FormFields // FormFields
$P.formSearchFields = new FimsFormFields("#frmSearch--${pageName}"); $P.formFields = new FimsFormFields($P.selector("frmSearch"));
$P.formEditFields = new FimsFormFields("#frmEdit--${pageName}");
/************************************************************************** /**************************************************************************
* DatasetControl * DatasetControl
**************************************************************************/ **************************************************************************/
$P.control = new DatasetControl({ $P.ctrl = new DatasetControl({
prefix: "rentEnt" prefix: "rentEnt"
, prefixName: "임대기업 매핑" , prefixName: "임대 기업"
, keymapper: info => info ? info.ENT_ID : "" , keymapper: info => info ? info.ENT_ID : ""
, dataGetter: obj => obj.${infoPrefix}List , dataGetter: obj => obj["List"]
, appendData: true , appendData: true
, infoSize: "lg"
, urls: {
create: wctx.url("${prefixUrl}" + "/020/createMpng.do") // 매핑 등록
, load: wctx.url("${prefixUrl}" + "/020/list.do") // 임대기업 검색
, remove: wctx.url("${prefixUrl}" + "/020/remove.do") // 임대기업 삭제
, getInfo: wctx.url("${prefixUrl}" + "/030/info.do") // 임대기업 상세 정보
}
, formats: { , formats: {
REG_DT: datetimeFormat REG_DT: datetimeFormat
} }
}); });
// $P.control 설정 // 검색 조건
$P.control.defaultFetchSize = FETCH_XS; // 1 페이지당 조회되는 자료 건수 index.jsp에서 확인 FETCH_XS = 30 $P.ctrl.query = { pageNum: 1, fetchSize: DEFAULT_FETCH_SIZE }; // 1 페이지당 자료 건수 index.jsp에서 확인
$P.control.query = { pageNum : 1, fetchSize : $P.control.defaultFetchSize };
$P.control.beforeCurrent = null;
/************************************************************************** /**************************************************************************
* DatasetControl 이벤트 * DatasetControl 이벤트
**************************************************************************/ **************************************************************************/
// Dataset 변경 이벤트 // Dataset 변경 이벤트
$P.control.onDatasetChange = (obj, option) => { $P.ctrl.onDatasetChange = (obj, option) => {
$P.renderList(obj.${infoPrefix}Total, option); $P.renderList(obj["Total"], option);
$("#paging--${pageName}").setPagingInfo({ // datasetPaging
list: $P.control.dataset Apply.fromDataset.paging($P.ctrl.dataset, obj, $P.find("dataPaging"), $P.find("dataPagingInfo"));
, prefix: "paging--${pageName}"
, start: obj.${infoPrefix}Start
, totalSize: obj.${infoPrefix}Total
, fetchSize: obj.${infoPrefix}Fetch
, func: "pageObject['${pageName}'].control.load({index})"
});
}; };
// 현재 선택 자료 변경 이벤트 // 현재 선택 자료 변경 이벤트
$P.control.onCurrentChange = (item) => { $P.ctrl.onCurrentChange = (item) => {
if (!item) return; if (!item) return;
$P.formEditFields.set($P.control, item); // 화면에 자료 셋팅
let key = item.data.ENT_ID; let key = item.data.ENT_ID;
$("#tbody--${pageName}").setCurrentRow(key); $P.$find("tbodyList").setCurrentRow(key);
}; };
// 저장 callback // 선택(체크) 변경 이벤트
$P.control.onSave = (resp) => { $P.ctrl.onSelectionChange = (selected) => {
let dialogTitle = $("#" + $P.control.prefix + "Dialog--${openerPageName}").find("h5.modal-title").html(); Apply.fromDataset.gridCheckbox($P.ctrl.dataset, $P.find("tbodyList"), 1, selected);
let showMessage = resp.rtnMsg.replace(/[S]|[F]/g, dialogTitle); Apply.fromDataset.gridButton($P.ctrl.dataset, $P.find("btnOK"), selected); // 선택 확인 버튼
Apply.fromDataset.gridButton($P.ctrl.dataset, $P.find("btnRemove"), selected); // 삭제 버튼
// 메시지 출력 };
dialog.alert({
content: showMessage
, init: () => { setDialogZindex(); }
, onOK: () => { }
});
if (resp.saved) { $P.fnRefreshList(); } // 자료 재조회
}
// 저장
$P.control.save = (info) => {
if (!info) return;
let create = (info.callPurpose == "create"); // 사용자 임대기업 매핑 저장
$P.ctrl.save = (params) => {
if (!params) return;
ajax.post({ ajax.post({
url: !create ? $P.control.urls.update : $P.control.urls.create url: $P.ctrl.urls.create
, data: info || {} , data: params || {}
, success: resp => $P.control.onSave(resp) , success: (resp) => {
let dialogTitle = $("#" + $P.selfDlgId()).find("h5.modal-title").html();
let showMessage = resp.rtnMsg.replace(/[S]|[F]/g, dialogTitle);
// 메시지 출력
dialog.alert({
content: showMessage
, init: () => { setDialogZindex(); }
, onOK: () => { }
, onClose: () => {
if (resp.saved) { dialog.close($P.selfDlgId()); }
}
});
}
}); });
} }
// 삭제 callback // 임대기업 상세정보 dialog
$P.control.onRemove = (resp) => { $P.ctrl.getInfo = (params) => {
let btnTitle = $("#btnRemove--${pageName}").attr("title"); if (!params) return;
let showMessage = resp.rtnMsg.replace(/[S]|[F]/g, btnTitle);
// 메시지 출력 ajax.get({
dialog.alert({ url: $P.ctrl.urls.getInfo
content: showMessage , data: params || {}
, init: () => { setDialogZindex(); } , success: (resp) => {
, onOK: () => { } let dialogName = $P.ctrl.prefixed("Dialog");
let dialogId = dialogName + "-" + uuid();
dialog.open({
id: dialogId
, title: $P.ctrl.prefixName + " 정보"
, size: $P.ctrl.infoSize
, content: resp
, init: () => {
setDialogZindex();
$("#" + dialogId).attr("name", dialogName);
$("#" + dialogId).attr("data-ref-doctx", "${pageName}");
}
, onClose: () => {
$P.ctrl.reload({ all: true });
}
});
}
}); });
if (resp.saved) { $P.fnRefreshList(); } // 자료 재조회
} }
// 삭제 // 삭제
$P.control.remove = (params) => { $P.ctrl.remove = (params) => {
if (!params) return; if (!params) return;
ajax.post({ ajax.post({
url: $P.control.urls.remove url: $P.ctrl.urls.remove
, data: params || {} , data: params || {}
, success: resp => $P.control.onRemove(resp) , success: (resp) => {
let showMessage = resp.rtnMsg.replace(/[S]|[F]/g, $P.ctrl.prefixName);
// 메시지 출력
dialog.alert({
content: showMessage
, init: () => { setDialogZindex(); }
, onOK: () => { }
, onClose: () => {
if (resp.saved) { $P.ctrl.reload({ all: true }); }
}
});
}
}); });
} }
/************************************************************************** /**************************************************************************
* DataTables 이벤트 * DataTable 이벤트
**************************************************************************/ **************************************************************************/
// DataTables에 click, dbclick 이벤트 // DataTable에 click, dbclick 이벤트
$P.renderList = (totalSize, option) => { $P.renderList = (totalSize, option) => {
let ${infoPrefix}List = $P.control.dataset; let dataList = $P.ctrl.dataset;
let empty = ${infoPrefix}List.empty; let empty = dataList.empty;
let trs = empty ? let trs = empty ? [$P.find("dataNotFound").innerHTML] :
[document.getElementById("${infoPrefix}NotFound--${pageName}").innerHTML] : <%-- from template#${infoPrefix}NotFound --%> dataList.inStrings($P.find("dataRow").innerHTML, (str, dataItem) => str
${infoPrefix}List.inStrings( .replace(/{onclick}/gi, "pageObject['${pageName}'].dataTableClick('" + dataItem.getValue("ENT_ID") + "');")
document.getElementById("${infoPrefix}Row--${pageName}").innerHTML, <%-- from template#${infoPrefix}Row --%> .replace(/{ondblclick}/gi, "pageObject['${pageName}'].dataTableDblClick('" + dataItem.getValue("ENT_ID") + "');")
(str, dataItem) => str );
.replace(/{onclick}/gi, "pageObject['${pageName}'].control.setCurrent('" + dataItem.getValue("ENT_ID") + "');")
.replace(/{ondblclick}/gi, "pageObject['${pageName}'].fnOK('" + dataItem.getValue("ENT_ID") + "');") let noMore = (dataList.length >= totalSize);
); let initScroll = ($P.ctrl.query.pageNum < 2);
let noMore = (${infoPrefix}List.length >= totalSize);
let initScroll = ($P.control.query.pageNum < 2);
if (option != null && option.reloaded) { if (option != null && option.reloaded) {
initScroll = false; initScroll = false;
} }
$("#table-responsive--${pageName}")[0].changeContent(trs.join(), initScroll, noMore); $P.find("table-responsive").changeContent(trs.join(), initScroll, noMore);
// checkbox 체크 해제
$P.$find("gridAllCheckbox").prop("checked", false);
//보안모드 //보안모드
fn_securityModeToggle($("#securityMode--top").is(":checked")); fn_securityModeToggle($("#securityMode--top").is(":checked"));
} }
// DataTables에 스크롤이 맨 밑으로 이동했을 때 이벤트 // dataTable 체크박스 클릭 이벤트
$P.scrollDataList = () => { $P.dataTableCheckbox = (element, bool) => {
$P.control.load($P.control.query.pageNum + 1); GRID.checkbox.sync(element, bool);
}
/************************************************************************** let atLeastOne = GRID.checkbox.countChecked(element) > 0;
* 사용자 함수(function) $P.$find("btnOK").prop("disabled", !atLeastOne);
**************************************************************************/ $P.$find("btnRemove").prop("disabled", !atLeastOne);
// 검색 자료 재조회
$P.fnRefreshList = () => {
$P.control.reload({all : true});
}
// 우편번호 검색 결과 Apply.toDataset.selection($P.ctrl.dataset, element, bool);
$P.callbackSearchAddr = (obj) => {
$("#entAddr--${pageName}").val(obj.ADDR); // 주소
$("#entZip--${pageName}").val(obj.ZIP); // 우편번호
$("#entDtlAddr--${pageName}").val(obj.DTL_ADDR); // 상세 주소
} }
// 저장 // dataTable 클릭 이벤트
$P.saveMpng = (params) => { $P.dataTableClick = (dataKey) => {
if (!params) return; if (dataKey == "") return;
ajax.post({ $P.$find("tbodyList").setCurrentRow(dataKey);
url: wctx.url("${infoPrefixUrl}" + "/020/createMpng.do")
, data: params || {}
, success: resp => {
let dialogTitle = $("#" + $P.control.prefix + "Dialog--${openerPageName}").find("h5.modal-title").html();
let showMessage = resp.rtnMsg.replace(/[S]|[F]/g, dialogTitle);
// 메시지 출력 Apply.toDataset.current($P.ctrl.dataset, dataKey);
dialog.alert({ }
content: showMessage
, init: () => { setDialogZindex(); }
, onOK: () => { }
});
if (resp.saved) { // dataTable 더블 클릭 이벤트
dialog.close($P.control.prefix + "Dialog--${openerPageName}"); $P.dataTableDblClick = (dataKey) => {
} let params = {
} callPurpose: "update"
}); , entId: dataKey
};
$P.ctrl.getInfo(params);
}
// DataTable에 스크롤이 맨 밑으로 이동했을 때 이벤트
$P.scrollDataList = () => {
$P.ctrl.load($P.ctrl.query.pageNum + 1);
} }
/**************************************************************************
* 사용자 함수(function)
**************************************************************************/
/************************************************************************** /**************************************************************************
* 버튼 clickEvent * 버튼 clickEvent
**************************************************************************/ **************************************************************************/
// 업무 구분 변경 이벤트 // 업무 구분 변경 이벤트
$P.fnResetAndChangeBiz = (taskSeCd) => { $P.fnReset = (initSearchYN) => {
// 초기 기본 설정 // 화면 초기화
$P.initForm(); $P.find("frmSearch").reset();
// 업무 구분별 설정
$P.setTask();
// dataset 초기화 // dataset 초기화
$P.control.dataset.clear(); $P.ctrl.dataset.clear();
// 기본 데이터 설정
$P.$find("userId").val("${userId}"); // 사용자 ID
$P.$find("schEntNo").val("${schEntNo}"); // 기업 번호
let schEntNo = $("#schEntNo--${pageName}").val(); if (initSearchYN && $("#schEntNo--${pageName}").val() != "") {
if (schEntNo != "") { $P.fnSearchList();
$P.fnSearchList();
} }
} }
// 검색 버튼 클릭 이벤트 // 검색 버튼 클릭 이벤트
$P.fnSearchList = () => { $P.fnSearchList = () => {
// 검색조건 // 검색조건
$P.control.query = $P.formSearchFields.get(); // 검색 조건 $P.ctrl.query = $P.formFields.get(); // 검색 조건
$P.control.query.fetchSize = $P.control.defaultFetchSize; // 한번에 조회되는 자료 건수 $P.ctrl.query.fetchSize = DEFAULT_FETCH_SIZE; // 한번에 조회되는 자료 건수
$P.control.query.delYn = "N"; // 삭제 여부 $P.ctrl.query.delYn = "N"; // 삭제 여부
$P.control.load(1); $P.ctrl.load(1);
}
// 엑셀 버튼 이벤트
$P.fnExcel = () => {
if ($P.ctrl.dataset.empty) {
dialog.alert({
content: "검색된 자료가 없습니다."
, onOK: () => { }
});
return;
}
// DataTable(그리드)
$P.ctrl.query.cellDefs =
getCellDefs($P.$find("theadTr").find("th").not(".dummy-th").not(":eq(0)")
, $($P.find("dataRow").content).find("td").not(".dummy-td").not(":eq(0)"));
$P.ctrl.download();
} }
// 확인 // 확인
$P.fnOK = () => { $P.fnOK = () => {
// 기업 ID let selected = $P.ctrl.dataset.getKeys("selected");
entId = $P.control.dataset.getValue("ENT_ID");
if (typeof entId == "undefined" || entId == null || entId == "") { if (selected.length < 1) {
dialog.alert({ dialog.alert({
content: "선택하신 " + $P.control.prefixName + " 정보가 없습니다." content: "선택하신 " + $P.ctrl.prefixName + " 정보가 없습니다."
, init: () => { setDialogZindex(); }
, onOK: () => { } , onOK: () => { }
}); });
return; return;
} }
dialog.alert({ dialog.alert({
content: "현재 " + $P.control.prefixName + " 정보를 저장하시겠습니까?" content: "현재 " + $P.ctrl.prefixName + " 정보를 저장하시겠습니까?"
, init: () => { setDialogZindex(); }
, onOK: () => { , onOK: () => {
let params = { let params = {
callPurpose: "create" callPurpose: "create"
, userId: $("#userId--${pageName}").val() , userId: $P.$find("userId").val()
, entId: entId , entIds: selected.join(",")
}; }
$P.saveMpng(params);
}
});
}
// 우편번호 검색 $P.ctrl.save(params);
$P.fnZipCode = async() => {
let resp = await fetch(wctx.url("/resources/html/searchAddr.html"));
let template = await resp.text();
dialog.open({
id: "searchAddrDialog"
, title: "주소검색"
, size: "lg"
, content: template
, init: () => {
$("#searchAddrCallback").val("pageObject['${pageName}'].callbackSearchAddr");
setDialogZindex();
} }
}); });
} }
// 임대기업 등록 버튼 클릭 이벤트 // 임대기업 등록 버튼 클릭 이벤트
$P.fnCreate = (title) => { $P.fnCreate = () => {
// validate 확인 let params = {
if (!customValidate($("#frmEdit--${pageName}").find("input, select, textarea"))) return; callPurpose: "create"
};
let params = $P.formEditFields.get(); $P.ctrl.getInfo(params);
params.title = title;
params.callPurpose = "create";
dialog.alert({
content: "현재 " + $P.control.prefixName + " 정보를 저장하시겠습니까?"
, init: () => { setDialogZindex(); }
, onOK: () => {
$P.control.save(params); // formFields
}
});
} }
// 임대기업 수정 버튼 클릭 이벤트 // 임대기업 수정 버튼 클릭 이벤트
$P.fnUpdate = (title) => { $P.fnUpdate = () => {
// validate 확인
if (!customValidate($("#frmEdit--${pageName}").find("input, select, textarea"))) return;
// 임대기업 ID // 임대기업 ID
let entId = $P.control.dataset.getValue("ENT_ID"); let entId = $P.ctrl.getValue("ENT_ID");
// 임대기업 ID 가 없다면.. return // 임대기업 ID 가 없다면.. return
if (typeof entId == "undefined" || entId == null || entId == "") return; if (typeof entId == "undefined" || entId == null || entId == "") return;
let params = $P.formEditFields.get(); let params = {
params.title = title; callPurpose: "update"
params.callPurpose = "update"; , entId: entId
params.entId = entId; };
dialog.alert({ $P.ctrl.getInfo(params);
content: "현재 " + $P.control.prefixName + " 정보를 저장하시겠습니까?"
, init: () => { setDialogZindex(); }
, onOK: () => {
$P.control.save(params); // formFields
}
});
} }
// 임대기업 삭제 버튼 클릭 이벤트 // 임대기업 삭제 버튼 클릭 이벤트
$P.fnRemove = (title) => { $P.fnRemove = () => {
// 임대기업 ID let selected = $P.ctrl.dataset.getKeys("selected");
let entId = $P.control.dataset.getValue("ENT_ID");
// 임대기업 ID 가 없다면.. return
if (typeof entId == "undefined" || entId == null || entId == "") return;
let params = $P.formEditFields.get(); if (selected.length < 1) return;
params.title = title;
params.callPurpose = "delete";
params.entId = entId;
// 삭제 메세지 확인
dialog.alert({ dialog.alert({
content: "선택한 " + $P.control.prefixName + " 정보를 삭제하시겠습니까?" content: "선택한 " + $P.ctrl.prefixName + " 정보를 삭제하시겠습니까?"
, onOK: () => { , onOK: () => {
$P.control.remove(params); let params = {
entIds: selected.join(",")
}
$P.ctrl.remove(params);
} }
}); });
} }
@ -523,47 +460,20 @@
// 이벤트 // 이벤트
$P.setEvent = () => { $P.setEvent = () => {
// 기본 버튼 이벤트 // 기본 버튼 이벤트
$("#btnReset--${pageName}").on("click", () => $P.fnResetAndChangeBiz()); // 초기화 $P.$find("btnReset").on("click", () => { $P.fnReset(); }); // 초기화
$("#btnSearch--${pageName}").on("click", () => $P.fnSearchList()); // 검색 $P.$find("btnSearch").on("click", () => { $P.fnSearchList(); }); // 검색
$("#btnOK--${pageName}").on("click", () => $P.fnOK()); // 선택 확인 $P.$find("btnOK").on("click", () => { $P.fnOK(); }); // 선택 확인
$("#btnZipCode--${pageName}").on("click", () => $P.fnZipCode()); // 우편번호 검색
// 업무 버튼 이벤트 // 업무 버튼 이벤트
$("#btnCreate--${pageName}").on("click", function() { $P.$find("btnCreate").on("click", () => { $P.fnCreate(); }); // 등록
$P.fnCreate($(this).attr("title")); // 임대기업 등록 $P.$find("btnUpdate").on("click", () => { $P.fnUpdate(); }); // 수정
}); $P.$find("btnRemove").on("click", () => { $P.fnRemove(); }); // 삭제
$("#btnUpdate--${pageName}").on("click", function() {
$P.fnUpdate($(this).attr("title")); // 임대기업 수정
});
$("#btnRemove--${pageName}").on("click", function() {
$P.fnRemove($(this).attr("title")); // 임대기업 삭제
});
// DataTables width 변경 조정
fnMakeResizableTable($("#table-responsive--${pageName}")[0]);
// DataTables 스크롤 이벤트 생성
fnMakeScrollableTable($("#table-responsive--${pageName}")[0], $P.scrollDataList);
}
// 화면 초기 설정 // DataTable width 변경 조정
$P.initForm = () => { fnMakeResizableTable($P.find("table-responsive"));
// 화면 초기화
$("#frmEdit--${pageName}")[0].reset();
// 기본 데이터 설정
$("#sggCd--${pageName}").val("${sggCd}"); // 시군구 코드
$("#userId--${pageName}").val("${userId}"); // 사용자 ID
$("#schEntNo--${pageName}").val("${schEntNo}"); // 기업 번호
}
// 업무 구분별 설정 // DataTable 스크롤 이벤트 생성
$P.setTask = () => { fnMakeScrollableTable($P.find("table-responsive"), $P.scrollDataList);
// 업무구분에 따른 URL 설정
$P.control.urls.load = wctx.url("${infoPrefixUrl}" + "/020/list.do"); // 검색
$P.control.urls.create = wctx.url("${infoPrefixUrl}" + "/020/create.do"); // 등록
$P.control.urls.update = wctx.url("${infoPrefixUrl}" + "/020/update.do"); // 수정
$P.control.urls.remove = wctx.url("${infoPrefixUrl}" + "/020/remove.do"); // 삭제
} }
/************************************************************************** /**************************************************************************
@ -572,8 +482,8 @@
// 1. 이벤트 설정 // 1. 이벤트 설정
$P.setEvent(); $P.setEvent();
// 2. 초기 설정 및 업무 구분 변경 // 2. 초기 설정
$P.fnResetAndChangeBiz($("#layout-navbar input[name='taskSeCd']:checked").val()); $P.fnReset(true);
// 3. 보안모드 // 3. 보안모드
fn_securityModeToggle($("#securityMode--top").is(":checked")); fn_securityModeToggle($("#securityMode--top").is(":checked"));

@ -0,0 +1,237 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<c:set var="prefixName" scope="request">임대기업 정보</c:set>
<!-- inner page html -->
<div class="content-pop" data-doctx="${pageName}">
<!-- Content -->
<div class="container flex-grow-1 px-0">
<div class="card">
<!-- 입력 영역 -->
<form name="frmEdit">
<!-- hidden -->
<input type="hidden" name="entId" data-map="ENT_ID" />
<div class="row g-1">
<!-- 기업 구분 코드 -->
<div class="col-md-6">
<label is="name-label" class="w-px-120 bg-lighter pe-2 col-form-label text-sm-end required" for="entSeCd">기업구분</label>
<select is="id-select" class="form-select" name="entSeCd" data-map="ENT_SE_CD" required>
<option value="">선택하세요</option>
<c:forEach items="${FIM088List}" var="item">
<option value="${item.code}">${item.value}</option>
</c:forEach>
</select>
</div>
<!-- 기업 번호 -->
<div class="col-md-6">
<label is="name-label" class="w-px-120 bg-lighter pe-2 col-form-label text-sm-end required" for="entNo">법인(사업자)번호</label>
<input is="id-input" type="text" class="form-control w-30" name="entNo" data-map="ENT_NO" autocomplete="off" />
</div>
<!-- 기업 명 -->
<div class="col-md-6">
<label is="name-label" class="w-px-120 bg-lighter pe-2 col-form-label text-sm-end required" for="entNm">기업명</label>
<input is="id-input" type="text" class="form-control w-40" name="entNm" data-map="ENT_NM" autocomplete="off" />
</div>
<!-- 대표자 명 -->
<div class="col-md-6">
<label is="name-label" class="w-px-120 bg-lighter pe-2 col-form-label text-sm-end" for="rprsvNm">대표자명</label>
<input is="id-input" type="text" class="form-control w-30" name="rprsvNm" data-map="RPRSV_NM" autocomplete="off" />
</div>
<!-- 기업 전화번호 -->
<div class="col-md-6">
<label is="name-label" class="w-px-120 bg-lighter pe-2 col-form-label text-sm-end" for="entTelno">전화번호</label>
<input is="id-input" type="text" class="form-control w-30" name="entTelno" data-map="ENT_TELNO" autocomplete="off" />
</div>
<!-- 기업 팩스번호 -->
<div class="col-md-6">
<label is="name-label" class="w-px-120 bg-lighter pe-2 col-form-label text-sm-end" for="entFxno--${pageName}">팩스번호</label>
<input is="id-input" type="text" class="form-control w-30" name="entFxno" data-map="ENT_FXNO" autocomplete="off" />
</div>
<!-- 기업 이메일 -->
<div class="col-md-12">
<label is="name-label" class="w-px-120 bg-lighter pe-2 col-form-label text-sm-end" for="entEmlAddr--${pageName}">이메일</label>
<input is="id-input" type="text" class="form-control w-30" name="entEmlAddr" data-map="ENT_EML_ADDR" />
</div>
<!-- 주소 --><!-- 우편번호 -->
<div class="col-md-12">
<label is="name-label" class="w-px-120 bg-lighter pe-2 col-form-label text-sm-end" for="entAddr">주소</label>
<input is="id-input" type="text" class="form-control w-70" name="entAddr" data-map="ENT_ADDR" autocomplete="off" />
<input is="id-input" type="text" class="form-control w-px-80" name="entZip" data-map="ENT_ZIP" autocomplete="off" />
<button type="button" class="btn btn-sm btn-outline-dark" name="btnZipCode" title="우편번호검색">
검색
</button>
</div>
<!-- 상세주소 -->
<div class="col-md-12">
<label is="name-label" class="w-px-120 bg-lighter pe-2 col-form-label text-sm-end" for="entDtlAddr">상세주소</label>
<input is="id-input" type="text" class="form-control w-85" name="entDtlAddr" data-map="ENT_DTL_ADDR" autocomplete="off" />
</div>
</div>
</form>
<!-- 입력 영역 -->
<!-- 업무 버튼 및 건수 표시 -->
<div>
<span class="container-page-btn">
<!-- 업무 버튼 -->
<span class="container-window-btn-right">
<button type="button" class="btn btn-primary w-px-80" name="btnSave" title="저장">
저장
</button>
</span>
</span>
</div>
<!-- 업무 버튼 및 건수 표시 -->
</div> <!-- <div class="card"> -->
</div> <!-- <div class="container flex-grow-1 px-0"> -->
<!-- Content -->
</div>
<!-- / inner page html <div class="content-pop"> -->
<script>
/**************************************************************************
* Global Variable
**************************************************************************/
pageObject["${pageName}"] = newDoctxFinder("${pageName}");
/**************************************************************************
* script 진입
**************************************************************************/
$(document).ready(function() {
// pageObject
let $P = pageObject["${pageName}"];
// infoDialog 호출 용도(view 조회(편집불가), create 등록, update 수정)
$P.callPurpose = "${callPurpose}";
// FormFields
$P.formFields = new FimsFormFields($P.selector("frmEdit"));
/**************************************************************************
* DatasetControl
**************************************************************************/
$P.ctrl = new DatasetControl({
prefix: "rentEnt"
, prefixName: "임대 기업"
, keymapper: info => info ? info.ENT_ID : ""
, dataGetter: obj => obj["Info"]
, urls: {
create: wctx.url("${prefixUrl}" + "/030/create.do") // 등록
, update: wctx.url("${prefixUrl}" + "/030/update.do") // 수정
}
});
/**************************************************************************
* DatasetControl 이벤트
**************************************************************************/
// 현재 선택 자료 변경 이벤트
$P.ctrl.onCurrentChange = (item) => {
if (!item) return;
$P.formFields.set($P.ctrl, item); // 화면에 자료 셋팅
let key = item.data.ENT_ID;
};
// 저장
$P.ctrl.save = (params) => {
if (!params) return;
let create = ($P.callPurpose == "create");
ajax.post({
url: !create ? $P.ctrl.urls.update : $P.ctrl.urls.create
, data: params || {}
, success: (resp) => {
let dialogTitle = $("#" + $P.selfDlgId()).find("h5.modal-title").html();
let showMessage = resp.rtnMsg.replace(/[S]|[F]/g, dialogTitle);
// 메시지 출력
dialog.alert({
content: showMessage
, init: () => { setDialogZindex(); }
, onOK: () => { }
, onClose: () => {
if (resp.saved) { dialog.close($P.selfDlgId()); }
}
});
}
});
}
/**************************************************************************
* 사용자 함수(function)
**************************************************************************/
// 우편번호 검색 결과
$P.callbackSearchAddr = (obj) => {
$P.$find("entAddr").val(obj.ADDR); // 주소
$P.$find("entZip").val(obj.ZIP); // 우편번호
$P.$find("entDtlAddr").val(obj.DTL_ADDR); // 상세 주소
}
/**************************************************************************
* 버튼 clickEvent
**************************************************************************/
// 우편번호 검색
$P.fnZipCode = async() => {
let resp = await fetch(wctx.url("/resources/html/searchAddr.html"));
let template = await resp.text();
dialog.open({
id: "searchAddrDialog"
, title: "주소 검색"
, size: "lg"
, content: template
, init: () => {
$("#searchAddrCallback").val("pageObject['${pageName}'].callbackSearchAddr");
setDialogZindex();
}
});
}
// 임대기업 등록 버튼 클릭 이벤트
$P.fnSave = () => {
// validate 확인
if (!customValidate($("#frmEdit--${pageName}").find("input, select, textarea"))) return;
dialog.alert({
content: "현재 " + $P.ctrl.prefixName + " 정보를 저장하시겠습니까?"
, onOK: () => {
$P.ctrl.save($P.formFields.get()); // formFields
}
});
}
/**************************************************************************
* 초기 설정
**************************************************************************/
// 이벤트
$P.setEvent = () => {
// 기본 버튼 이벤트
$P.$find("btnZipCode").on("click", () => { $P.fnZipCode() }); // 우편번호 검색
// 버튼 이벤트
$P.$find("btnSave").on("click", () => { $P.fnSave() }); // 저장
}
// 화면 초기 설정
$P.initForm = () => {
// 화면 초기화
$P.find("frmEdit").reset();
// dataset 설정
$P.ctrl.setData([${Info}]);
}
/**************************************************************************
* 최초 실행 함수
**************************************************************************/
// 1. 이벤트 설정
$P.setEvent();
// 2. 초기 설정
$P.initForm();
});
</script>
Loading…
Cancel
Save