임대계약서 관리 수정.

main
xitpc\xituser 2 months ago
parent b85f846602
commit 8f485fe9c4

@ -67,7 +67,7 @@
<!-- 업무 버튼 및 건수 표시 -->
<div>
<span class="container-page-btn">
<div class="container-page-btn" name="gridButtonArea">
<!-- 건수, 페이지 표시 -->
<div class="d-flex flex-row justify-content-between">
<span is="paging-info" class="dataTables_info" name="dataPagingInfo" role="status" aria-live="polite"></span>
@ -83,7 +83,7 @@
임대계약서 삭제
</button>
</span>
</span>
</div>
</div>
<!-- 업무 버튼 및 건수 표시 -->
@ -123,6 +123,7 @@
</thead>
<template name="tmpltCols">
<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: 160px;">업무구분</th>
<th class="cmn" style="width: 180px;" onclick="FimsSupport.searchFromGridTitle('CRDN_YMD', this.innerText, 'ymd', '');">단속일시</th>
@ -145,9 +146,9 @@
<tbody name="tbodyList">
</tbody>
<template is="curly-brackets" name="tmpltRows">
<tr data-key="CRDN_ID">
<tr data-index="DATA-INDEX">
<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="CRDN_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-center" onclick ondblclick>{TASK_SE_NM}</td>
<td class="cmn text-center" onclick ondblclick>{CRDN_YMD_TM}</td>
<td class="cmn text-start" onclick ondblclick>{VHRNO}</td>
@ -188,6 +189,8 @@
<!-- / inner page html <div class="content-wrapper"> -->
<script>
LoadScript("rent02010Script",wctx.url("/webjars/js/fims/rent/rent02010.js?ver=${ver}"));
/**************************************************************************
* Global Variable
**************************************************************************/
@ -197,124 +200,26 @@
* script 진입
**************************************************************************/
$(document).ready(function() {
// pageObject
let $P = pageObject["${pageName}"];
// FormFields
$P.formFields = new FimsFormFields($P.selectorn("frmSearch"));
/**************************************************************************
* DatasetControl
* pageObject
**************************************************************************/
$P.ctrl = new DatasetControl({
prefix: "lsct"
, prefixName: "임대차계약"
, keymapper: info => info ? info.CRDN_ID : ""
, dataGetter: obj => obj["List"]
, appendData: true
, infoSize: "xl"
, urls: {
load: wctx.url("${prefixUrl}" + "/010/list.do") // 임대차계약 검색
, remove: wctx.url("${prefixUrl}" + "/010/remove.do") // 임대차계약 삭제
, getInfo: wctx.url("${prefixUrl}" + "/020/info.do") // 임대차계약 상세 정보
}
, formats: {
CRDN_YMD_TM: datetimeFormat
, FFNLG_CRDN_AMT: numberFormat
, REG_DT: datetimeFormat
, MDFCN_DT: datetimeFormat
}
});
// 검색 조건
$P.ctrl.query = { pageNum: 1, fetchSize: DEFAULT_FETCH_SIZE }; // 1 페이지당 자료 건수 index.jsp에서 확인
/**************************************************************************
* DatasetControl 이벤트
**************************************************************************/
// Dataset 변경 이벤트
$P.ctrl.onDatasetChange = (obj, option) => {
let activeTab = $P.$findn("tabMain").find("button.active").text().trim();
$P.renderList(obj["Total"], option, activeTab);
// 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.CRDN_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;
let $P = pageObject["${pageName}"];
ajax.post({
url: $P.ctrl.urls.remove
, data: params || {}
, success: (resp) => { $P.ctrl.onRemove(params, resp); }
// formFields
$P.formFields = new FimsFormFields($P.selectorn("frmSearch"));
// paging
$P.pagingSupport = new FimsPagingSupport({
doq: $P
, linkContainer: "[name='dataPaging']"
});
}
// datasetControl
$P.ctrl = newRent02010Control($P, "${pageName}", "[data-doctx=${pageName}]");
/**************************************************************************
* DataTable 이벤트
**************************************************************************/
// DataTable에 click, dbclick 이벤트
$P.renderList = (totalSize, option, tabTitle) => {
$P.renderList = (obj, option) => {
// 데이터 셋
let dataList = $P.ctrl.dataset;
let empty = dataList.empty;
@ -329,20 +234,23 @@
});
let replacer = (str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].dataTableClick('" + dataItem.getValue("CRDN_ID") + "');")
.replace(/{ondblclick}/gi, "pageObject['${pageName}'].dataTableDblClick('" + dataItem.getValue("CRDN_ID") + "');");
.replace(/{onclick}/gi, "pageObject['${pageName}'].dataTableClick('{DATA-INDEX}');")
.replace(/{ondblclick}/gi, "pageObject['${pageName}'].dataTableDblClick('{CRDN_ID}');");
let trs = empty ?
[$P.findn("tmpltNotFound").content.querySelector(".cmn").outerHTML]
: dataList.inStrings(foundTr.outerHTML, replacer);
let noMore = (dataList.length >= totalSize);
let noMore = (dataList.length >= obj["Total"]);
let initScroll = ($P.ctrl.query.pageNum < 2);
if (option != null && option.reloaded) {
initScroll = false;
}
// pagingInfo
$P.pagingSupport.setPagingInfo(obj);
$P.findn("tableRspns").changeContent(trs.join(), initScroll, noMore);
// checkbox 체크 해제
@ -357,27 +265,28 @@
GRID.checkbox.sync(element, bool);
let atLeastOne = GRID.checkbox.countChecked(element) > 0;
// 버튼
$P.$findn("btnRemove").prop("disabled", !atLeastOne);
Apply.toDataset.selection($P.ctrl.dataset, element, bool);
}
// dataTable 클릭 이벤트
$P.dataTableClick = (dataKey) => {
if (dataKey == "") return;
$P.dataTableClick = (dataIndex) => {
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 더블 클릭 이벤트
$P.dataTableDblClick = (dataKey) => {
let params = {
callPurpose: "update"
, mpngId: dataKey
, userId: $P.$findn("userId").val()
, schEntNo: $P.ctrl.getValue("ENT_NO")
, crdnId: dataKey
, lsctId: $P.ctrl.getValue("LSCT_ID")
};
$P.ctrl.getInfo(params);
@ -391,7 +300,11 @@
/**************************************************************************
* 사용자 함수(function)
**************************************************************************/
// URL 설정
$P.fnSetUrl = (prefixUrl) => {
$P.ctrl.urls.load = wctx.url(prefixUrl + "/010/list.do"); // 검색 url
$P.ctrl.urls.getInfo = wctx.url(prefixUrl + "/020/info.do"); // 상세 정보 url
}
/**************************************************************************
* 버튼 clickEvent
@ -418,6 +331,9 @@
$P.$findn("schCrdnYmdTo").datepicker("setDate", TODAY()); // 단속 일자 종료
$P.$findn("schVhrno").val("167하9750"); // 차량번호
// URL 설정
$P.fnSetUrl("${prefixUrl}");
// dataset 초기화
$P.ctrl.dataset.clear();
@ -434,7 +350,7 @@
// 검색 버튼 이벤트
$P.fnSearchList = (tabName) => {
// 검색조건
// 검색 조건
$P.ctrl.query = $P.formFields.get(); // 검색 조건
$P.ctrl.query.fetchSize = DEFAULT_FETCH_SIZE; // 한번에 조회되는 자료 건수
$P.ctrl.query.delYn = "N"; // 삭제 여부

@ -0,0 +1,151 @@
function newRent02010Control(pageObj, pageName, doctx="[data-doctx='rent02010']") {
let ctrl = new DatasetControl({
doctx: doctx
, prefix: "lsct"
, prefixName: "임대차계약"
, dataGetter: obj => obj["List"]
, keys: ["CRDN_ID"]
, appendData: true
, infoSize: "xl"
, urls: {
load: "/list.do"
, getInfo: "/info.do"
, create: "/create.do"
, update: "/update.do"
, remove: "/remove.do"
}
, formats: {
CRDN_YMD_TM: datetimeFormat
, FFNLG_CRDN_AMT: numberFormat
, REG_DT: datetimeFormat
, MDFCN_DT: datetimeFormat
}
});
// 검색 조건
ctrl.query = { pageNum: 1, fetchSize: DEFAULT_FETCH_SIZE }; // 1 페이지당 자료 건수 index.jsp에서 확인
// paging
pagingSupport = new FimsPagingSupport({
doq: pageObj
, linkContainer: "[name='dataPaging']"
});
/**************************************************************************
* DatasetControl Events
**************************************************************************/
// Dataset 변경 이벤트
ctrl.onDatasetChange = (obj, option) => {
// pageObj.renderList(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('{CRDN_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);
// 보안모드
fn_securityModeToggle($("#securityMode--top").is(":checked"));
};
// 현재 선택 자료 변경 이벤트
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