단속장비장소 정보 관리 메뉴 추가

master
김의진 1 month ago
parent 65c61e6440
commit 9576a3a148

@ -0,0 +1,428 @@
<%@ 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>
<div class="content-wrapper" data-doctx="${pageName}">
<!-- Page Body -->
<div id="DataTables_Table_0_wrapper"
class="dataTables_wrapper dt-bootstrap5 no-footer">
<div class="d-flex flex-row justify-content-between p-3">
<div class="d-flex flex-grow-1 me-5">
<div class="input-group me-3 w-px-400">
<select name="by"
onchange="ctrl.find('name', 'term').focus();"
class="form-select">
<option value="placeName">단속장소명</option>
<option value="eqplcCode">장비코드</option>
</select> <input name="term" autofocus type="text"
placeholder="조회 조건을 입력하십시오." class="form-control">
</div>
<label for="type"
class="form-label fw-bold px-3 d-flex flex-wrap align-content-center justify-content-center">업체구분</label>
<select name="type" class="form-select">
<option value="">전체</option>
<c:forEach items="${CMN009List}" var="item">
<option value="${item.code}">${item.value}</option>
</c:forEach>
</select>
</div>
<div>
<button type="button" name="btnSearch" class="btn btn-search w-px-120" title="검색">검색</button>
<button type="button" name="btnInsert" class="btn btn-primary w-px-120" title="추가">추가</button>
<button type="button" name="btnUpdate" class="btn btn-primary w-px-120" title="삭제">삭제</button>
</div>
</div>
<div name="table-responsive" class="table-responsive">
<table
class="datatables-ajax table table-bordered dataTable no-footer">
<thead name="eqplcThead">
<tr>
<th tabindex="0" style="width: 158.828px; text-align: center;"><input
onchange="ctrl.select(this.checked);"
type="checkbox" class="form-check-input"></th>
<th class="sorting" style="width: 146.156px;">ID</th>
<th class="sorting" style="width: 146.156px;">업체코드</th>
<th class="sorting" style="width: 146.156px;">장비코드</th>
<th class="sorting" style="width: 223.719px;">단속장소명</th>
<th class="sorting" style="width: 146.156px;">법정동명</th>
<th class="sorting" style="width: 146.156px;">도로명</th>
<th class="sorting" style="width: 195.688px;">단속장소</th>
<th class="sorting" style="width: 160.141px;">차선번호</th>
<th class="sorting" style="width: 230.469px;">차선방향</th>
<th class="sorting" style="width: 230.469px;">비고</th>
<th class="sorting" style="width: 230.469px;">등록일시</th>
<th class="sorting" style="width: 230.469px;">등록자</th>
</tr>
</thead>
<tbody name="eqplcTbody"></tbody>
<template is="curly-brackets" name=eqplcRow>
<tr data-index="DATA-INDEX">
<td style="text-align: center;"><input value="{EQPLC_CD}"
onchange="ctrl.select('{EQPLC_CD}', this.checked);"
type="checkbox" class="form-check-input"></td>
<td onclick ondblclick class="text-center">{EQPLC_CD}</td>
<td onclick ondblclick class="text-center">{CMPNY_CD}</td>
<td onclick ondblclick class="text-center">{EQP_CD}</td>
<td onclick ondblclick class="text-center">{PLC_NM}</td>
<td onclick ondblclick class="text-center">{STDG_NM}</td>
<td onclick ondblclick class="text-center">{ROAD_NM}</td>
<td onclick ondblclick class="text-center">{PLC}</td>
<td onclick ondblclick class="text-center">{LANE_NO}</td>
<td onclick ondblclick class="text-center">{DRCTN}</td>
<td onclick ondblclick class="text-center">{ETC_INFO}</td>
<td onclick ondblclick class="text-center">{REG_DT}</td>
<td onclick ondblclick class="text-center">{RGTR}</td>
</tr>
</template>
<template name="eqplcNotFound">
<tr><td valign="top" colspan="10" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td>
</tr>
</template>
</table>
</div>
<div class="d-flex flex-row p-3 justify-content-between">
<label name="eqplcPagingInfo" class="dataTables_info"
role="status" aria-live="polite"></label>
<ul name="eqplcPaging" class="pagination pagination-primary">
</ul>
</div>
</div>
</div>
<script>
LoadScript("eqplcScript",wctx.url("/resources/js/fims/eqplc/eqplc.js?ver=${ver}"));
/**************************************************************************
* Global Variable
**************************************************************************/
pageObject["${pageName}"] = newDoctxFinder("${pageName}");
$(document).ready(function(){
var $P = pageObject["${pageName}"];
/**************************************************************************
* DatasetControl, DatasetSupport, FormFields
**************************************************************************/
var ctrl = newEqplcControl($P);
ctrl.defaultFetchSize = FETCH_XS;
ctrl.query = { pageNum : 1, fetchSize : ctrl.defaultFetchSize };
ctrl.dataset.onDatasetChange = (obj, option) => {
var t = $P.getGridTemplate();
var trs = Apply.fromDataset.getTbody(ctrl.dataset, t.found, t.notFound, t.replacer);
$P.renderEqplcList(ctrl.dataset.totalSize = obj["Paging"]?.totalSize, ctrl.dataset.length, trs, option);
$P.pagingSupport.setPagingInfo(obj);
};
ctrl.dataset.onCurrentChange = (dataItem) => {
Apply.fromDataset.currentRow(ctrl.dataset, dataItem, $P.findn("eqplcTbody"));
}
ctrl.dataset.onSort = sorter => {
let t = $P.getGridTemplate(),
trs = Apply.fromDataset.getTbody(ctrl.dataset, t.found, t.notFound, t.replacer);
if (sorter.by)
$P.renderEqplcList(ctrl.dataset.totalSize, ctrl.dataset.length, trs);
document.querySelectorAll("div[data-doctx='${pageName}'] table[name='eqplcTable'] th[data-sort]").forEach(th => {
th.classList.remove(
TableSupport.cssClass.sortable,
TableSupport.cssClass.asc,
TableSupport.cssClass.desc
);
if (th.getAttribute("data-sort") == sorter.by)
th.classList.add(TableSupport.cssClass[sorter.order]);
else
th.classList.add(TableSupport.cssClass.sortable);
});
};
$P.pagingSupport = new FimsPagingSupport({
doq: $P,
linkContainer: "[name='eqplcPaging']"
});
/**************************************************************************
* pageObject.function
**************************************************************************/
$P.fnReset = () => {
var searchForm = $P.$findn("frmSearch");
searchForm.find("input[type='text']").val("");
searchForm.find("input[type='hidden']").val("");
ctrl.dataset.setData([]);
}
$P.getParams = () => {
var formFields = new FimsFormFields($P.selectorn("frmSearch"));
var data = formFields.get();
// data.taskSeCd = "BPV";
data.fetchSize = ctrl.defaultFetchSize;
return data;
}
$P.searchEqplcList = () => {
ctrl.query = $P.getParams();
ctrl.load(1);
}
$P.scrollEqplcList = () => {
ctrl.load(ctrl.query.pageNum + 1);
}
$P.refreshEqplcList = () => {
if (ctrl.query.pageNum == null)
ctrl.query.pageNum = 1;
ctrl.reload({all : true});
}
$P.fnExcelDown = () => {
if (ctrl.dataset.empty)
return alert("조회된 자료가 없습니다.");
var cellDefs = AppSupport.getCellDefs(
$P.$findn("eqplcTheadTr").find("th").not(".dummy-th").not(":eq(0)"),
$($P.findn("eqplcRow").content).find("td").not(".dummy-td").not(":eq(0)")
);
ctrl.query.cellDefs = cellDefs;
ctrl.download();
}
$P.getGridTemplate = () => {
var notFound = [$P.findn("eqplcNotFound").innerHTML];
var found = $P.findn("eqplcRow").innerHTML;
var replacer = (str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].clickEqplcList('{DATA-INDEX}');")
.replace(/{ondblclick}/gi, "pageObject['${pageName}'].dblclickEqplcList('{EXMPTN_VHCL_ID}');");
return {
found : found,
notFound : notFound,
replacer : replacer
};
}
$P.renderEqplcList = (total, listLength, trs, option) => {
let noMore = (listLength >= total);
let initScroll = (ctrl.query.pageNum < 2);
if (option != null && option.reloaded){
initScroll = false;
}
$P.findn("table-responsive").changeContent(trs, initScroll, noMore);
fn_securityModeToggle($("#securityMode--top").is(":checked"));
}
$P.clickEqplcList = (dataIndex) => {
if (!dataIndex) {
$P.$findn("btnOpenDelRsn").prop("disabled", true);
$P.$findn("btnHistory").prop("disabled", true);
return;
}
$P.$findn("btnOpenDelRsn").prop("disabled", ctrl.dataset.getData(dataIndex)["DEL_YN"] != "N");
$P.$findn("btnHistory").prop("disabled", false);
$P.$findn("eqplcTbody").setCurrentRow(dataIndex);
Apply.toDataset.current(ctrl.dataset, dataIndex);
}
$P.dblclickEqplcList = (dataKey) => {
if (!dataKey) return;
let dataItem = ctrl.dataset.getDataset("item").filter(item => item.data.EXMPTN_VHCL_ID == dataKey)[0];
var data = dataItem.data;
if (data.DEL_YN == "Y"){
dialog.alert({
content : "삭제된 자료입니다.",
init : function() {
AppSupport.focusClose();
}
});
return;
}
$P.getInfo({"eqplcId" : dataKey});
}
$P.getInfo = (param) => {
ajax.get({
url : ctrl.urls.getInfo,
data: param,
success:(resp) => {
let dialogName = "exmptnvhclDialog";
let dialogId = dialogName+"-"+uuid();
dialog.open({
id: dialogId,
title: "면제차량 수정",
content:resp,
size: "lg",
init:() => {
$("#"+dialogId).attr("name", dialogName);
$("#"+dialogId).attr("data-ref-doctx","${pageName}");
var parentRes = new Object();
var childReq = pageObject.childReq.pop();
for(var reqKey in childReq) {
if ($P.provide[reqKey]){
parentRes[reqKey] = $P.provide[reqKey];
} else {
parentRes[reqKey] = function(){};
}
}
pageObject.parentRes.push(parentRes);
}
});
}
});
};
$P.newInfo = () => {
ajax.get({
url : ctrl.urls.newInfo,
data: {},
success:(resp) => {
let dialogName = "exmptnvhclDialog";
let dialogId = dialogName+"-"+uuid();
dialog.open({
id: dialogId,
title: "면제차량 등록",
content:resp,
size: "lg",
init:() => {
$("#"+dialogId).attr("name", dialogName);
$("#"+dialogId).attr("data-ref-doctx","${pageName}");
var parentRes = new Object();
var childReq = pageObject.childReq.pop();
for(var reqKey in childReq) {
if ($P.provide[reqKey]){
parentRes[reqKey] = $P.provide[reqKey];
} else {
parentRes[reqKey] = function(){};
}
}
pageObject.parentRes.push(parentRes);
}
});
}
});
};
$P.fnOpenDelRsnDialog = () => {
fetch(wctx.url("/resources/html/inputRsnDialog.html"))
.then(function(resp) { return resp.text(); })
.then(function(template) {
let dialogName = "inputDelRsnDialog";
let dialogId = dialogName + "-" + uuid();
dialog.open({
id: dialogId
, title: "삭제 사유 입력"
, size: "lg"
, content: template
, init: () => {
$("#"+dialogId).attr("name", dialogName);
$("#"+dialogId).attr("data-ref-doctx","${pageName}");
AppSupport.setDialogZindex();
}
, onOK: () => {
$P.fnRemove($("#reason").val());
}
});
});
}
$P.fnRemove = (reason) => {
var dataKey = ctrl.dataset.getCurrent()["EXMPTN_VHCL_ID"];
ajax.get({
url : ctrl.urls.remove,
data : {
"eqplcId" : dataKey,
"delRsn" : reason
},
success : (resp) => {
if (resp.saved){
$P.refreshEqplcList();
}
}
});
};
$P.fnOpenHistory = () => {
var dataKey = ctrl.dataset.getCurrent()["EXMPTN_VHCL_ID"];
ajax.get({
url : wctx.url("/crdn/crdn08/030/list.do"),
data: { "eqplcId" : dataKey },
success:(resp) => {
let dialogName = "exmptnvhclHistoryDialog";
let dialogId = dialogName+"-"+uuid();
dialog.open({
id: dialogId,
title: "면제차량 이력",
content : resp,
size: "xxl",
init:() => {
}
});
}
});
}
$P.provide = {
"refreshList" : function(){
$P.refreshEqplcList();
}
}
$P.sortEqplcList = e => {
let col = e.getAttribute("data-sort");
ctrl.dataset.sort(col);
};
/**************************************************************************
* element.on
**************************************************************************/
$P.$findn("btnReset").on('click', () => $P.fnReset());
$P.$findn("btnSearch").on("click", () => $P.searchEqplcList());
$P.$findn("btnExcel").on('click', () => $P.fnExcelDown());
$P.$findn("btnCreate").on('click', () => { $P.newInfo(); });
$P.$findn("btnOpenDelRsn").on('click', () => { $P.fnOpenDelRsnDialog(); });
$P.$findn("btnHistory").on('click', () => { $P.fnOpenHistory(); });
document.querySelectorAll("div[data-doctx='${pageName}'] table[name='eqplcTable'] th[data-sort]").forEach(th => {
th.addEventListener('dblclick', () => $P.sortEqplcList(th));
});
Componentization.fnMakeScrollableTable($P.findn("table-responsive"), $P.scrollEqplcList);
Componentization.fnMakeResizableTable($P.findn("table-responsive"));
/**************************************************************************
* 초기화
**************************************************************************/
AppSupport.initDatepicker($P.findn("frmSearch")); //달력 초기화
$P.fnReset();
//보안모드
fn_securityModeToggle($("#securityMode--top").is(":checked"));
});
</script>

@ -0,0 +1,17 @@
function newEqplcControl(page, doctx = ""){
page.ctrl = new DatasetControl({
dataGetter : obj => obj["List"],
appendData:true,
keys : ["EQPLC_CD"],
urls : {
load : wctx.url("/eqplc/list.do"),
getInfo : wctx.url("/eqplc/info.do"),
insert : wctx.url("/eqplc/insert.do"),
update : wctx.url("/eqplc/update.do")
},
formats: {
REG_DT : datetimeFormat
}
});
return page.ctrl;
}
Loading…
Cancel
Save