업무지원 - 민원상담 수정.

main
JoJH 1 week ago
parent fad222608c
commit 5fbdb0a397

@ -1,23 +1,23 @@
<%@ 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>
<c:set var="prefixName" scope="request">민원상담</c:set>
<!-- inner page html -->
<div class="content-wrapper">
<div class="content-wrapper" data-doctx="${pageName}">
<!-- Content -->
<div class="container-xxl flex-grow-1 px-0">
<div class="card wrapper-list">
<!-- 상단 버튼 -->
<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>
<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 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>
</span>
@ -25,16 +25,15 @@
<!-- 상단 버튼 -->
<!-- 검색 조건 영역 -->
<form id="frmSearch--${pageName}" name="frmSearch">
<form name="frmSearch">
<!-- hidden -->
<input type="hidden" id="sggCd--${pageName}" name="sggCd" />
<input type="hidden" name="sggCd" />
<!-- 메인 조건 -->
<div class="container-search">
<div class="row g-1">
<!-- 업무구분 -->
<div class="col-12">
<span class="form-label fw-bold form-search-title w-px-120 text-end">업무구분</span>
<span class="form-label form-search-title w-px-120 text-end fw-bold">업무구분</span>
<span class="form-search-linebox">
<c:forEach items="${taskListForSgg}" var="item">
<label>
@ -45,75 +44,71 @@
</c:forEach>
</span>
</div>
<!-- 상담일자 -->
<div class="col-6">
<label class="form-label fw-bold form-search-title w-px-120 text-end" for="schDscsnYmdFrom--${pageName}">상담일자</label>
<label class="form-label form-search-title w-px-120 text-end fw-bold">상담일자</label>
<span class="form-search-linebox">
<input type="text" class="form-control form-date" id="schDscsnYmdFrom--${pageName}" name="schDscsnYmdFrom"
<input type="text" class="form-control form-date" name="schDscsnYmdFrom"
data-fmt-type="day" autocomplete="off" title="시작 날짜 선택" />
<button type="button" class="bx bx-lg bx-calendar bg-white"></button>
~
<input type="text" class="form-control form-date" id="schDscsnYmdTo--${pageName}" name="schDscsnYmdTo"
<input type="text" class="form-control form-date" name="schDscsnYmdTo"
data-fmt-type="day" autocomplete="off" title="종료 날짜 선택" />
<button type="button" class="bx bx-lg bx-calendar bg-white"></button>
</span>
</div>
<!-- 차량번호 -->
<div class="col-6">
<label class="form-label fw-bold form-search-title w-px-120 text-end" for="schVhrno--${pageName}">차량번호</label>
<input type="text" class="form-control w-px-160" id="schVhrno--${pageName}" name="schVhrno" autocomplete="off" />
<label is="name-label" class="form-label form-search-title w-px-120 text-end fw-bold" for="schVhrno">자동차등록번호</label>
<input is="id-input" type="text" class="form-control w-px-160" name="schVhrno" autocomplete="off" />
</div>
<!-- 민원인명 -->
<div class="col-6">
<label class="form-label fw-bold form-search-title w-px-120 text-end" for="schCvlprNm--${pageName}">민원인명</label>
<input type="text" class="form-control w-px-160" id="schCvlprNm--${pageName}" name="schCvlprNm"autocomplete="off" />
<label is="name-label" class="form-label form-search-title w-px-120 text-end fw-bold" for="schCvlprNm">민원인명</label>
<input is="id-input" type="text" class="form-control w-px-160" name="schCvlprNm" autocomplete="off" />
</div>
<!-- 동적검색 -->
<div class="col-6">
<input type="hidden" id="by--${pageName}" name="by" />
<input type="text" class="form-control fw-bold w-px-120 text-end" id="byOutput--${pageName}" value="동적 검색" readonly />
<input type="hidden" id="mainOption--${pageName}" name="mainOption" />
<input type="hidden" id="subOption--${pageName}" name="subOption" />
<input type="text" class="form-control w-px-400" id="term--${pageName}" name="term" autocomplete="off" />
<input type="hidden" name="by" />
<input type="text" class="form-control w-px-120 text-end fw-bold" name="byOutput" value="동적 검색" readonly />
<input type="hidden" name="mainOption" />
<input type="hidden" name="subOption" />
<input type="text" class="form-control w-px-400" name="term" autocomplete="off" />
<!-- 상세 검색조건 버튼 -->
<span class="flr">
<button type="button" class="btn btn-open-detail" data-bs-toggle="collapse" data-bs-target="#searchDetail--${pageName}">
<button type="button" class="btn btn-open-detail" data-bs-toggle="collapse" data-bs-target="[data-doctx='${pageName}'] [name='searchDetail']">
<i class="bx bx-chevron-down"></i>
상세검색
</button>
</span>
</div>
</div> <!-- 동적검색 -->
</div>
</div> <!-- 메인 조건 -->
<!-- 상세 조건 -->
<div id="searchDetail--${pageName}" class="container-search container-search-detail collapse">
<div name="searchDetail" class="container-search container-search-detail collapse">
<div class="row g-1">
<!-- 등록일자, 수정일자 -->
<div class="col-6">
<select class="form-select w-px-120 text-center" id="schRegDateOpt--${pageName}" name="schRegDateOpt">
<select class="form-select w-px-120 text-center" name="schRegDateOpt">
<option value="regDt">등록일자</option>
<option value="mdfcnDt">수정일자</option>
</select>
<span class="form-search-linebox">
<input type="text" class="form-control form-date" id="schRegDateFrom--${pageName}" name="schRegDateFrom"
data-fmt-type="day" title="시작 날짜 선택" />
<input type="text" class="form-control form-date" name="schRegDateFrom"
data-fmt-type="day" autocomplete="off" title="시작 날짜 선택" />
<button type="button" class="bx bx-lg bx-calendar bg-white"></button>
~
<input type="text" class="form-control form-date" id="schRegDateTo--${pageName}" name="schRegDateTo"
data-fmt-type="day" title="종료 날짜 선택">
<input type="text" class="form-control form-date" name="schRegDateTo"
data-fmt-type="day" autocomplete="off" title="종료 날짜 선택">
<button type="button" class="bx bx-lg bx-calendar bg-white"></button>
</span>
</div>
<!-- 등록자명, 수정자명 -->
<div class="col-6">
<select class="form-select w-px-120 text-center" id="schRgtrOpt--${pageName}" name="schRgtrOpt">
<select class="form-select w-px-120 text-center" name="schRgtrOpt">
<option value="rgtr">등록자</option>
<option value="mdfr">수정자</option>
</select>
<input type="hidden" id="schRgtrCd--${pageName}" name="schRgtrCd" />
<input type="text" class="form-control w-px-160" id="schRgtrNm--${pageName}" name="schRgtrNm" />
<button type="button" class="btn btn-sm btn-outline-dark" id="btnFindUser--${pageName}" title="사용자 검색">검색</button>
<input type="hidden" name="schRgtrCd" />
<input type="text" class="form-control w-px-160" name="schRgtrNm" />
<button type="button" class="btn btn-sm btn-outline-dark" name="btnFindUser" title="사용자 검색">검색</button>
</div>
</div>
</div> <!-- 상세 조건 -->
@ -122,20 +117,20 @@
<!-- 업무 버튼 및 건수 표시 -->
<div>
<span class="container-page-btn">
<span class="container-page-btn" name="gridButtonArea">
<!-- 건수, 페이지 표시 -->
<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}">
<span is="paging-info" class="dataTables_info" name="dataPagingInfo" role="status" aria-live="polite"></span>
<ul class="pagination pagination-primary" name="dataPaging">
</ul>
</div>
<!-- 업무 버튼 -->
<span class="container-window-btn-right">
<button type="button" class="btn btn-primary w-px-120" id="btnUpdate--${pageName}" title="민원상담내용 수정">
상담내용 수정
<button type="button" class="btn btn-primary w-px-120" name="btnUpdate" 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" name="btnRemove" title="민원상담내용 삭제">
민원상담내용 삭제
</button>
</span>
</span>
@ -144,14 +139,13 @@
<!-- 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-500" 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">
<div class="dataTables_wrapper dt-bootstrap5 no-footer">
<div class="table-responsive ox-scroll oy-scroll h-px-400" name="tableRspns">
<table class="table-layout-fixed dataTable datatables-ajax table table-bordered no-footer" 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}">
<tr name="theadTr" data-search-target="[data-doctx='${pageName}']">
<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: 120px;" onclick="FimsSupport.searchFromGridTitle('CVLCPT_RCPT_SE_CD', this.innerText, 'codeValue', 'FIM065');">민원접수구분</th>
<th class="cmn" style="width: 120px;" onclick="FimsSupport.searchFromGridTitle('DSCSN_YMD', this.innerText, 'ymd', '');">상담일자</th>
<th class="cmn" style="width: 80px;" onclick="FimsSupport.searchFromGridTitle('WEEK_NM', this.innerText, 'match', 'part');">요일</th>
@ -167,12 +161,13 @@
<th class="cmn dummy-th"></th>
</tr>
</thead>
<tbody id="tbody--${pageName}">
<tbody name="tbodyList">
</tbody>
<template id="${infoPrefix}Row--${pageName}">
<tr data-key="{CVLCPT_DSCSN_ID}">
<template is="curly-brackets" name="tmpltRows">
<tr data-index="{data-index}">
<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="{CVLCPT_DSCSN_ID}" onchange="pageObject['${pageName}'].control.select('{CVLCPT_DSCSN_ID}', 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="{onclick}" ondblclick="{ondblclick}">{CVLCPT_RCPT_SE_NM}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{DSCSN_YMD}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{WEEK_NM}</td>
@ -188,7 +183,7 @@
<td class="cmn dummy-td"></td>
</tr>
</template>
<template id="${infoPrefix}NotFound--${pageName}">
<template name="tmpltNotFound">
<tr class="odd">
<td valign="top" colspan="15" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td>
</tr>
@ -207,10 +202,12 @@
<!-- / inner page html <div class="content-wrapper"> -->
<script>
LoadScript("sprt04010Script", wctx.url("/webjars/js/fims/sprt/sprt04010.js?ver=${ver}"));
/**************************************************************************
* Global Variable
**************************************************************************/
pageObject["${pageName}"] = {};
pageObject["${pageName}"] = newDoctxFinder("${pageName}");
/**************************************************************************
* script 진입
@ -219,199 +216,94 @@
// pageObject
let $P = pageObject["${pageName}"];
// FormFields
$P.formFields = new FimsFormFields("#frmSearch--${pageName}");
/**************************************************************************
* DatasetControl
**************************************************************************/
$P.control = new DatasetControl({
prefix: "cvlcptDscsn"
, prefixName: "민원상담"
, keymapper: info => info ? info.CVLCPT_DSCSN_ID : ""
, dataGetter: obj => obj.${infoPrefix}List
, appendData: true
, infoSize: "lg"
, formats: {
DSCSN_YMD: dateFormat
, REG_DT: datetimeFormat
, MDFCN_DT: datetimeFormat
}
// URL
$P.prefixUrl = "${prefixUrl}"
// datasetControl
$P.ctrl = newSprt04010Control("${pageName}", "[data-doctx=${pageName}]");
// paging
$P.pagingSupport = new FimsPagingSupport({
ctrl: $P.ctrl // DatasetControl
, ignoreCtrlPrefix: true // ctrl.prefix 가 있더라도 무시
, linkContainer: "[name='dataPaging']" // <ul class="pagination pagination-primary" name="dataPaging">
});
// $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 이벤트
* DataTables 이벤트
**************************************************************************/
// 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;
let key = item.data.CVLCPT_DSCSN_ID;
$("#tbody--${pageName}").setCurrentRow(key);
};
// 선택(체크) 변경 이벤트
$P.control.onSelectionChange = selected => {
let ${infoPrefix}List = $P.control.dataset;
let keys = selected.map(e => ${infoPrefix}List.getKey(e));
$("#tbody--${pageName} input[type='checkbox']").each(function() {
let checkbox = $(this);
checkbox.prop("checked", keys.includes(checkbox.val()));
});
$("#btnRemove--${pageName}").prop("disabled", keys.length < 1);
// dataTable 체크박스 클릭 이벤트
$P.dataTableCheckbox = (element, bool) => {
GRID.checkbox.sync(element, bool);
// 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); // 체크 해제
}
};
let atLeastOne = GRID.checkbox.countChecked(element) > 0;
// 상세정보 dialog
$P.control.getInfo = (params) => {
if (!params) return;
let dialogTitle = "";
if (params.callPurpose == "create") {
dialogTitle = $P.control.prefixName + " 등록";
} else if (params.callPurpose == "update") {
dialogTitle = $P.control.prefixName + " 수정";
} else {
dialogTitle = $P.control.prefixName + " 정보";
}
$P.$findn("btnRemove").prop("disabled", !atLeastOne);
ajax.get({
url: wctx.url("/" + params.taskSeCd + "${infoPrefixUrl}" + "/020/info.do") + "?openerPageName=${pageName}"
, data: params || {}
, success: resp => {
dialog.open({
id: $P.control.prefixed("Dialog--${pageName}")
, title: dialogTitle
, content: resp
, size: $P.control.infoSize
, onClose: () => { $P.fnRefreshList(); } // 자료 재조회
});
Apply.toDataset.selection($P.ctrl.dataset, element, bool);
}
});
}
// 삭제 callback
$P.control.onRemove = (resp) => {
let btnTitle = $("#btnRemove--${pageName}").attr("title");
let showMessage = resp.rtnMsg.replace(/[S]|[F]/g, btnTitle);
// 메시지 출력
dialog.alert({
content: showMessage
, onOK: () => { }
});
// dataTable 클릭 이벤트
$P.dataTableClick = (dataIndex) => {
if (!dataIndex) return;
if (resp.saved) { $P.fnRefreshList(); } // 자료 재조회
}
// 삭제
$P.control.remove = (params) => {
if (!params) return;
$P.$findn("tbodyList").setCurrentRow(dataIndex);
ajax.post({
url: wctx.url("/" + params.taskSeCd + "${infoPrefixUrl}" + "/010/remove.do")
, data: params || {}
, success: resp => $P.control.onRemove(resp)
});
Apply.toDataset.current($P.ctrl.dataset, dataIndex);
}
/**************************************************************************
* 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("CVLCPT_DSCSN_ID") + "');")
.replace(/{ondblclick}/gi, "pageObject['${pageName}'].fnUpdate('민원상담 수정');")
);
let noMore = (${infoPrefix}List.length >= totalSize);
let initScroll = ($P.control.query.pageNum < 2) ;
if(option != null && option.reloaded){
initScroll = false;
}
// dataTable 더블 클릭 이벤트 - 개별총정보 dialog
$P.dataTableDblClick = (dataIndex) => {
if (!dataIndex) return;
$("#table-responsive--${pageName}")[0].changeContent(trs.join(), initScroll, noMore);
// 민원상담 ID 가 없다면.. 입력
let cvlcptDscsnId = $P.ctrl.getValue("CVLCPT_DSCSN_ID");
if (!cvlcptDscsnId) return;
// checkbox 체크 해제
$("#DataTables_Table_0--${pageName} th input[type='checkbox']").prop("checked", false);
let params = {
btnTitle: $P.ctrl.prefixName + " 상세 정보"
, callPurpose: "update"
, sggCd: $P.ctrl.getValue("SGG_CD") // 시군구 코드
, taskSeCd: $P.ctrl.getValue("TASK_SE_CD") // 업무 구분 코드
, cvlcptDscsnId: $P.ctrl.getValue("CVLCPT_DSCSN_ID") // 민원상담 ID
};
//보안모드
fn_securityModeToggle($("#securityMode--top").is(":checked"));
$P.ctrl.getInfo(params);
}
// DataTables에 스크롤이 맨 밑으로 이동했을 때 이벤트
$P.scrollDataList = () => {
$P.control.load($P.control.query.pageNum + 1);
$P.ctrl.load($P.ctrl.query.pageNum + 1);
}
/**************************************************************************
* 사용자 함수(function)
**************************************************************************/
// 검색 자료 재조회
$P.fnRefreshList = () => {
$P.control.reload({all : true});
// 업무구분에 따른 URL 설정
$P.fnSetURL = (taskSeCd) => {
$P.ctrl.urls.load = wctx.url("/" + taskSeCd + $P.prefixUrl + "/010/list.do"); // 검색
$P.ctrl.urls.remove = wctx.url("/" + taskSeCd + $P.prefixUrl + "/010/remove.do"); // 삭제
$P.ctrl.urls.getInfo = wctx.url("/" + taskSeCd + $P.prefixUrl + "/020/info.do"); // 상세 정보
}
// 사용자검색 callback
$P.callbackFindUser = (userId, userNm) => {
$("#schRgtrCd--${pageName}").val(userId); // 사용자 ID
$("#schRgtrNm--${pageName}").val(userNm); // 사용자 명
$P.$findn("schRgtrCd").val(userId); // 사용자 ID
$P.$findn("schRgtrNm").val(userNm); // 사용자 명
}
// 삭제사유 callback
$P.callbackRsn = (obj) => {
// 서버에 전송할 data(파라미터) 생성
let params = {};
let selected = $P.control.dataset.getKeys("selected");
let selected = $P.ctrl.getDataset("selected"); // 선택 자료
params[$P.control.prefixed("Ids")] = selected.join(","); // Ids
params.sggCd = $("#sggCd--${pageName}").val(); // 시군구 코드
params.taskSeCd = $("#frmSearch--${pageName} input[name='taskSeCd']:checked").val(); // 업무 구분 코드
params.delRsn = obj.reason; // 삭제 사유
// 서버에 전송할 data(파라미터) 생성
let params = {
sggCd: $P.$findn("sggCd").val() // 시군구 코드
, taskSeCd: $P.$findn("frmSearch").find("[name='taskSeCd']:checked").val() // 업무 구분 코드
, cvlcptDscsnIds: selected.map(info => info.CVLCPT_DSCSN_ID).join(",") // 민원 상담 IDs
, btnTitle: obj.btnTitle // 버튼 title
, delRsn: obj.reason // 삭제 사유
};
$P.control.remove(params);
$P.ctrl.remove(params);
}
/**************************************************************************
@ -420,36 +312,52 @@
// 업무 구분 변경 이벤트
$P.fnResetAndChangeBiz = (taskSeCd) => {
// 업무 구분 코드
if (typeof taskSeCd == "undefined" || taskSeCd == null || taskSeCd == "") {
if (!taskSeCd) {
taskSeCd = $("#layout-navbar input[name='taskSeCd']:checked").val();
}
// 초기 기본 설정
$P.initForm(taskSeCd);
// 업무 구분별 설정
$P.setTask(taskSeCd);
// 초기화
$P.fnReset(taskSeCd);
// dataset 초기화
$P.control.dataset.clear();
$P.ctrl.dataset.clear();
// 업무 구분에 따른 URL 설정
$P.fnSetURL(taskSeCd);
// 최고 관리자인지 권한을 확인하여 업무구분을 선택할 수 있도록 하자 -> 수정 필요
$P.$findn("frmSearch").find("input[name='taskSeCd']").each(function(i) {
$(this).prop("disabled", "true");
});
FimsSupport.renderForTask($P.findn("frmSearch"), taskSeCd.toLowerCase()); // 업무별 검색 조건
FimsSupport.renderForTask($P.findn("gridbuttonArea"), taskSeCd.toLowerCase()); // 업무별 버튼
}
// 사용자검색 버튼 클릭 이벤트
$P.fnGetFindUser = () => {
let params = {
openerPageName: "${pageName}"
, callbackFuncName: "pageObject['${pageName}']['callbackFindUser']"
callbackFuncName: "pageObject['${pageName}']['callbackFindUser']"
}
ajax.get({
url: wctx.url("/user/user02/010/main.do") + "?openerPageName=${pageName}"
url: wctx.url("/user/user02/010/main.do")
, data: params || {}
, success: resp => {
, success: (resp) => {
let dialogName = "userDialog";
let dialogId = dialogName + "-" + uuid();
dialog.open({
id: "userDialog--${pageName}"
id: dialogId
, title: "사용자 검색"
, content: resp
, size: "lg"
, init: () => { AppSupport.setDialogZindex(); }
, content: resp
, init: () => {
$("#" + dialogId).attr("name", dialogName);
$("#" + dialogId).attr("data-ref-doctx", "${pageName}");
AppSupport.setDialogZindex();
}
, onClose: () => { }
});
}
});
@ -457,60 +365,62 @@
// 검색 버튼 이벤트
$P.fnSearchList = () => {
// validate 확인
if (!AppSupport.customValidate($P.$findn("frmSearch").find("input,select,textarea"))) return;
// 검색조건
$P.control.query = $P.formFields.get(); // 검색 조건
$P.control.query.fetchSize = $P.control.defaultFetchSize; // 한번에 조회되는 자료 건수
$P.control.query.delYn = "N"; // 삭제 여부
$P.ctrl.query = new FimsFormFields($P.selectorn("frmSearch")).get(); // 검색 조건
$P.ctrl.query.fetchSize = DEFAULT_FETCH_SIZE; // 한번에 조회되는 자료 건수
$P.ctrl.query.delYn = "N"; // 삭제 여부
$P.control.load(1);
$P.ctrl.load(1);
}
// 엑셀 버튼 이벤트
$P.fnExcel = () => {
if ($P.control.dataset.empty) {
if ($P.ctrl.dataset.empty) {
dialog.alert({
content: "검색된 자료가 없습니다."
, init: () => { AppSupport.setDialogZindex(); }
, onOK: () => { }
});
return;
}
// DataTables(그리드)
let cellDefs = AppSupport.getCellDefs($("#theadTr--${pageName} th").not(".dummy-th").not(":eq(0)")
, $($("#${infoPrefix}Row--${pageName}")[0].content).find("td").not(".dummy-td").not(":eq(0)")
$P.ctrl.query.cellDefs =
AppSupport.getCellDefs($P.$findn("theadTr").find("th").not(".dummy-th").not(":eq(0)")
, $($P.findn("tmpltRows").content).find("td").not(".dummy-td").not(":eq(0)")
, FimsSupport.getCellDefsForPrivacyCell);
$P.control.query.cellDefs = cellDefs;
$P.control.download();
$P.ctrl.download();
}
// 수정 버튼 이벤트
$P.fnUpdate = (title) => {
// 민원상담 ID
let cvlcptDscsnId = $P.control.dataset.getValue("CVLCPT_DSCSN_ID");
// 민원상담 수정 버튼 이벤트
$P.fnUpdate = (btnTitle) => {
// 민원상담 ID 가 없다면.. 입력
if (typeof cvlcptDscsnId == "undefined" || cvlcptDscsnId == null || cvlcptDscsnId == "") return;
let cvlcptDscsnId = $P.ctrl.getValue("CVLCPT_DSCSN_ID");
if (!cvlcptDscsnId) return;
let params = {
title: title
btnTitle: btnTitle
, callPurpose: "update"
, sggCd: $P.control.dataset.getValue("SGG_CD") // 시군구 코드
, taskSeCd: $P.control.dataset.getValue("TASK_SE_CD") // 업무 구분 코드
, cvlcptDscsnId: cvlcptDscsnId // 민원상담 ID
, sggCd: $P.ctrl.getValue("SGG_CD") // 시군구 코드
, taskSeCd: $P.ctrl.getValue("TASK_SE_CD") // 업무 구분 코드
, cvlcptDscsnId: $P.ctrl.getValue("CVLCPT_DSCSN_ID") // 민원상담 ID
};
$P.control.getInfo(params);
$P.ctrl.getInfo(params);
}
// 삭제 버튼 이벤트
$P.fnRemove = (title) => {
// 선택 자료
let selected = $P.control.dataset.getKeys("selected");
// 민원상담 삭제 버튼 클릭 이벤트
$P.fnRemove = (btnTitle) => {
let selected = $P.ctrl.getDataset("selected"); // 선택 자료
if (selected.length < 1) {
dialog.alert({
content: "선택하신 " + $P.control.prefixName + " 정보가 없습니다."
content: "선택하신 " + $P.ctrl.prefixName + " 정보가 없습니다."
, init: () => { AppSupport.setDialogZindex(); }
, onOK: () => { }
});
return;
@ -518,7 +428,7 @@
// 삭제 메세지 확인
dialog.alert({
content: "선택하신 " + selected.length + "건의 " + $P.control.prefixName + " 정보를 삭제하시겠습니까?"
content: "선택하신 " + selected.length + "건의 " + $P.ctrl.prefixName + " 정보를 삭제하시겠습니까?"
, onOK: () => {
// 삭제 사유 입력
fetch(wctx.url("/webjars/html/inputRsnDialog.html"))
@ -526,12 +436,15 @@
.then(function(template) {
dialog.open({
id: "inputDelRsnDialog"
, title: title
, title: "삭제 사유"
, size: "lg"
, content: template
, init: () => { AppSupport.setDialogZindex(); }
, onOK: () => {
$P.callbackRsn({ reason: $("#reason").val() });
$P.callbackRsn({
btnTitle: btnTitle // 버튼 title
, reason: $("#reason").val() // 삭제 사유
});
}
});
});
@ -545,76 +458,53 @@
// 이벤트 설정
$P.setEvent = () => {
// 기본 버튼 이벤트
$("#btnReset--${pageName}").on("click", () => $P.fnResetAndChangeBiz()); // 초기화
$("#btnSearch--${pageName}").on("click", () => $P.fnSearchList()); // 검색
$("#btnExcel--${pageName}").on("click", () => $P.fnExcel()); // 엑셀
$("#btnFindUser--${pageName}").on("click", () => $P.fnGetFindUser()); // 사용자 검색
$P.$findn("btnReset").on("click", () => { $P.fnResetAndChangeBiz() }); // 초기화
$P.$findn("btnSearch").on("click", () => { $P.fnSearchList() }); // 검색
$P.$findn("btnExcel").on("click", () => { $P.fnExcel() }); // 엑셀
$P.$findn("btnFindUser").on("click", () => $P.fnGetFindUser()); // 사용자 검색
// 동적검색에서 엔터(Enter) 키를 누르면 검색한다.
$("#term--${pageName}").onEnterPress(function() {
$P.fnSearchList();
});
// 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);
}
});
});
$P.$findn("term").onEnterPress($P.fnSearchList);
// 버튼 이벤트
$("#btnUpdate--${pageName}").on("click", function() {
$P.fnUpdate($(this).attr("title")); // 민원상담 수정
// 업무 버튼 이벤트
$P.$findn("btnUpdate").on("click", function() {
$P.fnUpdate($P.$findn("btnUpdate").attr("title")); // 수정
});
$("#btnRemove--${pageName}").on("click", function() {
$P.fnRemove($(this).attr("title")); // 민원상담 삭제
$P.$findn("btnRemove").on("click", function() {
$P.fnRemove($P.$findn("btnRemove").attr("title")); // 삭제
});
// DataTables width 변경 조정
Componentization.fnMakeResizableTable($("#table-responsive--${pageName}")[0]);
Componentization.fnMakeResizableTable($P.findn("tableRspns"));
// DataTables 스크롤 이벤트 생성
Componentization.fnMakeScrollableTable($("#table-responsive--${pageName}")[0], $P.scrollDataList);
Componentization.fnMakeScrollableTable($P.findn("tableRspns"), $P.scrollDataList);
}
// 초기 화면 설정
$P.initForm = (taskSeCd) => {
// 초기화 이벤트
$P.fnReset = (taskSeCd) => {
// 화면 초기화
$("#frmSearch--${pageName}")[0].reset();
$P.findn("frmSearch").reset();
// 달력 초기화
AppSupport.initDatepicker($P.findn("frmSearch"));
// 상세검색 버튼 화살표
AppSupport.initDetailSearchButton($P.findn("frmSearch"));
// input, select 초기화
let searchForm = $("#frmSearch--${pageName}");
let searchForm = $P.$findn("frmSearch");
searchForm.find("input[type='radio']").not("[name='taskSeCd']").prop("checked", false);
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); });
// 최고 관리자 경우 업무구분을 선택할 수 있도록 하자.
$("#frmSearch--${pageName} input[name='taskSeCd']").each(function(i) {
$(this).prop("disabled", "true");
});
// 기본 데이터 설정
$("#sggCd--${pageName}").val("${sggCd}"); // 시군구 코드
$("#frmSearch--${pageName} input[name='taskSeCd'][value='" + taskSeCd + "']").prop("checked", true); // 업무 구분 코드
AppSupport.initDatepicker("frmSearch--${pageName}"); // 달력 초기화
$("#schDscsnYmdFrom--${pageName}").datepicker("setDate", DateSupport.getAddDay(-7));
$("#schDscsnYmdTo--${pageName}").datepicker("setDate", new Date());
$("#byOutput--${pageName}").val("동적 검색"); // 동적 검색
$("#schRgtrNm--${pageName}").prop("readonly", true); // 사용자 이름
}
// 업무 구분별 설정
$P.setTask = (taskSeCd) => {
// 업무구분에 따른 URL 설정
$P.control.urls.load = wctx.url("/" + taskSeCd + "${infoPrefixUrl}" + "/010/list.do"); // 조회
$P.$findn("sggCd").val("${sggCd}"); // 시군구 코드
$P.$findn("frmSearch").find("input[name='taskSeCd'][value='" + taskSeCd + "']").prop("checked", true); // 업무 구분 코드
$P.$findn("schDscsnYmdFrom").datepicker("setDate", DateSupport.getAddDay(-7)); // 부과 제외 일자 시작
$P.$findn("schDscsnYmdTo").datepicker("setDate", TODAY()); // 부과 제외 일자 종료
$P.$findn("byOutput").val("동적 검색"); // 동적 검색
$P.$findn("schRgtrNm").prop("readonly", true); // 사용자 이름
}
/**************************************************************************

@ -0,0 +1,130 @@
function newSprt04010Control(pageName, doctx="[data-doctx='sprt04010']") {
let ctrl = new DatasetControl({
doctx: doctx
, prefix: "cvlcptDscsn"
, prefixName: "민원상담"
, dataGetter: obj => obj["List"]
, keys: ["CVLCPT_DSCSN_ID"]
, appendData: true
, infoSize: "lg"
, urls: {
load: "/list.do"
, getInfo: "/info.do"
, remove: "/remove.do"
}
, formats: {
DSCSN_YMD: dateFormat
, REG_DT: datetimeFormat
, MDFCN_DT: datetimeFormat
}
});
// 검색 조건
ctrl.query = { pageNum: 1, fetchSize: DEFAULT_FETCH_SIZE }; // 1 페이지당 자료 건수 index.jsp에서 확인
/**************************************************************************
* DatasetControl Events
**************************************************************************/
// Dataset 변경 이벤트
ctrl.onDatasetChange = (obj, option) => {
// 데이터 셋
let dataList = ctrl.dataset;
let empty = dataList.empty;
let replacer = (str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['" + pageName + "'].dataTableClick('{data-index}');")
.replace(/{ondblclick}/gi, "pageObject['" + pageName + "'].dataTableDblClick('{data-index}');");
let trs = empty ?
[ctrl.find("[name='tmpltNotFound']").innerHTML]
: dataList.inStrings(ctrl.find("[name='tmpltRows']").innerHTML, replacer);
let noMore = (dataList.length >= obj["Paging"]?.totalSize); // 전체 건수
let initScroll = (ctrl.query.pageNum < 2);
if (option != null && option.reloaded) {
initScroll = false;
}
// dataTables(그리드)에 자료 표시 td
ctrl.find("[name='tableRspns']").changeContent(trs.join(), initScroll, noMore);
// checkbox 체크 해제
$(ctrl.find("[name='gridAllCheckbox']")).prop("checked", false);
// dataTables(그리드)에 페이지 표시 pagingInfo
pageObject[pageName].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);
// gridButton
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: params.btnTitle
, 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, params.btnTitle);
// 메시지 출력
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