개별총정보 - 민원상담 수정.

main
JoJH 1 week ago
parent 669ed9392d
commit fad222608c

@ -96,6 +96,7 @@
$P.callPurpose = "${callPurpose}";
// datasetControl
$P.ctrl = newExcl01020Control("${pageName}", "[data-doctx=${pageName}]");
//
$P.saveCallbackFuncName = "${saveCallbackFuncName}";
$P.savedCallbackFuncName = "${savedCallbackFuncName}";
@ -154,7 +155,7 @@
AppSupport.initDatepicker($P.findn("frmEdit"));
// 기본 데이터 설정
$P.$findn("levyExclYmd").datepicker("setDate", TODAY()); // 달력 초기화
$P.$findn("levyExclYmd").datepicker("setDate", TODAY()); // 부과 제외 일자
// 화면 호출(callPurpose)이 view라면 버튼 비활성화 disabled = true
if ($P.callPurpose == "view") {

@ -12,13 +12,13 @@
<label class="col-form-label bg-label-danger pe-2 w-px-120 text-sm-center">민원상담 이력</label>
<!-- 버튼 우측 정렬 -->
<span class="container-window-btn-right">
<button type="button" class="btn btn-primary w-px-120" name="btnCreateCvlcptDscsn" title="민원상담 등록">
<button type="button" class="btn btn-primary w-px-120" name="btnCreateCvlcptDscsn" title="민원상담 등록" disabled>
민원상담 등록
</button>
<button type="button" class="btn btn-primary w-px-120" name="btnUpdateCvlcptDscsn" title="민원상담 수정">
<button type="button" class="btn btn-primary w-px-120" name="btnUpdateCvlcptDscsn" title="민원상담 수정" disabled>
민원상담 수정
</button>
<button type="button" class="btn btn-primary w-px-120" name="btnRemoveCvlcptDscsn" title="민원상담 삭제">
<button type="button" class="btn btn-primary w-px-120" name="btnRemoveCvlcptDscsn" title="민원상담 삭제" disabled>
민원상담 삭제
</button>
</span> <!-- <span class="container-window-btn-right"> -->
@ -36,7 +36,7 @@
<div class="table-responsive ox-scroll oy-scroll h-px-400" name="tableRspnsCvlcptDscsn">
<table class="table-layout-fixed dataTable datatables-ajax table table-bordered no-footer" aria-describedby="DataTables_Table_0_info">
<thead class="sticky-thead">
<tr name="theadTrCvlcptDscsn">
<tr name="theadTrCvlcptDscsn" data-search-target="[data-doctx='${pageName}']">
<th class="cmn sorting" style="width: 180px" data-field="MDFCN_DT">수정일시</th>
<th class="cmn sorting" style="width: 100px" data-field="WEEK_NM">요일</th>
<th class="cmn sorting" style="width: 140px" data-field="MDFR_NM">수정사용자</th>
@ -52,7 +52,7 @@
<tbody name="tbodyCvlcptDscsnList">
</tbody>
<template is="curly-brackets" name="tmpltCvlcptDscsnRows">
<tr data-key="CVLCPT_DSCSN_ID">
<tr data-key="{data-index}">
<td class="text-center" onclick>{REG_DT}</td>
<td class="text-center" onclick>{WEEK_NM}</td>
<td class="text-center" onclick>{RGTR_NM}</td>
@ -89,6 +89,8 @@
</div> <!-- <div class="content-pop"> -->
<script>
LoadScript("sprt02080Script", wctx.url("/webjars/js/fims/sprt/sprt02080.js?ver=${ver}"));
/**************************************************************************
* Global Variable
**************************************************************************/
@ -101,133 +103,42 @@
// pageObject
let $P = pageObject["${pageName}"];
// FormFields
$P.formFields = new FimsFormFields($P.selectorn("frmEditCvlcptDscsn"));
/**************************************************************************
* DatasetControl
**************************************************************************/
$P.ctrlCvlcptDscsn = new DatasetControl({
prefix: "cvlcptDscsn"
, prefixName: "민원상담"
, keymapper: info => info ? info.CVLCPT_DSCSN_ID : ""
, dataGetter: obj => obj.cvlcptDscsns
, appendData: true
, infoSize: "lg"
, formats: {
REG_DT: datetimeFormat
, MDFCN_DT: datetimeFormat
}
});
// datasetControl
$P.ctrlCvlcptDscsn = newSprt02080Control("${pageName}", "[data-doctx=${pageName}]", "${pageNameMain}");
/**************************************************************************
* DatasetControl 이벤트
* 사용자 함수(function)
**************************************************************************/
// Dataset 변경 이벤트
$P.ctrlCvlcptDscsn.onDatasetChange = (obj, option) => {
$P.renderList();
};
// 현재 선택 자료 변경 이벤트
$P.ctrlCvlcptDscsn.onCurrentChange = (item) => {
if (!item) return;
$P.formFields.set($P.ctrlCvlcptDscsn, item); // 화면에 자료 셋팅
let key = item.data.CVLCPT_DSCSN_ID;
$P.$findn("tbodyCvlcptDscsnList").setCurrentRow(key); // datatable에 자료 셋팅
// 사유 callback
$P.callbackRsn = (obj) => {
// 서버에 전송할 data(파라미터) 생성
let params = {
callPurpose: "remove"
, sggCd: $P.ctrlCvlcptDscsn.getValue("SGG_CD") // 시군구 코드
, taskSeCd: $P.ctrlCvlcptDscsn.getValue("TASK_SE_CD") // 업무 구분 코드
, cvlcptDscsnId: $P.ctrlCvlcptDscsn.getValue("CVLCPT_DSCSN_ID") // 민원상담 ID
, btnTitle: obj.btnTitle // 버튼 title
, delRsn: obj.reason // 삭제 사유
};
// 민원 상담 내용 Dialog
$P.ctrlCvlcptDscsn.getInfo = (params) => {
if (!params) return;
ajax.get({
url: wctx.url("/" + params.taskSeCd +"/sprt/sprt04/020/info.do")
, data: params || {}
, success: (resp) => {
let dialogName = $P.ctrlCvlcptDscsn.prefixed("Dialog");
let dialogId = dialogName + "-" + uuid();
dialog.open({
id: dialogId
, title: params.btnTitle
, size: "lg"
, content: resp
, init: () => {
$("#" + dialogId).attr("name", dialogName);
$("#" + dialogId).attr("data-ref-doctx", "${pageName}");
AppSupport.setDialogZindex();
}
, onClose: () => { $P.fnRefreshDataInfo(); } // 자료 재조회
});
}
});
}
// 민원 상담 삭제 callback
$P.ctrlCvlcptDscsn.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) { $P.fnRefreshDataInfo(); } // 자료 재조회
}
});
}
// 민원 상담 삭제
$P.ctrlCvlcptDscsn.remove = (params) => {
if (!params) return;
ajax.post({
url: wctx.url("/" + params.taskSeCd + "/sprt/sprt04/010/remove.do")
, data: params || {}
, success: (resp) => {
$P.ctrlCvlcptDscsn.onRemove(params, resp);
}
});
}
/**************************************************************************
* DataTables 이벤트
**************************************************************************/
// DataTables에 click, dbclick 이벤트
$P.renderList = (totalSize, option) => {
let cvlcptDscsnList = $P.ctrlCvlcptDscsn.dataset;
let empty = cvlcptDscsnList.empty;
let trs = empty ? [$P.findn("tmpltNotFoundCvlcptDscsn").innerHTML] :
cvlcptDscsnList.inStrings($P.findn("tmpltCvlcptDscsnRows").innerHTML
, (str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].ctrlCvlcptDscsn.setCurrent('" + dataItem.getValue("CVLCPT_DSCSN_ID") + "');")
);
$P.$findn("tbodyCvlcptDscsnList").html(trs.join());
$P.ctrlCvlcptDscsn.remove(params);
}
/**************************************************************************
* 사용자 함수(function)
**************************************************************************/
// 자료 재조회
$P.fnRefreshDataInfo = () => {
let crdnId = pageObject["${mainPageName}"].mainCtrl.getValue("CRDN_ID"); // 단속 ID
// 정보 새로고침
$P.fnRefresh = () => {
let ctrlMain = pageObject["${pageNameMain}"].ctrlMain;
// 단속 ID 가 없다면.. return
let crdnId = ctrlMain.getValue("CRDN_ID"); // 단속 ID
if (!crdnId) return;
let params = {
callPurpose: "refresh"
, inquiryCondition: "crdnId_vhrno"
, sggCd: pageObject["${mainPageName}"].mainCtrl.getValue("SGG_CD")
, taskSeCd: pageObject["${mainPageName}"].mainCtrl.getValue("TASK_SE_CD")
, crdnId: pageObject["${mainPageName}"].mainCtrl.getValue("CRDN_ID")
, vhrno: pageObject["${mainPageName}"].mainCtrl.getValue("VHRNO")
, sggCd: ctrlMain.getValue("SGG_CD")
, taskSeCd: ctrlMain.getValue("TASK_SE_CD")
, crdnId: ctrlMain.getValue("CRDN_ID")
, vhrno: ctrlMain.getValue("VHRNO")
, delYn: "N"
};
@ -237,46 +148,34 @@
, data: params || {}
, success: (resp) => {
// 초기화
$P.findn("frmEditCvlcptDscsn").reset(); // 화면 초기화
$P.ctrlCvlcptDscsn.dataset.clear(); // 수납 Dataset 초기화
$P.findn("frmEditCvlcptDscsn").reset(); // 민원상담 화면
$P.ctrlCvlcptDscsn.dataset.clear(); // 민원상담 Dataset
// sprt02010-main 단속 정보
ctrlMain.setData([resp.totalInfo]);
// Dataset 셋팅
$P.ctrlCvlcptDscsn.setData(resp.cvlcptDscsns); // 민원상담 정보
// 민원상담 정보
$P.ctrlCvlcptDscsn.setData(resp.cvlcptDscsns);
}
});
}
// 사유 callback
$P.callbackRsn = (obj) => {
// 서버에 전송할 data(파라미터) 생성
let params = {
callPurpose: "remove"
, sggCd: $P.ctrlCvlcptDscsn.getValue("SGG_CD") // 시군구 코드
, taskSeCd: $P.ctrlCvlcptDscsn.getValue("TASK_SE_CD") // 업무 구분 코드
, cvlcptDscsnId: $P.ctrlCvlcptDscsn.getValue("CVLCPT_DSCSN_ID") // 민원상담 ID
, btnTitle: obj.btnTitle // 버튼 title
, delRsn: obj.reason // 삭제 사유
};
$P.ctrlCvlcptDscsn.remove(params);
}
/**************************************************************************
* 버튼 clickEvent
**************************************************************************/
// 민원 상담 내용 등록
$P.fnCreateCvlcptDscsn = (btnTitle) => {
let crdnId = pageObject["${mainPageName}"].mainCtrl.getValue("CRDN_ID"); // 단속 ID
// 단속 ID 가 없다면.. return
let ctrlMain = pageObject["${pageNameMain}"].ctrlMain; // sprt02010 control
let crdnId = ctrlMain.getValue("CRDN_ID"); // 단속 ID
if (!crdnId) return;
let params = {
callPurpose: "create"
, btnTitle: btnTitle
, sggCd: pageObject["${mainPageName}"].mainCtrl.getValue("SGG_CD") // 시군구 코드
, taskSeCd: pageObject["${mainPageName}"].mainCtrl.getValue("TASK_SE_CD") // 업무 구분 코드
, crdnId: pageObject["${mainPageName}"].mainCtrl.getValue("CRDN_ID") // 단속 ID
, sggCd: ctrlMain.getValue("SGG_CD") // 시군구 코드
, taskSeCd: ctrlMain.getValue("TASK_SE_CD") // 업무 구분 코드
, crdnId: ctrlMain.getValue("CRDN_ID") // 단속 ID
};
$P.ctrlCvlcptDscsn.getInfo(params);
@ -284,9 +183,8 @@
// 민원 상담 내용 수정
$P.fnUpdateCvlcptDscsn = (btnTitle) => {
let cvlcptDscsnId = $P.ctrlCvlcptDscsn.getValue("CVLCPT_DSCSN_ID"); // 민원 상담 ID
// 민원 상담 ID 가 없다면.. return
let cvlcptDscsnId = $P.ctrlCvlcptDscsn.getValue("CVLCPT_DSCSN_ID"); // 민원 상담 ID
if (!cvlcptDscsnId) return;
let params = {
@ -303,9 +201,8 @@
// 민원상담 내용 삭제
$P.fnRemoveCvlcptDscsn = (btnTitle) => {
let cvlcptDscsnId = $P.ctrlCvlcptDscsn.getValue("CVLCPT_DSCSN_ID"); // 민원 상담 ID
// 민원 상담 ID 가 없다면.. return
let cvlcptDscsnId = $P.ctrlCvlcptDscsn.getValue("CVLCPT_DSCSN_ID"); // 민원 상담 ID
if (!cvlcptDscsnId) return;
// 삭제 메세지 확인
@ -344,7 +241,7 @@
$P.fnCreateCvlcptDscsn($P.$findn("btnCreateCvlcptDscsn").attr("title")); // 민원상담 등록
});
$P.$findn("btnUpdateCvlcptDscsn").on("click", function() {
$P.fnCreateCvlcptDscsn($P.$findn("btnUpdateCvlcptDscsn").attr("title")); // 민원상담 수정
$P.fnUpdateCvlcptDscsn($P.$findn("btnUpdateCvlcptDscsn").attr("title")); // 민원상담 수정
});
$P.$findn("btnRemoveCvlcptDscsn").on("click", function() {
$P.fnRemoveCvlcptDscsn($P.$findn("btnRemoveCvlcptDscsn").attr("title")); // 민원상담 삭제
@ -355,17 +252,14 @@
}
// 초기 화면 설정
$P.initForm = () => {
// 초기화
$P.findn("frmEditCvlcptDscsn").reset(); // 화면 초기화
$P.ctrlCvlcptDscsn.dataset.clear(); // 수납 Dataset 초기화
$P.fnReset = () => {
// 화면 초기화
$P.findn("frmEditCvlcptDscsn").reset();
// Dataset 초기화
$P.ctrlCvlcptDscsn.dataset.clear(); // 수납 Dataset
// 화면 호출(callPurpose)이 view라면 버튼 비활성화 disabled = true
if (pageObject['${mainPageName}'].callPurpose == "view") {
$P.$findn("btnCreateCvlcptDscsn").prop("disabled", true);
$P.$findn("btnUpdateCvlcptDscsn").prop("disabled", true);
$P.$findn("btnRemoveCvlcptDscsn").prop("disabled", true);
} else {
if (pageObject['${pageNameMain}'].callPurpose != "view") {
$P.$findn("btnCreateCvlcptDscsn").prop("disabled", false);
$P.$findn("btnUpdateCvlcptDscsn").prop("disabled", false);
$P.$findn("btnRemoveCvlcptDscsn").prop("disabled", false);
@ -379,7 +273,7 @@
$P.setEvent();
// 2. 초기 화면 설정
$P.initForm();
$P.fnReset();
// 3. Dataset 설정
$P.ctrlCvlcptDscsn.setData(${cvlcptDscsns}); // 민원 상담 정보

@ -1,75 +1,80 @@
<%@ 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-pop">
<div class="content-pop" data-doctx="${pageName}">
<!-- Content -->
<div class="container flex-grow-1 px-0">
<div class="card">
<!-- 입력 영역 -->
<form id="frmEdit--${pageName}" name="frmEdit">
<form name="frmEdit">
<!-- hidden -->
<input type="hidden" id="sggCd--${pageName}" name="sggCd" data-map="SGG_CD" />
<input type="hidden" id="taskSeCd--${pageName}" name="taskSeCd" data-map="TASK_SE_CD" />
<input type="hidden" id="crdnId--${pageName}" name="crdnId" data-map="CRDN_ID" />
<input type="hidden" id="cvlcptDscsnId--${pageName}" name="cvlcptDscsnId" data-map="CVLCPT_DSCSN_ID" />
<input type="hidden" id="vhrno--${pageName}" name="vhrno" data-map="VHRNO" />
<input type="hidden" id="rtpyrNo--${pageName}" name="rtpyrNo" data-map="RTPYR_NO" />
<input type="hidden" name="sggCd" data-map="SGG_CD" />
<input type="hidden" name="taskSeCd" data-map="TASK_SE_CD" />
<input type="hidden" name="crdnId" data-map="CRDN_ID" />
<input type="hidden" name="cvlcptDscsnId" data-map="CVLCPT_DSCSN_ID" />
<input type="hidden" name="vhrno" data-map="VHRNO" />
<input type="hidden" name="rtpyrNo" data-map="RTPYR_NO" />
<div class="row g-1">
<!-- 민원 접수 구분 코드 -->
<div class="col-md-12">
<label for="cvlcptRcptSeCd--${pageName}" class="w-px-120 bg-lighter pe-2 col-form-label text-sm-end required">접수구분</label>
<select class="form-select" id="cvlcptRcptSeCd--${pageName}" name="cvlcptRcptSeCd" data-map="CVLCPT_RCPT_SE_CD" required>
<div class="col-md-6">
<label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end required" for="cvlcptRcptSeCd">접수구분</label>
<select is="id-select" class="form-select" name="cvlcptRcptSeCd" data-map="CVLCPT_RCPT_SE_CD" required>
<option value="">선택하세요</option>
<c:forEach items="${FIM065List}" var="item">
<option value="${item.code}">${item.value}</option>
</c:forEach>
</select>
</div>
<!-- 민원인명 -->
<div class="col-md-6">
<label for="cvlprNm--${pageName}" class="w-px-120 bg-lighter pe-2 col-form-label text-sm-end">민원인명</label>
<input type="text" class="form-control w-px-160" id="cvlprNm--${pageName}" name="cvlprNm" data-map="CVLPR_NM" autocomplete="off" />
<label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end required" for="dscsnYmd">상담일자</label>
<input is="id-input" type="text" class="form-control form-date" name="dscsnYmd" data-map="DSCSN_YMD"
data-fmt-type="day" autocomplete="off" title="날짜 선택" maxlength="10" required />
<button type="button" class="bx bx-lg bx-calendar bg-white" name="btnLevyExclYmd"></button>
</div>
<div class="col-md-6">
<label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="cvlprNm">민원인명</label>
<input is="id-input" type="text" class="form-control w-px-160" name="cvlprNm" data-map="CVLPR_NM" autocomplete="off" />
</div>
<!-- 민원인 연락처 -->
<div class="col-md-6">
<label for="cvlprCttpc--${pageName}" class="w-px-120 bg-lighter pe-2 col-form-label text-sm-end">연락처</label>
<input type="text" class="form-control w-px-160" id="cvlprCttpc--${pageName}" name="cvlprCttpc" data-map="CVLPR_CTTPC" autocomplete="off" />
<label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="cvlprCttpc">연락처</label>
<input is="id-input" type="text" class="form-control w-px-160" name="cvlprCttpc" data-map="CVLPR_CTTPC" autocomplete="off" />
</div>
<!-- 상담 내용 -->
<div class="col-md-12">
<label for="dscsnCn--${pageName}" class="w-px-120 bg-lighter pe-2 col-form-label text-sm-end">상담 내용</label>
<textarea type="text" class="form-control w-85" id="dscsnCn--${pageName}" name="dscsnCn" data-map="DSCSN_CN" rows="5" data-maxlengthb="4000"></textarea>
<label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="dscsnCn">상담내용</label>
<textarea is="id-textarea" type="text" class="form-control w-85" name="dscsnCn" data-map="DSCSN_CN" rows="5" data-maxlengthb="4000"></textarea>
</div>
</div>
</form>
<!-- 입력 영역 -->
</div> <!-- <div class="card"> -->
<!-- 업무 버튼 및 건수 표시 -->
<div>
<span class="container-page-btn">
<!-- 업무 버튼 -->
<span class="container-window-btn-right">
<button type="button" class="btn btn-primary w-px-80" id="btnSave--${pageName}" title="저장">
<button type="button" class="btn btn-primary w-px-120" name="btnSave" title="저장">
저장
</button>
</span>
</span>
</div>
<!-- 업무 버튼 및 건수 표시 -->
</div> <!-- <div class="card"> -->
</div> <!-- <div class="container flex-grow-1 px-0"> -->
<!-- Content -->
</div> <!-- / inner page html <div class="content-pop"> -->
</div>
<!-- / inner page html <div class="content-pop"> -->
<script>
LoadScript("sprt04020Script", wctx.url("/webjars/js/fims/sprt/sprt04020.js?ver=${ver}"));
/**************************************************************************
* Global Variable
**************************************************************************/
pageObject["${pageName}"] = {};
pageObject["${pageName}"] = newDoctxFinder("${pageName}");
/**************************************************************************
* script 진입
@ -78,73 +83,17 @@
// pageObject
let $P = pageObject["${pageName}"];
// URL
$P.prefixUrl = "${prefixUrl}"
// infoDialog 호출 용도(view 조회(편집불가), create 등록, update 수정)
$P.callPurpose = "${callPurpose}";
// FormFields
$P.formFields = new FimsFormFields("#frmEdit--${pageName}");
/**************************************************************************
* DatasetControl
**************************************************************************/
$P.control = new DatasetControl({
prefix: "cvlcptDscsn"
, prefixName: "민원상담"
, keymapper: info => info ? info.CVLCPT_DSCSN_ID : ""
, dataGetter: obj => obj.${infoPrefix}Info
});
/**************************************************************************
* DatasetControl 이벤트
**************************************************************************/
// 현재 선택 자료 변경 이벤트
$P.control.onCurrentChange = item => {
if (!item) return;
// Dataset 셋팅
$P.formFields.set($P.control,item);
// 업무구분에 따른 URL 변경
$P.fnSetURL(item.data.TASK_SE_CD);
}
// 저장 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: () => { AppSupport.setDialogZindex(); }
, onOK: () => { }
});
if (resp.saved) {
dialog.close($P.control.prefix + "Dialog--${openerPageName}");
}
}
// 저장
$P.control.save = (info) => {
if (!info) return;
let create = ($P.callPurpose == "create");
ajax.post({
url: !create ? $P.control.urls.update : $P.control.urls.create
, data: info
, success: resp => $P.control.onSave(resp)
});
}
// datasetControl
$P.ctrl = newSprt04020Control("${pageName}", "[data-doctx=${pageName}]");
/**************************************************************************
* 사용자 함수(function)
**************************************************************************/
// 업무구분에 따른 URL 설정
$P.fnSetURL = (taskSeCd) => {
$P.control.urls.create = wctx.url("/" + taskSeCd + "${infoPrefixUrl}" + "/020/create.do"); // 등록
$P.control.urls.update = wctx.url("/" + taskSeCd + "${infoPrefixUrl}" + "/020/update.do"); // 수정
}
/**************************************************************************
* 버튼 clickEvent
@ -152,14 +101,15 @@
// 저장
$P.fnSave = () => {
// validate 확인
if (!AppSupport.customValidate($("#frmEdit--${pageName}").find("input, select, textarea"))) return;
if (!AppSupport.customValidate($P.$findn("frmEdit").find("input,select,textarea"))) return;
// formFields
let params = new FimsFormFields($P.selectorn("frmEdit")).get();
dialog.alert({
content : "현재 " + $P.control.prefixName + " 정보를 저장하시겠습니까?"
content : "현재 " + $P.ctrl.prefixName + " 정보를 저장하시겠습니까?"
, init: () => { AppSupport.setDialogZindex(); }
, onOK: () => {
$P.control.save($P.formFields.get()); // formFields
}
, onOK: () => { $P.ctrl.save(params); } // formFields
});
}
@ -168,36 +118,31 @@
**************************************************************************/
// 이벤트 설정
$P.setEvent = () => {
// form-date 항목에서 키보드로 입력시 날짜 포맷팅 적용
$("#frmEdit--${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);
}
});
});
// 버튼 이벤트
$("#btnSave--${pageName}").on("click", () => $P.fnSave()); // 저장
$P.$findn("btnSave").on("click", () => { $P.fnSave() }); // 저장
}
// 초기 화면 설정
$P.initForm = () => {
$P.fnReset = () => {
// 초기화
$P.findn("frmEdit").reset(); // 화면 초기화
// 달력 초기화
AppSupport.initDatepicker("frmEdit--${pageName}");
AppSupport.initDatepicker($P.findn("frmEdit"));
// View로 호출
// 기본 데이터 설정
$P.$findn("dscsnYmd").datepicker("setDate", TODAY()); // 상담 일자
// 화면 호출(callPurpose)이 view라면 버튼 비활성화 disabled = true
if ($P.callPurpose == "view") {
// input 요소들을 disabled
$("#frmEdit--${pageName}").find("input,textarea,select").prop("disabled", true);
$P.$findn("frmEdit").find("input,textarea,select").prop("disabled", true);
// button 요소들을 disabled
$("btnSave--${pageName}").prop("disabled", true);
$P.$findn("btnLevyExclYmd").prop("disabled", true); // 부과제외 일자 달력 버튼
$P.$findn("btnSave").prop("disabled", true); // 저장 버튼
} else if ($P.callPurpose == "update") {
$("#cvlcptRcptSeCd--${pageName}").prop("disabled", true);
$P.$findn("cvlcptRcptSeCd").prop("disabled", true); // 민원 접수 구분 코드
}
}
@ -208,10 +153,10 @@
$P.setEvent();
// 2. 초기 화면 설정
$P.initForm();
$P.fnReset();
// 3. Dataset 설정
$P.control.setData([${cvlcptDscsnInfo}]);
$P.ctrl.setData([${info}]);
});
</script>

@ -1,46 +1,84 @@
function newSprt02030Control(pageName, doctx="[data-doctx='sprt02030']") {
let ctrl = new DatasetControl({
function newSprt02080Control(pageName, doctx="[data-doctx='sprt02080']", mainPageName="sprt02010") {
let ctrlCvlcptDscsn = new DatasetControl({
doctx: doctx
, prefix: "levyExcl"
, prefixName: "부과제외"
, dataGetter: obj => obj["Info"]
, keys: ["LEVY_EXCL_ID"]
, prefix: "cvlcptDscsn"
, prefixName: "민원상담"
, dataGetter: obj => obj["cvlcptDscsns"]
, keys: ["CVLCPT_DSCSN_ID"]
, appendData: true
, infoSize: "lg"
, urls: {
load: "/list.do"
, getInfo: "/info.do"
, create: "/create.do"
, update: "/update.do"
, remove: "/remove.do"
}
, formats: {
REG_DT: datetimeFormat
, MDFCN_DT: datetimeFormat
}
});
/**************************************************************************
* DatasetControl Events
**************************************************************************/
// Dataset 변경 이벤트
ctrlCvlcptDscsn.onDatasetChange = (obj, option) => {
// 데이터 셋
let dataList = ctrlCvlcptDscsn.dataset;
let empty = dataList.empty;
let replacer = (str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['" + pageName + "'].ctrlCvlcptDscsn.setCurrent('{data-index}');")
let trs = empty ?
[ctrlCvlcptDscsn.find("[name='tmpltNotFoundCvlcptDscsn']").innerHTML]
: dataList.inStrings(ctrlCvlcptDscsn.find("[name='tmpltCvlcptDscsnRows']").innerHTML, replacer);
// dataTables(그리드)에 자료 표시 td
$(ctrlCvlcptDscsn.find("[name='tbodyCvlcptDscsnList']")).html(trs.join());
};
// 현재 선택 자료 변경 이벤트
ctrl.onCurrentChange = (item) => {
ctrlCvlcptDscsn.onCurrentChange = (item) => {
Apply.fromDataset.currentRow(ctrlCvlcptDscsn.dataset, item, ctrlCvlcptDscsn.find("[name='tbodyCvlcptDscsnList']"));
if (!item) return;
// 화면에 단속 Dataset 셋팅
let formFields = new FimsFormFields(ctrl.selector("[name='frmEdit']"));
formFields.set(ctrl, item);
let formFields = new FimsFormFields(ctrlCvlcptDscsn.selector("[name='frmEditCvlcptDscsn']"));
formFields.set(ctrlCvlcptDscsn, item);
};
// 업무구분에 따른 URL 변경
pageObject[pageName].fnSetURL(item.data.TASK_SE_CD);
// 상세 정보 dialog
ctrlCvlcptDscsn.getInfo = (params) => {
if (!params) return;
ajax.get({
url: wctx.url("/" + params.taskSeCd +"/sprt/sprt04/020/info.do")
, data: params || {}
, success: (resp) => {
let dialogName = ctrlCvlcptDscsn.prefixed("Dialog");
let dialogId = dialogName + "-" + uuid();
// 부과제외구분에 따른 부과제외사유 설정
pageObject[pageName].fnSetFim021(item.data.LEVY_EXCL_SE_CD, item.data.LEVY_EXCL_RSN_CD);
dialog.open({
id: dialogId
, title: params.btnTitle
, size: ctrlCvlcptDscsn.infoSize
, content: resp
, init: () => {
$("#" + dialogId).attr("name", dialogName);
$("#" + dialogId).attr("data-ref-doctx", pageName);
// 부과제외일자
if (item.data.LEVY_EXCL_YMD == "") {
$(ctrl.find("[name='levyExclYmd']")).datepicker("setDate", TODAY());
AppSupport.setDialogZindex();
}
, onClose: () => { pageObject[pageName].fnRefresh(); } // 정보 새로고침
});
}
});
}
};
// 저장 callback
ctrl.onSave = (params, resp) => {
let showMessage = resp.rtnMsg.replace(/[S]|[F]/g, ctrl.prefixName);
let modalId = $(document.querySelector(doctx)).parents(".modal")[0].id;
// 삭제 callback
ctrlCvlcptDscsn.onRemove = (params, resp) => {
let showMessage = resp.rtnMsg.replace(/[S]|[F]/g, params.btnTitle);
// 메시지 출력
dialog.alert({
@ -48,33 +86,21 @@ function newSprt02030Control(pageName, doctx="[data-doctx='sprt02030']") {
, init: () => { AppSupport.setDialogZindex(); }
, onOK: () => { }
, onClose: () => {
if (pageObject[pageName].savedCallbackFuncName != "") {
pageObject[pageName].savedCallbackFuncName(resp.saved);
}
if (resp.saved) { dialog.close(modalId); }
if (resp.saved) { pageObject[pageName].fnRefresh(); } // 정보 새로고침
}
});
}
// 저장
ctrl.save = (params) => {
// 삭제
ctrlCvlcptDscsn.remove = (params) => {
if (!params) return;
let create = (params.callPurpose == "create");
// 민원 접수 관리에서 호출했다면..
if (create && pageObject[pageName].saveCallbackFuncName != "") {
pageObject[pageName].saveCallbackFuncName(info);
} else {
ajax.post({
url: !create ? ctrl.urls.update : ctrl.urls.create
url: wctx.url("/" + params.taskSeCd + "/sndb/sndb01/220/remove.do")
, data: params || {}
, success: (resp) => { ctrl.onSave(params, resp); }
, success: (resp) => { ctrlCvlcptDscsn.onRemove(params, resp); }
});
}
}
return ctrl;
return ctrlCvlcptDscsn;
}

@ -0,0 +1,61 @@
function newSprt04020Control(pageName, doctx="[data-doctx='sprt04020']") {
let ctrl = new DatasetControl({
doctx: doctx
, prefix: "cvlcptDscsn"
, prefixName: "민원상담"
, dataGetter: obj => obj["info"]
, keys: ["CVLCPT_DSCSN_ID"]
, urls: {
create: "/create.do"
, update: "/update.do"
}
});
/**************************************************************************
* DatasetControl Events
**************************************************************************/
// 현재 선택 자료 변경 이벤트
ctrl.onCurrentChange = (item) => {
if (!item) return;
// 화면에 단속 Dataset 셋팅
let formFields = new FimsFormFields(ctrl.selector("[name='frmEdit']"));
formFields.set(ctrl, item);
// 업무구분에 따른 URL 변경
ctrl.urls.create = wctx.url("/" + item.data.TASK_SE_CD + pageObject[pageName].prefixUrl + "/020/create.do"); // 등록
ctrl.urls.update = wctx.url("/" + item.data.TASK_SE_CD + pageObject[pageName].prefixUrl + "/020/update.do"); // 수정
};
// 저장 callback
ctrl.onSave = (params, resp) => {
let modalId = $(document.querySelector(doctx)).parents(".modal")[0].id;
let dialogTitle = $("#" + modalId).find("h5.modal-title").html();
let showMessage = resp.rtnMsg.replace(/[S]|[F]/g, dialogTitle);
// 메시지 출력
dialog.alert({
content: showMessage
, init: () => { AppSupport.setDialogZindex(); }
, onOK: () => { }
, onClose: () => {
if (resp.saved) { dialog.close(modalId); }
}
});
}
// 저장
ctrl.save = (params) => {
if (!params) return;
let create = (params.cvlcptDscsnId == "");
ajax.post({
url: !create ? ctrl.urls.update : ctrl.urls.create
, data: params || {}
, success: (resp) => { ctrl.onSave(params, resp); }
});
}
return ctrl;
}
Loading…
Cancel
Save