1. 임대기업 관리 jsp 수정.

2. 임대기업 매핑 jsp 추가.
main
jjh 4 months ago
parent 8af6d0d55f
commit 6b5657c86c

@ -54,11 +54,11 @@
</div>
<!-- 업무 버튼 -->
<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" id="btnCreate--${pageName}" title="대기업 매핑 등록">
매핑 등록
</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" id="btnRemove--${pageName}" title="대기업 매핑 삭제">
매핑 삭제
</button>
</span>
</span>
@ -78,6 +78,7 @@
<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_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: 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: 280px;" onclick="searchFromGridTitle('ENT_EML_ADDR', this.innerText, 'match', 'part');">이메일주소</th>
@ -92,12 +93,13 @@
<tbody id="tbody--${pageName}">
</tbody>
<template id="${infoPrefix}Row--${pageName}">
<tr data-key="{ENT_ID}">
<tr data-key="{MPNG_ID}">
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{ROW_NUM}</td>
<td class="cmn text-center"><input type="checkbox" class="form-check-input" name="gridCheckbox" value="{ENT_ID}" onchange="pageObject['${pageName}'].control.select('{ENT_ID}', this.checked);"></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" onclick="{onclick}" ondblclick="{ondblclick}">{ENT_SE_NM}</td>
<td class="cmn text-start" onclick="{onclick}" ondblclick="{ondblclick}">{ENT_NM}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{ENT_NO}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{RPRSV_NM}</td>
<td class="cmn text-start" onclick="{onclick}" ondblclick="{ondblclick}">{ENT_TELNO}</td>
<td class="cmn text-start" onclick="{onclick}" ondblclick="{ondblclick}">{ENT_FXNO}</td>
<td class="cmn text-start" onclick="{onclick}" ondblclick="{ondblclick}">{ENT_EML_ADDR}</td>
@ -111,7 +113,7 @@
</template>
<template id="${infoPrefix}NotFound--${pageName}">
<tr class="odd">
<td valign="top" colspan="14" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td>
<td valign="top" colspan="15" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td>
</tr>
</template>
</table>
@ -147,12 +149,12 @@
* DatasetControl
**************************************************************************/
$P.control = new DatasetControl({
prefix: "rentEnt"
, prefixName: "임대기업"
, keymapper: info => info ? info.ENT_ID : ""
prefix: "userRentEntMpng"
, prefixName: "사용자 임대기업"
, keymapper: info => info ? info.MPNG_ID : ""
, dataGetter: obj => obj.${infoPrefix}List
, appendData: true
, infoSize: "md"
, infoSize: "xl"
, formats: {
REG_DT: datetimeFormat
}
@ -183,7 +185,7 @@
$P.control.onCurrentChange = (item) => {
if (!item) return;
let key = item.data.ENT_ID;
let key = item.data.MPNG_ID;
$("#tbody--${pageName}").setCurrentRow(key);
};
@ -212,35 +214,23 @@
};
// 상세정보 dialog
$P.control.getInfo = (gdntcId) => {
let dialogTitle = "";
let params = {};
if (typeof gdntcId == "undefined" || gdntcId == null || gdntcId == "") {
dialogTitle = $P.control.prefixName + " 등록";
params.callPurpose = "create";
params.sggCd = $("#sggCd--${pageName}").val(); // 시군구 코드
params.taskSeCd = $("#frmSearch--${pageName} input[name='taskSeCd']:checked").val(); // 업무 구분 코드
} else {
dialogTitle = $P.control.prefixName + " 수정";
params.callPurpose = "update";
params.sggCd = $("#sggCd--${pageName}").val(); // 시군구 코드
params.taskSeCd = $("#frmSearch--${pageName} input[name='taskSeCd']:checked").val(); // 업무 구분 코드
params.gdntcId = gdntcId;
}
$P.control.getInfo = (mpngId) => {
let params = {
callPurpose: "create"
, mpngId: mpngId
, entId: $P.control.dataset.getValue("ENT_ID")
};
ajax.get({
url: wctx.url("/" + params.taskSeCd + "${infoPrefixUrl}" + "/020/info.do") + "?openerPageName=${pageName}"
url: $P.control.urls.getInfo + "?openerPageName=${pageName}"
, data: params || {}
, success: resp => {
dialog.open({
id: $P.control.prefixed("Dialog--${pageName}")
, title: dialogTitle
id: "rentEntDialog--${pageName}"
, title: "임대기업 매핑"
, content: resp
, size: $P.control.infoSize
, onClose : () => { $P.fnRefreshList(); } // 자료 재조회
, onClose: () => { $P.fnRefreshList(); } // 자료 재조회
});
}
});
@ -266,7 +256,7 @@
if (!params) return;
ajax.post({
url: wctx.url("/" + params.taskSeCd + "${infoPrefixUrl}" + "/010/remove.do")
url: $P.control.urls.remove
, data: params || {}
, success: resp => $P.control.onRemove(resp)
});
@ -285,13 +275,14 @@
${infoPrefix}List.inStrings(
document.getElementById("${infoPrefix}Row--${pageName}").innerHTML, <%-- from template#${infoPrefix}Row --%>
(str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].control.setCurrent('" + dataItem.getValue("ENT_ID") + "');")
.replace(/{ondblclick}/gi, "pageObject['${pageName}'].control.getInfo('" + dataItem.getValue("ENT_ID") + "');")
.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 initScroll = ($P.control.query.pageNum < 2);
if(option != null && option.reloaded){
if (option != null && option.reloaded) {
initScroll = false;
}
@ -362,12 +353,12 @@
$P.control.download();
}
// 전자우편 안내문 등록 버튼 이벤트
// 임대기업 매핑 등록 버튼 이벤트
$P.fnCreate = (title) => {
$P.control.getInfo();
}
// 삭제 버튼 이벤트
// 임대기업 매핑 삭제 버튼 이벤트
$P.fnRemove = (title) => {
let selected = $P.control.dataset.getKeys("selected");
@ -376,7 +367,7 @@
let params = {};
params.sggCd = $("#sggCd--${pageName}").val(); // 시군구 코드
params.taskSeCd = $("#frmSearch--${pageName} input[name='taskSeCd']:checked").val(); // 업무 구분 코드
params.gdntcIds = selected.join(","); // params[$P.control.prefixed("IDs")] = selected.join(",");
params.mpngIds = selected.join(",");
dialog.alert({
content: "선택한 " + $P.control.prefixName + " 정보를 삭제하시겠습니까?"
@ -445,7 +436,9 @@
// 업무 구분별 설정
$P.setTask = () => {
// 업무구분에 따른 URL 설정
$P.control.urls.load = wctx.url("${infoPrefixUrl}" + "/010/list.do"); // 검색
$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"); // 삭제
}
/**************************************************************************

@ -0,0 +1,575 @@
<%@ 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">
<!-- Content -->
<div class="container flex-grow-1 px-0">
<div class="card">
<!-- 상단 버튼 -->
<div class="container-page-btn">
<span class="container-window-btn-right">
<button type="button" class="btn btn-search w-px-120" id="btnSearch--${pageName}" title="검색">
검색
</button>
<button type="button" class="btn btn-primary w-px-120" id="btnOK--${pageName}" title="임대기업 선택 확인">
선택 확인
</button>
</span>
</div>
<!-- 상단 버튼 -->
<!-- 검색 조건 영역 -->
<form id="frmSearch--${pageName}" name="frmSearch">
<!-- hidden -->
<input type="hidden" id="userId--${pageName}" name="userId" />
<!-- 메인 조건 -->
<div class="container-search">
<div class="row g-1">
<!-- 기업 번호 -->
<div class="col-6">
<label class="form-label fw-bold form-search-title w-px-120 text-end" for="schEntNo--${pageName}">법인(사업자)번호</label>
<input type="text" class="form-control w-px-160" id="schEntNo--${pageName}" name="schEntNo" autocomplete="off" />
</div>
<!-- 기업 명 -->
<div class="col-6">
<label class="form-label fw-bold form-search-title w-px-120 text-end" for="schEntNm--${pageName}">기업명</label>
<input type="text" class="form-control w-px-200" id="schEntNm--${pageName}" name="schEntNm" autocomplete="off" />
</div>
</div>
</div>
<!-- 메인 조건 -->
</form>
<!-- 검색 조건 영역 -->
<!-- 업무 버튼 및 건수 표시 -->
<div>
<span class="container-page-btn">
<!-- 건수, 페이지 표시 -->
<div class="d-flex flex-row justify-content-between">
<span class="dataTables_info" id="paging--${pageName}PagingInfo" role="status" aria-live="polite"></span>
<ul class="pagination pagination-primary" id="paging--${pageName}">
</ul>
</div>
<!-- 업무 버튼 -->
<span class="container-window-btn-right">
</span>
</span>
</div>
<!-- 업무 버튼 및 건수 표시 -->
<!-- DataTables(그리드) -->
<div class="card-datatable text-nowrap">
<div class="dataTables_wrapper dt-bootstrap5 no-footer" id="DataTables_Table_0_wrapper--${pageName}">
<div class="table-responsive ox-scroll oy-scroll h-px-300" id="table-responsive--${pageName}">
<table class="table-layout-fixed dataTable datatables-ajax table table-bordered no-footer" id="DataTables_Table_0--${pageName}" aria-describedby="DataTables_Table_0_info">
<thead class="sticky-thead">
<tr id="theadTr--${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: 200px;">기업명</th>
<th class="cmn" style="width: 160px;">법인(사업자)번호</th>
<th class="cmn" style="width: 120px;">대표자명</th>
<th class="cmn" style="width: 100px;">우편번호</th>
<th class="cmn" style="width: 280px;">주소</th>
<th class="cmn" style="width: 180px;">등록일시</th>
<th class="cmn dummy-th"></th>
</tr>
</thead>
<tbody id="tbody--${pageName}">
</tbody>
<template id="${infoPrefix}Row--${pageName}">
<tr data-key="{ENT_ID}">
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{ROW_NUM}</td>
<td class="cmn text-start" onclick="{onclick}" ondblclick="{ondblclick}">{ENT_NM}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{ENT_NO}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{RPRSV_NM}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{ENT_ZIP}</td>
<td class="cmn text-start" onclick="{onclick}" ondblclick="{ondblclick}">{ENT_ADDR}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{REG_DT}</td>
<td class="cmn dummy-td"></td>
</tr>
</template>
<template id="${infoPrefix}NotFound--${pageName}">
<tr class="odd">
<td valign="top" colspan="8" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td>
</tr>
</template>
</table>
</div>
</div>
</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="rtpyrTelno--${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="container flex-grow-1 px-0"> -->
<!-- Content -->
</div>
<!-- / inner page html <div class="content-pop"> -->
<script>
/**************************************************************************
* Global Variable
**************************************************************************/
pageObject["${pageName}"] = {};
/**************************************************************************
* script 진입
**************************************************************************/
$(document).ready(function() {
// pageObject
let $P = pageObject["${pageName}"];
// FormFields
$P.formSearchFields = new FimsFormFields("#frmSearch--${pageName}");
$P.formEditFields = new FimsFormFields("#frmEdit--${pageName}");
/**************************************************************************
* DatasetControl
**************************************************************************/
$P.control = new DatasetControl({
prefix: "rentEnt"
, prefixName: "임대기업 매핑"
, keymapper: info => info ? info.ENT_ID : ""
, dataGetter: obj => obj.${infoPrefix}List
, appendData: true
, formats: {
REG_DT: datetimeFormat
}
});
// $P.control 설정
$P.control.defaultFetchSize = FETCH_XS; // 1 페이지당 조회되는 자료 건수 index.jsp에서 확인 FETCH_XS = 30
$P.control.query = { pageNum : 1, fetchSize : $P.control.defaultFetchSize };
$P.control.beforeCurrent = null;
/**************************************************************************
* DatasetControl 이벤트
**************************************************************************/
// Dataset 변경 이벤트
$P.control.onDatasetChange = (obj, option) => {
$P.renderList(obj.${infoPrefix}Total, option);
$("#paging--${pageName}").setPagingInfo({
list: $P.control.dataset
, 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) => {
if (!item) return;
$P.formEditFields.set($P.control, item); // 화면에 자료 셋팅
let key = item.data.ENT_ID;
$("#tbody--${pageName}").setCurrentRow(key);
};
// 저장 callback
$P.control.onSave = (resp) => {
let dialogTitle = $("#" + $P.control.prefix + "Dialog--${openerPageName}").find("h5.modal-title").html();
let showMessage = resp.rtnMsg.replace(/[S]|[F]/g, dialogTitle);
// 메시지 출력
dialog.alert({
content: showMessage
, init: () => { setDialogZindex(); }
, onOK: () => { }
});
if (resp.saved) { $P.fnRefreshList(); } // 자료 재조회
}
// 저장
$P.control.save = (info) => {
if (!info) return;
let create = (info.callPurpose == "create");
ajax.post({
url: !create ? $P.control.urls.update : $P.control.urls.create
, data: info || {}
, success: resp => $P.control.onSave(resp)
});
}
// 삭제 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) => {
if (!params) return;
ajax.post({
url: $P.control.urls.remove
, data: params || {}
, success: resp => $P.control.onRemove(resp)
});
}
/**************************************************************************
* DataTables 이벤트
**************************************************************************/
// DataTables에 click, dbclick 이벤트
$P.renderList = (totalSize, option) => {
let ${infoPrefix}List = $P.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, "pageObject['${pageName}'].control.setCurrent('" + dataItem.getValue("ENT_ID") + "');")
.replace(/{ondblclick}/gi, "pageObject['${pageName}'].fnOK('" + dataItem.getValue("ENT_ID") + "');")
);
let noMore = (${infoPrefix}List.length >= totalSize);
let initScroll = ($P.control.query.pageNum < 2);
if (option != null && option.reloaded) {
initScroll = false;
}
$("#table-responsive--${pageName}")[0].changeContent(trs.join(), initScroll, noMore);
//보안모드
fn_securityModeToggle($("#securityMode--top").is(":checked"));
}
// DataTables에 스크롤이 맨 밑으로 이동했을 때 이벤트
$P.scrollDataList = () => {
$P.control.load($P.control.query.pageNum + 1);
}
/**************************************************************************
* 사용자 함수(function)
**************************************************************************/
// 검색 자료 재조회
$P.fnRefreshList = () => {
$P.control.reload({all : true});
}
// 우편번호 검색 결과
$P.callbackSearchAddr = (obj) => {
$("#entAddr--${pageName}").val(obj.ADDR); // 주소
$("#entZip--${pageName}").val(obj.ZIP); // 우편번호
$("#entDtlAddr--${pageName}").val(obj.DTL_ADDR); // 상세 주소
}
// 저장
$P.saveMpng = (params) => {
if (!params) return;
ajax.post({
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);
// 메시지 출력
dialog.alert({
content: showMessage
, init: () => { setDialogZindex(); }
, onOK: () => { }
});
if (resp.saved) {
dialog.close($P.control.prefix + "Dialog--${openerPageName}");
}
}
});
}
/**************************************************************************
* 버튼 clickEvent
**************************************************************************/
// 업무 구분 변경 이벤트
$P.fnResetAndChangeBiz = (taskSeCd) => {
// 초기 기본 설정
$P.initForm();
// 업무 구분별 설정
$P.setTask();
// dataset 초기화
$P.control.dataset.clear();
}
// 검색 버튼 클릭 이벤트
$P.fnSearchList = () => {
// 검색조건
$P.control.query = $P.formSearchFields.get(); // 검색 조건
$P.control.query.fetchSize = $P.control.defaultFetchSize; // 한번에 조회되는 자료 건수
$P.control.query.delYn = "N"; // 삭제 여부
$P.control.load(1);
}
// 확인
$P.fnOK = () => {
// 기업 ID
entId = $P.control.dataset.getValue("ENT_ID");
if (typeof entId == "undefined" || entId == null || entId == "") {
dialog.alert({
content: "선택하신 " + $P.control.prefixName + " 정보가 없습니다."
, init: () => { setDialogZindex(); }
, onOK: () => { }
});
return;
}
dialog.alert({
content: "현재 " + $P.control.prefixName + " 정보를 저장하시겠습니까?"
, init: () => { setDialogZindex(); }
, onOK: () => {
let params = {
callPurpose: "create"
, userId: $("#userId--${pageName}").val()
, entId: entId
};
$P.saveMpng(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) => {
// validate 확인
if (!customValidate($("#frmEdit--${pageName}").find("input, select, textarea"))) return;
let params = $P.formEditFields.get();
params.title = title;
params.callPurpose = "create";
dialog.alert({
content: "현재 " + $P.control.prefixName + " 정보를 저장하시겠습니까?"
, init: () => { setDialogZindex(); }
, onOK: () => {
$P.control.save(params); // formFields
}
});
}
// 임대기업 수정 버튼 클릭 이벤트
$P.fnUpdate = (title) => {
// validate 확인
if (!customValidate($("#frmEdit--${pageName}").find("input, select, textarea"))) return;
// 임대기업 ID
let entId = $P.control.dataset.getValue("ENT_ID");
// 임대기업 ID 가 없다면.. return
if (typeof entId == "undefined" || entId == null || entId == "") return;
let params = $P.formEditFields.get();
params.title = title;
params.callPurpose = "update";
params.entId = entId;
dialog.alert({
content: "현재 " + $P.control.prefixName + " 정보를 저장하시겠습니까?"
, init: () => { setDialogZindex(); }
, onOK: () => {
$P.control.save(params); // formFields
}
});
}
// 임대기업 삭제 버튼 클릭 이벤트
$P.fnRemove = (title) => {
// 임대기업 ID
let entId = $P.control.dataset.getValue("ENT_ID");
// 임대기업 ID 가 없다면.. return
if (typeof entId == "undefined" || entId == null || entId == "") return;
let params = $P.formEditFields.get();
params.title = title;
params.callPurpose = "delete";
params.entId = entId;
// 삭제 메세지 확인
dialog.alert({
content: "선택한 " + $P.control.prefixName + " 정보를 삭제하시겠습니까?"
, onOK: () => {
$P.control.remove(params);
}
});
}
/**************************************************************************
* 초기 설정
**************************************************************************/
// 이벤트
$P.setEvent = () => {
// 기본 버튼 이벤트
$("#btnReset--${pageName}").on("click", () => $P.fnResetAndChangeBiz()); // 초기화
$("#btnSearch--${pageName}").on("click", () => $P.fnSearchList()); // 검색
$("#btnOK--${pageName}").on("click", () => $P.fnOK()); // 선택 확인
$("#btnZipCode--${pageName}").on("click", () => $P.fnZipCode()); // 우편번호 검색
// 업무 버튼 이벤트
$("#btnCreate--${pageName}").on("click", function() {
$P.fnCreate($(this).attr("title")); // 임대기업 등록
});
$("#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);
}
// 화면 초기 설정
$P.initForm = () => {
// 화면 초기화
$("#frmEdit--${pageName}")[0].reset();
// 기본 데이터 설정
$("#sggCd--${pageName}").val("${sggCd}"); // 시군구 코드
$("#userId--${pageName}").val("${userId}"); // 사용자 ID
}
// 업무 구분별 설정
$P.setTask = () => {
// 업무구분에 따른 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"); // 삭제
}
/**************************************************************************
* 최초 실행 함수
**************************************************************************/
// 1. 이벤트 설정
$P.setEvent();
// 2. 초기 설정 및 업무 구분 변경
$P.fnResetAndChangeBiz($("#layout-navbar input[name='taskSeCd']:checked").val());
// 3. 보안모드
fn_securityModeToggle($("#securityMode--top").is(":checked"));
});
</script>
Loading…
Cancel
Save