diff --git a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt04010-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt04010-main.jsp index bd87f6ec..977a88c4 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt04010-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt04010-main.jsp @@ -1,524 +1,434 @@ <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%> <%@ include file="/WEB-INF/jsp/include/taglib.jsp"%> -민원상담 관리 +민원상담 -
- -
-
- -
- - - - - -
- - - -
- - - - - - - -
+
+ + +
diff --git a/src/main/webapp/resources/js/fims/sprt/sprt04010.js b/src/main/webapp/resources/js/fims/sprt/sprt04010.js new file mode 100644 index 00000000..1f3213ea --- /dev/null +++ b/src/main/webapp/resources/js/fims/sprt/sprt04010.js @@ -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; +}