임대기업 관리 수정.

main
jjh 2 months ago
parent e78576b167
commit fabeb9f91a

@ -44,7 +44,7 @@
<!-- 업무 버튼 및 건수 표시 --> <!-- 업무 버튼 및 건수 표시 -->
<div> <div>
<span class="container-page-btn"> <div class="container-page-btn" name="gridButtonArea">
<!-- 건수, 페이지 표시 --> <!-- 건수, 페이지 표시 -->
<div class="d-flex flex-row justify-content-between"> <div class="d-flex flex-row justify-content-between">
<span is="paging-info" class="dataTables_info" name="dataPagingInfo" role="status" aria-live="polite"></span> <span is="paging-info" class="dataTables_info" name="dataPagingInfo" role="status" aria-live="polite"></span>
@ -53,14 +53,14 @@
</div> </div>
<!-- 업무 버튼 --> <!-- 업무 버튼 -->
<span class="container-window-btn-right"> <span class="container-window-btn-right">
<button type="button" class="btn btn-primary w-px-160" name="btnCreate" 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-160" name="btnRemove" title="임대기업 매핑 삭제"> <button type="button" class="btn btn-primary w-px-120" name="btnRemove" title="임대기업 매핑 삭제">
매핑 삭제 매핑 삭제
</button> </button>
</span> </span>
</span> </div>
</div> </div>
<!-- 업무 버튼 및 건수 표시 --> <!-- 업무 버튼 및 건수 표시 -->
@ -68,7 +68,7 @@
<div class="card-datatable text-nowrap"> <div class="card-datatable text-nowrap">
<div class="dataTables_wrapper dt-bootstrap5 no-footer"> <div class="dataTables_wrapper dt-bootstrap5 no-footer">
<div class="table-responsive ox-scroll oy-scroll h-px-500" name="tableRspns"> <div class="table-responsive ox-scroll oy-scroll h-px-500" name="tableRspns">
<table class="table-layout-fixed dataTable datatables-ajax table table-bordered no-footer" aria-describedby="DataTables_Table_0_info"> <table name="rent01010table" class="table-layout-fixed dataTable datatables-ajax table table-bordered no-footer" aria-describedby="DataTables_Table_0_info">
<thead class="sticky-thead"> <thead class="sticky-thead">
<tr name="theadTr" data-search-target="[data-doctx='${pageName}']"> <tr name="theadTr" data-search-target="[data-doctx='${pageName}']">
</tr> </tr>
@ -96,9 +96,9 @@
<tbody name="tbodyList"> <tbody name="tbodyList">
</tbody> </tbody>
<template is="curly-brackets" name="tmpltRows"> <template is="curly-brackets" name="tmpltRows">
<tr data-key="MPNG_ID"> <tr data-index="{data-index}">
<td class="cmn text-center" onclick 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}'].dataTableCheckbox(this, this.checked);" /></td> <td class="cmn text-center"><input type="checkbox" class="form-check-input" name="gridCheckbox" value="{data-index}" onchange="pageObject['${pageName}'].dataTableCheckbox(this, this.checked);" /></td>
<td class="cmn text-start" onclick ondblclick>{USER_ACNT}</td> <td class="cmn text-start" onclick ondblclick>{USER_ACNT}</td>
<td class="cmn text-center" onclick ondblclick>{USER_NM}</td> <td class="cmn text-center" onclick ondblclick>{USER_NM}</td>
<td class="cmn text-center" onclick ondblclick>{ENT_SE_NM}</td> <td class="cmn text-center" onclick ondblclick>{ENT_SE_NM}</td>
@ -135,6 +135,8 @@
<!-- / inner page html <div class="content-wrapper"> --> <!-- / inner page html <div class="content-wrapper"> -->
<script> <script>
LoadScript("rent01010Script", wctx.url("/webjars/js/fims/rent/rent01010.js?ver=${ver}"));
/************************************************************************** /**************************************************************************
* Global Variable * Global Variable
**************************************************************************/ **************************************************************************/
@ -147,152 +149,15 @@
// pageObject // pageObject
let $P = pageObject["${pageName}"]; let $P = pageObject["${pageName}"];
// datasetControl
$P.ctrl = newRent01010Control("${pageName}", "[data-doctx=${pageName}]");
// FormFields // FormFields
$P.formFields = new FimsFormFields($P.selectorn("frmSearch")); $P.formFields = new FimsFormFields($P.selectorn("frmSearch"));
/**************************************************************************
* DatasetControl
**************************************************************************/
$P.ctrl = new DatasetControl({
prefix: "userRentEntMpng"
, prefixName: "임대기업 매핑"
, keymapper: info => info ? info.MPNG_ID : ""
, dataGetter: obj => obj["List"]
, appendData: true
, 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: {
REG_DT: datetimeFormat
}
});
// 검색 조건
$P.ctrl.query = { pageNum: 1, fetchSize: DEFAULT_FETCH_SIZE }; // 1 페이지당 자료 건수 index.jsp에서 확인
/**************************************************************************
* DatasetControl 이벤트
**************************************************************************/
// Dataset 변경 이벤트
$P.ctrl.onDatasetChange = (obj, option) => {
$P.renderList(obj["Total"], option);
// datasetPaging
Apply.fromDataset.paging($P.ctrl.dataset, obj, $P.findn("dataPaging"), $P.findn("dataPagingInfo"));
};
// 현재 선택 자료 변경 이벤트
$P.ctrl.onCurrentChange = (item) => {
if (!item) return;
let key = item.data.MPNG_ID;
$P.$findn("tbodyList").setCurrentRow(key);
};
// 선택(체크) 변경 이벤트
$P.ctrl.onSelectionChange = (selected) => {
Apply.fromDataset.gridCheckbox($P.ctrl.dataset, $P.findn("tbodyList"), 1, selected);
Apply.fromDataset.gridButton($P.ctrl.dataset, $P.findn("btnRemove"), selected); // 삭제 버튼
};
// 상세정보 dialog
$P.ctrl.getInfo = (params) => {
if (!params) return;
ajax.get({
url: $P.ctrl.urls.getInfo
, data: params || {}
, success: (resp) => {
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: () => {
$("#" + dialogId).attr("name", dialogName);
$("#" + dialogId).attr("data-ref-doctx", "${pageName}");
AppSupport.setDialogZindex();
}
, onClose: () => { $P.ctrl.reload({ all: true }); } // 자료 재조회
});
}
});
}
// 삭제 callback
$P.ctrl.onRemove = (params, resp) => {
let showMessage = resp.rtnMsg.replace(/[S]|[F]/g, $P.ctrl.prefixName);
// 메시지 출력
dialog.alert({
content: showMessage
, init: () => { AppSupport.setDialogZindex(); }
, onOK: () => { }
, onClose: () => {
if (resp.saved) { $P.ctrl.reload({ all: true }); } // 자료 재조회
}
});
}
// 삭제
$P.ctrl.remove = (params) => {
if (!params) return;
ajax.post({
url: $P.ctrl.urls.remove
, data: params || {}
, success: (resp) => { $P.ctrl.onRemove(params, resp); }
});
}
/************************************************************************** /**************************************************************************
* DataTable 이벤트 * DataTable 이벤트
**************************************************************************/ **************************************************************************/
// DataTable에 click, dbclick 이벤트
$P.renderList = (totalSize, option) => {
let dataList = $P.ctrl.dataset;
let empty = dataList.empty;
// 업무별 DataTables(그리드) tr, td
let foundContent = $P.findn("tmpltRows").content;
let foundTr = $(foundContent).find("tr")[0].cloneNode(false);
let foundTds = $(foundContent).find(".cmn");
foundTds.each(function() {
foundTr.appendChild(this.cloneNode(true));
});
let replacer = (str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].dataTableClick('" + dataItem.getValue("MPNG_ID") + "');")
.replace(/{ondblclick}/gi, "pageObject['${pageName}'].dataTableDblClick('" + dataItem.getValue("MPNG_ID")+ "');");
let trs = empty ?
[$P.findn("tmpltNotFound").content.querySelector(".cmn").outerHTML]
: dataList.inStrings(foundTr.outerHTML, replacer);
let noMore = (dataList.length >= totalSize);
let initScroll = ($P.ctrl.query.pageNum < 2);
if (option != null && option.reloaded) {
initScroll = false;
}
$P.findn("tableRspns").changeContent(trs.join(), initScroll, noMore);
// checkbox 체크 해제
$P.$findn("gridAllCheckbox").prop("checked", false);
// 보안모드
fn_securityModeToggle($("#securityMode--top").is(":checked"));
}
// dataTable 체크박스 클릭 이벤트 // dataTable 체크박스 클릭 이벤트
$P.dataTableCheckbox = (element, bool) => { $P.dataTableCheckbox = (element, bool) => {
GRID.checkbox.sync(element, bool); GRID.checkbox.sync(element, bool);
@ -304,12 +169,12 @@
} }
// dataTable 클릭 이벤트 // dataTable 클릭 이벤트
$P.dataTableClick = (dataKey) => { $P.dataTableClick = (dataIndex) => {
if (dataKey == "") return; if (dataIndex == "") return;
$P.$findn("tbodyList").setCurrentRow(dataKey); $P.$findn("tbodyList").setCurrentRow(dataIndex);
Apply.toDataset.current($P.ctrl.dataset, dataKey); Apply.toDataset.current($P.ctrl.dataset, dataIndex);
} }
// dataTable 더블 클릭 이벤트 // dataTable 더블 클릭 이벤트
@ -332,7 +197,12 @@
/************************************************************************** /**************************************************************************
* 사용자 함수(function) * 사용자 함수(function)
**************************************************************************/ **************************************************************************/
// URL 설정
$P.fnSetUrl = (prefixUrl) => {
$P.ctrl.urls.load = wctx.url(prefixUrl + "/010/list.do"); // 검색
$P.ctrl.urls.remove = wctx.url(prefixUrl + "/010/removeMpng.do") // 삭제
$P.ctrl.urls.getInfo = wctx.url(prefixUrl + "/020/info.do"); // 상세 정보
}
/************************************************************************** /**************************************************************************
* 버튼 clickEvent * 버튼 clickEvent
@ -360,6 +230,9 @@
// dataset 초기화 // dataset 초기화
$P.ctrl.dataset.clear(); $P.ctrl.dataset.clear();
// URL 설정
$P.fnSetUrl("${prefixUrl}");
// 그리드 th // 그리드 th
let colContent = $P.findn("tmpltCols").content; let colContent = $P.findn("tmpltCols").content;
let cols = $(colContent).find(".cmn"); let cols = $(colContent).find(".cmn");

@ -0,0 +1,143 @@
function newRent01010Control(pageName, doctx="[data-doctx='rent01010']") {
let ctrl = new DatasetControl({
doctx: doctx
, prefix: "userRentEntMpng"
, prefixName: "임대기업매핑"
, dataGetter: obj => obj["List"]
, keys: ["MPNG_ID"]
, appendData: true
, infoSize: "xl"
, urls: {
load: "/list.do"
, getInfo: "/info.do"
, create: "/create.do"
, update: "/update.do"
, remove: "/remove.do"
}
, formats: {
REG_DT: datetimeFormat
}
});
// 검색 조건
ctrl.query = { pageNum: 1, fetchSize: DEFAULT_FETCH_SIZE }; // 1 페이지당 자료 건수 index.jsp에서 확인
// paging
pagingSupport = new FimsPagingSupport({
doq: ctrl
, linkContainer: "[name='dataPaging']"
});
/**************************************************************************
* DatasetControl Events
**************************************************************************/
// Dataset 변경 이벤트
ctrl.onDatasetChange = (obj, option) => {
// 데이터 셋
let dataList = ctrl.dataset;
let empty = dataList.empty;
// 업무별 DataTables(그리드) tr, td
let foundContent = ctrl.find("[name='tmpltRows']").content;
let foundTr = $(foundContent).find("tr")[0].cloneNode(false);
let foundTds = $(foundContent).find(".cmn");
foundTds.each(function() {
foundTr.appendChild(this.cloneNode(true));
});
let replacer = (str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['" + pageName + "'].dataTableClick('{data-index}');")
.replace(/{ondblclick}/gi, "pageObject['" + pageName + "'].dataTableDblClick('{MPNG_ID}');");
let trs = empty ?
[ctrl.find("[name='tmpltNotFound']").content.querySelector(".cmn").outerHTML]
: dataList.inStrings(foundTr.outerHTML, replacer);
let noMore = (dataList.length >= obj["Total"]); // 전체 건수
let initScroll = (ctrl.query.pageNum < 2);
if (option != null && option.reloaded) {
initScroll = false;
}
//
ctrl.find("[name='tableRspns']").changeContent(trs.join(), initScroll, noMore);
// checkbox 체크 해제
$(ctrl.find("[name='gridAllCheckbox']")).prop("checked", false);
// pagingInfo
pagingSupport.setPagingInfo(obj);
};
// 현재 선택 자료 변경 이벤트
ctrl.onCurrentChange = (item) => {
Apply.fromDataset.currentRow(ctrl.dataset, item, ctrl.find("[name='tbodyList']"));
};
// 선택(체크) 변경 이벤트
ctrl.onSelectionChange = (selectedArr) => {
// gridCheckbox
Apply.fromDataset.gridCheckbox(ctrl.dataset, ctrl.find("[name='tbodyList']"), 1, selectedArr);
// 삭제 버튼
Apply.fromDataset.gridButton(ctrl.dataset, ctrl.find("[name='btnRemove']"), selectedArr);
};
// 상세 정보 dialog
ctrl.getInfo = (params) => {
if (!params) return;
ajax.get({
url: ctrl.urls.getInfo
, data: params || {}
, success: (resp) => {
let dialogName = ctrl.prefixed("Dialog");
let dialogId = dialogName + "-" + uuid();
dialog.open({
id: dialogId
, title: ctrl.prefixName + " 정보"
, size: ctrl.infoSize
, content: resp
, init: () => {
$("#" + dialogId).attr("name", dialogName);
$("#" + dialogId).attr("data-ref-doctx", pageName);
AppSupport.setDialogZindex();
}
, onClose: () => { ctrl.reload({ all: true }); }
});
}
});
}
// 삭제 callback
ctrl.onRemove = (params, resp) => {
let showMessage = resp.rtnMsg.replace(/[S]|[F]/g, ctrl.prefixName);
// 메시지 출력
dialog.alert({
content: showMessage
, init: () => { AppSupport.setDialogZindex(); }
, onOK: () => { }
, onClose: () => {
if (resp.saved) { ctrl.reload({ all: true }); }
}
});
}
// 삭제
ctrl.remove = (params) => {
if (!params) return;
ajax.post({
url: ctrl.urls.remove
, data: params || {}
, success: (resp) => { ctrl.onRemove(params, resp); }
});
}
return ctrl;
}
Loading…
Cancel
Save