공지사항 관리 추가

main
이범준 9 months ago
parent 3a58c44c03
commit 0f9e0f8b06

@ -11,4 +11,33 @@ import lombok.Setter;
@Setter
public class Ntc extends AbstractEntity {
/**
* ID
*/
private String ntcId;
/**
*
*/
private String ntcTtl;
/**
*
*/
private String ntcCn;
/**
*
*/
private String delYn;
/**
*
*/
private String delRsn;
/**
*
*/
private String sggCd;
}

@ -1,8 +1,14 @@
package cokr.xit.fims.mngt.dao;
import java.util.List;
import java.util.Map;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import cokr.xit.fims.mngt.Ntc;
import cokr.xit.fims.mngt.NtcQuery;
import cokr.xit.foundation.component.AbstractMapper;
import cokr.xit.foundation.data.DataObject;
/** DAO
* @author leebj
@ -10,4 +16,76 @@ import cokr.xit.foundation.component.AbstractMapper;
@Mapper("ntcMapper")
public interface NtcMapper extends AbstractMapper {
/** .<br />
* @param req
* @return
*/
List<DataObject> selectNtcList(NtcQuery req);
/** ID .
* @param ntcId ID
* @return
*/
DataObject selectNtcInfo(String ntcId);
/** .
* @param params
* <ul><li>"ntc" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int insertNtc(Map<String, Object> params);
/** .
* @param ntc
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
default boolean insert(Ntc ntc) {
return ntc != null && insertNtc(params().set("ntc", ntc)) == 1;
}
/** .
* @param params
* <ul><li>"ntc" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int updateNtc(Map<String, Object> params);
/** .
* @param ntc
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
default boolean update(Ntc ntc) {
return ntc != null && updateNtc(params().set("ntc", ntc)) == 1;
}
/** .
* @param params
* <ul><li>"ntc" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int deleteNtc(Map<String, ?> params);
/** .
* @param ntc
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
default boolean delete(Ntc ntc) {
return ntc != null && deleteNtc(params().set("ntc", ntc)) == 1;
}
}

@ -1,5 +1,50 @@
package cokr.xit.fims.mngt.service;
import java.util.List;
import cokr.xit.fims.mngt.Ntc;
import cokr.xit.fims.mngt.NtcQuery;
import cokr.xit.foundation.data.DataObject;
public interface NtcService {
/** .
* @param req
* @return
*/
List<DataObject> getNtcList(NtcQuery req);
/** ID .
* @param ntcId ID
* @return
*/
DataObject getNtcInfo(String ntcId);
/** .
* @param ntc
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
String create(Ntc ntc);
/** .
* @param ntc
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
String update(Ntc ntc);
/** .
* @param ntc
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
String remove(Ntc ntc);
}

@ -1,11 +1,16 @@
package cokr.xit.fims.mngt.service.bean;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import cokr.xit.fims.mngt.Ntc;
import cokr.xit.fims.mngt.NtcQuery;
import cokr.xit.fims.mngt.dao.NtcMapper;
import cokr.xit.foundation.AbstractComponent;
import cokr.xit.foundation.data.DataObject;
/** Bean
* @author leebj
@ -16,4 +21,53 @@ public class NtcBean extends AbstractComponent {
@Resource(name="ntcMapper")
private NtcMapper ntcMapper;
/** .
* @param req
* @return
*/
public List<DataObject> getNtcList(NtcQuery req) {
return ntcMapper.selectNtcList(req);
}
/** ID .
* @param ntcId ID
* @return
*/
public DataObject getNtcInfo(String ntcId) {
return ntcMapper.selectNtcInfo(ntcId);
}
/** .
* @param ntc
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean create(Ntc ntc) {
return ntcMapper.insert(ntc);
}
/** .
* @param ntc
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean update(Ntc ntc) {
return ntcMapper.update(ntc);
}
/** .
* @param ntc
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean remove(Ntc ntc) {
return ntcMapper.delete(ntc);
}
}

@ -1,11 +1,16 @@
package cokr.xit.fims.mngt.service.bean;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import cokr.xit.fims.mngt.Ntc;
import cokr.xit.fims.mngt.NtcQuery;
import cokr.xit.fims.mngt.service.NtcService;
import cokr.xit.foundation.component.AbstractServiceBean;
import cokr.xit.foundation.data.DataObject;
@Service("ntcService")
public class NtcServiceBean extends AbstractServiceBean implements NtcService {
@ -13,4 +18,29 @@ public class NtcServiceBean extends AbstractServiceBean implements NtcService {
@Resource(name="ntcBean")
private NtcBean ntcBean;
@Override
public List<DataObject> getNtcList(NtcQuery req) {
return ntcBean.getNtcList(req);
}
@Override
public DataObject getNtcInfo(String ntcId) {
return ntcBean.getNtcInfo(ntcId);
}
@Override
public String create(Ntc ntc) {
return ntcBean.create(ntc) ? "[S]" : "[F]";
}
@Override
public String update(Ntc ntc) {
return ntcBean.update(ntc) ? "[S]" : "[F]";
}
@Override
public String remove(Ntc ntc) {
return ntcBean.remove(ntc) ? "[S]" : "[F]";
}
}

@ -1,11 +1,17 @@
package cokr.xit.fims.mngt.web;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.web.servlet.ModelAndView;
import cokr.xit.base.user.ManagedUser;
import cokr.xit.base.web.ApplicationController;
import cokr.xit.fims.mngt.Ntc;
import cokr.xit.fims.mngt.NtcQuery;
import cokr.xit.fims.mngt.service.NtcService;
import cokr.xit.foundation.data.DataObject;
/** .<br />
* { }/mngt/mngt01 .
@ -17,7 +23,12 @@ public class Mngt01Controller extends ApplicationController {
public class METHOD_URL {
public static final String
ntcMain = "/010/main.do"
ntcMain = "/010/main.do",
getNtcList = "/010/list.do",
getNtcInfo = "/020/info.do",
create = "/020/create.do",
update = "/020/update.do",
remove = "/020/remove.do"
;
}
@ -35,4 +46,106 @@ public class Mngt01Controller extends ApplicationController {
return mav;
}
/** .<br />
* {@link NtcService#getNtcList(NtcQuery)}
* @param req
* @return jsonView
* <pre><code> {
* "ntcList": [ ]
* "ntcStart":
* "ntcFetch":
* "ntcTotal":
* }</code></pre>
*/
public ModelAndView getNtcList(NtcQuery req) {
ModelAndView mav = new ModelAndView("jsonView");
setFetchSize(req);
ManagedUser currentUser = (ManagedUser) currentUser().getUser();
String sggCd = currentUser.getOrgID();
req.setSggCd(sggCd);
List<DataObject> list = ntcService.getNtcList(req);
return setCollectionInfo(mav, list, "", "");
}
/** .<br />
* {@link NtcService#getNtcInfo(NtcQuery)}
* @param ntcId ID
* @return jsonView
*/
public ModelAndView getNtcInfo(String ntcId) {
boolean json = jsonResponse();
ModelAndView mav = new ModelAndView(json ? "jsonView" : "fims/mngt/mngt01020-info");
mav.addObject("pageName", "mngt01020");
DataObject info = new DataObject();
if(!ifEmpty(ntcId, ()->"").equals("")) {
info = ntcService.getNtcInfo(ntcId);
} else {
info = null;
}
mav.addObject("ntcInfo", json ? info : toJson(info));
return mav;
}
/** .
* @param ntc
* @return jsonView
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
public ModelAndView create(Ntc ntc) {
ModelAndView mav = new ModelAndView("jsonView");
boolean saved = false;
String rtnMsg = ntcService.create(ntc);
if(rtnMsg.contains("[S]")) {
saved = true;
}
mav.addObject("saved", saved);
return mav;
}
/** .
* @param ntc
* @return jsonView
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
public ModelAndView update(Ntc ntc) {
ModelAndView mav = new ModelAndView("jsonView");
boolean saved = false;
String rtnMsg = ntcService.update(ntc);
if(rtnMsg.contains("[S]")) {
saved = true;
}
mav.addObject("saved", saved);
return mav;
}
/** .
* @param ntcIDs
* @return jsonView
* <pre><code> {
* "affected":
* "saved": true, false
* }</code></pre>
*/
public ModelAndView remove(Ntc ntc) {
ModelAndView mav = new ModelAndView("jsonView");
boolean saved = false;
String rtnMsg = ntcService.remove(ntc);
if(rtnMsg.contains("[S]")) {
saved = true;
}
mav.addObject("saved", saved);
return mav;
}
}

@ -16,6 +16,8 @@ import cokr.xit.fims.cmmn.PrintOption;
import cokr.xit.fims.crdn.Crdn;
import cokr.xit.fims.mngt.FineIntegrationDepartment;
import cokr.xit.fims.mngt.FineIntegrationSigungu;
import cokr.xit.fims.mngt.Ntc;
import cokr.xit.fims.mngt.NtcQuery;
import cokr.xit.fims.mngt.Task;
import cokr.xit.fims.mngt.VltnQuery;
import cokr.xit.fims.sprt.SprtQuery;
@ -576,6 +578,36 @@ public class CmnController {
return super.ntcMain();
}
@Override
@RequestMapping(name="공지사항 목록 조회", value=METHOD_URL.getNtcList)
public ModelAndView getNtcList(NtcQuery req) {
return super.getNtcList(req);
}
@Override
@RequestMapping(name="공지사항 상세 조회", value=METHOD_URL.getNtcInfo)
public ModelAndView getNtcInfo(String ntcId) {
return super.getNtcInfo(ntcId);
}
@Override
@RequestMapping(name="공지사항 등록", value=METHOD_URL.create)
public ModelAndView create(Ntc ntc) {
return super.create(ntc);
}
@Override
@RequestMapping(name="공지사항 수정", value=METHOD_URL.update)
public ModelAndView update(Ntc ntc) {
return super.update(ntc);
}
@Override
@RequestMapping(name="공지사항 삭제", value=METHOD_URL.remove)
public ModelAndView remove(Ntc ntc) {
return super.remove(ntc);
}
}
@Controller

@ -1,4 +1,114 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cokr.xit.fims.mngt.dao.NtcMapper">
<!-- 공지사항 정보 매퍼
========== 변경 이력 ==========
2024-02-26 leebj 최초 작성
============================ -->
<resultMap id="ntcRow" type="cokr.xit.fims.mngt.Ntc"> <!-- 공지사항 -->
<result property="ntcId" column="NTC_ID" /> <!-- 공지 ID -->
<result property="sggCd" column="SGG_CD" /> <!-- 시군구 코드 -->
<result property="ntcTtl" column="NTC_TTL" /> <!-- 공지 제목 -->
<result property="ntcCn" column="NTC_CN" /> <!-- 공지 내용 -->
<result property="delYn" column="DEL_YN" /> <!-- 삭제 여부 -->
<result property="createdAt" column="REG_DT" /> <!-- 등록 일시 -->
<result property="createdBy" column="RGTR" /> <!-- 등록자 -->
<result property="lastModified" column="MDFCN_DT" /> <!-- 수정 일시 -->
<result property="modifiedBy" column="MDFR" /> <!-- 수정자 -->
<result property="removedAt" column="DEL_DT" /> <!-- 삭제 일시 -->
<result property="removedBy" column="DLTR" /> <!-- 삭제자 -->
<result property="delRsn" column="DEL_RSN" /> <!-- 삭제 사유 -->
</resultMap>
<sql id="select">
SELECT A.NTC_ID <!-- 공지 ID -->
, A.SGG_CD <!-- 시군구 코드 -->
, A.NTC_TTL <!-- 공지 제목 -->
, A.NTC_CN <!-- 공지 내용 -->
, A.DEL_YN <!-- 삭제 여부 -->
, A.REG_DT <!-- 등록 일시 -->
, A.RGTR <!-- 등록자 -->
, A.MDFCN_DT <!-- 수정 일시 -->
, A.MDFR <!-- 수정자 -->
, A.DEL_DT <!-- 삭제 일시 -->
, A.DLTR <!-- 삭제자 -->
, A.DEL_RSN <!-- 삭제 사유 -->
FROM TB_NOTICE A
</sql>
<select id="selectNtcList" parameterType="map" resultType="dataobject">
/* 공지사항 목록 조회(ntcMapper.selectNtcList) */
<include refid="utility.paging-prefix" />
<include refid="select" />
WHERE A.DEL_YN = 'N'
<if test="sggCd != null">
AND A.SGG_CD = #{sggCd}
</if>
<if test="by != null and by != '' and term != null">
AND A.${by} LIKE CONCAT('%',#{term},'%')
</if>
<include refid="utility.orderBy" />
<include refid="utility.paging-suffix" />
</select>
<select id="selectNtcInfo" parameterType="string" resultType="dataobject">
/* 공지사항 상세 내용 조회(ntcMapper.selectNtcInfo) */
<include refid="select" />
WHERE A.DEL_YN = 'N'
AND A.NTC_ID = #{ntcId}
</select>
<insert id="insertNtc" parameterType="map">
/* 공지사항 등록(ntcMapper.insertNtc) */
<selectKey resultType="string" keyProperty="ntc.ntcId" keyColumn="NEW_ID" order="BEFORE">
SELECT
LPAD(CAST(IFNULL(MAX(NTC_ID) + 1, 1) AS INT), 10, '0')
AS NEW_ID
FROM TB_NOTICE
</selectKey>
INSERT
INTO TB_NOTICE (
NTC_ID <!-- 공지 ID -->
, SGG_CD <!-- 시군구 코드 -->
, NTC_TTL <!-- 공지 제목 -->
, NTC_CN <!-- 공지 내용 -->
, DEL_YN <!-- 삭제 여부 -->
, REG_DT <!-- 등록 일시 -->
, RGTR <!-- 등록자 -->
, MDFCN_DT <!-- 수정 일시 -->
, MDFR <!-- 수정자 -->
) VALUES (
#{ntc.ntcId} <!-- 공지 ID -->
, #{ntc.sggCd} <!-- 시군구 코드 -->
, #{ntc.ntcTtl} <!-- 공지 제목 -->
, #{ntc.ntcCn} <!-- 공지 내용 -->
, 'N' <!-- 삭제 여부 -->
, <include refid="utility.now" /> <!-- 등록 일시 -->
, #{currentUser.id} <!-- 등록자 -->
, <include refid="utility.now" /> <!-- 수정 일시 -->
, #{currentUser.id} <!-- 수정자 -->
)
</insert>
<update id="updateNtc" parameterType="map">
/* 공지사항 수정(ntcMapper.updateNtc) */
UPDATE TB_NOTICE
SET NTC_TTL = #{ntc.ntcTtl} <!-- 공지 제목 -->
, NTC_CN = #{ntc.ntcCn} <!-- 공지 내용 -->
, MDFCN_DT = <include refid="utility.now" /> <!-- 수정 일시 -->
, MDFR = #{currentUser.id} <!-- 수정자 -->
WHERE NTC_ID = #{ntc.ntcId}
</update>
<update id="deleteNtc" parameterType="map">
/* 공지사항 삭제(ntcMapper.deleteNtc) */
UPDATE TB_NOTICE
SET DEL_YN = 'Y'
, MDFCN_DT = <include refid="utility.now" />
, MDFR = #{currentUser.id}
WHERE NTC_ID = #{ntc.ntcId}
</update>
</mapper>

@ -1,4 +1,314 @@
<%@ 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="pageKorName" scope="request">공지사항</c:set>
공지사항 메인
<c:set var="pageKorName" scope="request">공지사항 관리</c:set>
<div class="content-wrapper">
<div class="container-xxl flex-grow-1 px-0">
<div class="card wrapper-list">
<div class="container-page-btn">
<button type="button" id="btnReset--${pageName}" class="btn btn-outline-dark w-px-120" title="초기화">
초기화
</button>
<span class="container-window-btn-right">
<button type="button" id="btnSearch--${pageName}" class="btn btn-search w-px-120" title="검색">
검색
</button>
</span>
</div>
<form id="frmSearch--${pageName}" name="frmSearch">
<div class="container-search">
<div class="row g-1">
<div class="col-12">
<select id="by--${pageName}" name="by" class="form-select">
<option value="NTC_TTL">제목</option>
<option value="NTC_CN">내용</option>
</select>
<input type="text" id="term--${pageName}" name="term" class="form-control" />
</div>
</div>
</div>
</form>
<div>
<div id="gridbuttonArea--${pageName}" class="container-page-btn">
<div class="d-flex flex-row justify-content-between">
<label id="ntcPaging--${pageName}PagingInfo" class="dataTables_info" role="status" aria-live="polite"></label>
<ul id="ntcPaging--${pageName}" class="pagination pagination-primary">
</ul>
</div>
<span class="container-window-btn-right">
<span>
<button type="button" class="btn btn-primary w-px-120"
id="btnAdd--${pageName}" title="추가">
추가
</button>
</span>
</span>
</div>
</div>
<div class="card-datatable text-nowrap">
<div id="DataTables_Table_0_wrapper--${pageName}" class="dataTables_wrapper dt-bootstrap5 no-footer">
<div id="table-responsive--${pageName}" class="table-responsive"
style="overflow-x: scroll;height:500px;overflow-y: scroll;">
<table id="DataTables_Table_0--${pageName}"
class="table-layout-fixed datatables-ajax table table-bordered dataTable no-footer">
<thead class="sticky-thead">
<tr id="ntcThead--${pageName}">
<th style="width: 80px;" class="cmn">No.</th>
<th style="width: 800px;">제목</th>
<th style="width: 180px;">작성일시</th>
<th class="dummy-th"></th>
</tr>
</thead>
<tbody id="ntcTbody--${pageName}">
</tbody>
<template id="ntcRow--${pageName}">
<tr data-key="{NTC_ID}">
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-end">{ROW_NUM}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{NTC_TTL}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{REG_DT}</td>
<td class="dummy-td"></td>
</tr>
</template>
<template id="ntcNotFound--${pageName}">
<tr>
<td valign="top" colspan="4" class="dataTables_empty text-center">
공지사항 정보를 찾지 못했습니다.
</td>
</tr>
</template>
</table>
</div>
</div>
</div>
<div class="toast-container position-fixed bottom-0 end-0 p-3">
<div id="divToast--${pageName}" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-body bg-black text-white">
삭제 되었습니다.
</div>
</div>
</div>
</div>
</div>
<div class="content-backdrop fade"></div>
</div>
<script>
/**************************************************************************
* Global Variable
**************************************************************************/
pageObject["${pageName}"] = {};
$(document).ready(function(){
var $P = pageObject["${pageName}"];
$P.toast = new bootstrap.Toast(document.getElementById('divToast--${pageName}'), {
animation: true,
autohide: true,
delay: 2000
});
/**************************************************************************
* DatasetControl
**************************************************************************/
$P.ntcControl = new DatasetControl({
dataGetter : obj => obj["List"], appendData:true,
keymapper : info => info ? info.NTC_ID : "",
urls : {
load : wctx.url("/mngt/mngt01/010/list.do"),
getInfo : wctx.url("/mngt/mngt01/020/info.do")
},
formats: {
REG_DT : datetimeFormat,
MDFCN_DT : datetimeFormat
}
});
$P.ntcControl.defaultFetchSize = FETCH_XS;
$P.ntcControl.untilPageNum = 0;
$P.ntcControl.beforeCurrent = null;
/**************************************************************************
* Dataset.on
**************************************************************************/
$P.ntcControl.dataset.onDatasetChange = (obj) => {
var t = $P.getGridTemplate();
var trs = Apply.fromDataset.getTbody($P.ntcControl.dataset, t.found, t.notFound, t.replacer);
$P.renderNtcList(obj["Total"], $P.ntcControl.dataset.length, trs);
Apply.fromDataset.paging($P.ntcControl.dataset, obj, "ntcPaging--${pageName}");
};
$P.ntcControl.dataset.onCurrentChange = (dataItem) => {
Apply.fromDataset.currentRow($P.ntcControl.dataset, dataItem, $("#ntcTbody--${pageName}")[0]);
}
$P.ntcControl.dataset.onSelectionChange = (selectedArr) => {
};
/**************************************************************************
* pageObject.function
**************************************************************************/
$P.fnReset = () => {
var searchForm = $("#frmSearch--${pageName}");
searchForm.find("input[type='radio']").not("[name='taskSeCd']").prop("checked", false);
searchForm.find("input[type='checkbox']").prop("checked", false);
searchForm.find("input[type='hidden']").val("");
searchForm.find("input[type='text']").val("");
searchForm.find("select[name='sggCd']").val(MY_INFO.info.sggCd);
$P.ntcControl.dataset.setData([]);
}
$P.getParams = () => {
var formFields = new FimsFormFields("#frmSearch--${pageName}");
var data = formFields.get();
data.fetchSize = $P.ntcControl.defaultFetchSize;
return data;
}
$P.searchNtcList = () => {
$P.ntcControl.query = $P.getParams();
$P.ntcControl.load(1);
}
$P.scrollNtcList = () => {
$P.ntcControl.load($P.ntcControl.query.pageNum + 1);
}
$P.refreshNtcList = () => {
if($P.ntcControl.query.pageNum == null){
return;
}
$P.ntcControl.untilPageNum = $P.ntcControl.query.pageNum;
$P.ntcControl.query.fetchSize = $P.ntcControl.defaultFetchSize * $P.ntcControl.query.pageNum;
$P.ntcControl.load(1);
}
$P.getGridTemplate = () => {
var notFound = [document.getElementById("ntcNotFound--${pageName}").innerHTML];
var found = document.getElementById("ntcRow--${pageName}").innerHTML;
var replacer = (str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].clickNtcList('" + dataItem.getValue("NTC_ID") + "');")
.replace(/{ondblclick}/gi, "pageObject['${pageName}'].dblclickNtcList('" + dataItem.getValue("NTC_ID") + "');");
return {
found : found,
notFound : notFound,
replacer : replacer
};
}
$P.renderNtcList = (total, listLength, trs) => {
var noMore = (total == listLength);
var initScroll = ($P.ntcControl.query.pageNum < 2) && ($P.ntcControl.untilPageNum == 0);
$("#table-responsive--${pageName}")[0].changeContent(trs, initScroll, noMore);
fn_securityModeToggle($("#securityMode--top").is(":checked")); //보안모드
if($P.ntcControl.untilPageNum != 0){
$P.ntcControl.query.fetchSize = $P.ntcControl.defaultFetchSize;
$P.ntcControl.query.pageNum = $P.ntcControl.untilPageNum;
$P.ntcControl.untilPageNum = 0;
}
}
$P.clickNtcList = (dataKey) => {
if(dataKey == ""){
return;
}
$("#ntcTbody--${pageName}").setCurrentRow(dataKey);
Apply.toDataset.current($P.ntcControl.dataset, dataKey);
}
$P.dblclickNtcList = (dataKey) => {
$P.getInfo(dataKey);
}
$P.createNtc = () => {
$P.getInfo();
}
$P.getInfo = (ntcId) => {
var params = {};
if(ntcId != null){
params.ntcId = ntcId;
}
ajax.get({
url : $P.ntcControl.urls.getInfo,
data : params,
success : (resp) => {
dialog.open({
id : "ntcInfoDialog",
title : "공지사항 상세",
size : "xl",
content : resp,
init : () => {
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.provide = {
"refreshList" : function(){
$P.refreshNtcList();
},
};
/**************************************************************************
* element.on
**************************************************************************/
$('#btnReset--${pageName}').on('click', () => $P.fnReset());
$('#btnSearch--${pageName}').on('click', () => $P.searchNtcList());
$('#btnAdd--${pageName}').on('click', () => $P.createNtc());
/**************************************************************************
* 초기화
**************************************************************************/
fnMakeResizableTable($("#table-responsive--${pageName}")[0]);
fnMakeScrollableTable($("#table-responsive--${pageName}")[0], $P.scrollNtcList);
$P.fnReset();
fn_securityModeToggle($("#securityMode--top").is(":checked")); //보안모드
if(MY_INFO.institute != "default"){
$("#btnAdd--${pageName}").attr("hidden","hidden");
}
});
</script>

@ -0,0 +1,167 @@
<%@ 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="pageKorName" scope="request">공지사항 상세</c:set>
<div class="content-wrapper">
<div class="container-xxl flex-grow-1 px-0">
<div class="card">
<form id="frmEdit--${pageName}" name="frmEdit">
<input type="text" id="sggCd--${pageName}" name="sggCd" data-map="SGG_CD" hidden />
<input type="text" id="ntcId--${pageName}" name="ntcId" data-map="NTC_ID" hidden />
<div class="row g-1">
<div class="col-md-12">
<label for="ntcTtl--${pageName}"
class="w-px-120 bg-lighter pe-2 col-form-label text-sm-end required">
제목
</label>
<input type="text" id="ntcTtl--${pageName}" name="ntcTtl" data-map="NTC_TTL"
class="form-control w-px-800" required />
</div>
<div class="col-md-12">
<label for="ntcCn--${pageName}"
class="w-px-120 bg-lighter pe-2 col-form-label text-sm-end align-top required">
내용
</label>
<textarea type="text" id="ntcCn--${pageName}" name="ntcCn" data-map="NTC_CN"
rows="15"
class="form-control w-px-800" required></textarea>
</div>
</div>
<div class="row m-3">
<div class="col-md-12">
<span class="float-end">
<button type="button" id="btnSave--${pageName}" class="btn btn-primary">저장</button>
<button type="button" id="btnRemove--${pageName}" class="btn btn-primary">삭제</button>
</span>
</div>
</div>
</form>
</div>
</div>
</div>
<script>
pageObject["${pageName}"] = {};
pageObject["${pageName}"].provided = {};
pageObject.childReq = [];
pageObject.childReq.push({
refreshList : function(){ },
});
$(document).ready(function(){
var $P = pageObject["${pageName}"];
if(pageObject.parentRes.length > 0){
$P.provided = pageObject.parentRes.pop();
} else {
$P.provided = pageObject.childReq.pop();
}
/**************************************************************************
* DatasetControl, Dataset, FormFields
**************************************************************************/
$P.formFields = new FimsFormFields("#frmEdit--${pageName}");
$P.ntcControl = new DatasetControl({
dataGetter : obj => obj["List"], appendData : true,
keymapper : info => info ? info.NTC_ID : "",
urls : {
create : wctx.url("/mngt/mngt01/020/create.do"),
update : wctx.url("/mngt/mngt01/020/update.do"),
remove : wctx.url("/mngt/mngt01/020/remove.do")
},
formats: {
}
});
/**************************************************************************
* Dataset.on
**************************************************************************/
$P.ntcControl.dataset.onCurrentChange = (dataItem) => {
if(!dataItem){
return;
}
$P.formFields.set(dataItem);
}
/**************************************************************************
* pageObject.function
**************************************************************************/
$P.fnSave = () => {
if(!customValidate($("#frmEdit--${pageName} input"))) return;
var info = $P.formFields.get();
var create = $P.ntcControl.dataset.empty;
ajax.post({
url : create ? $P.ntcControl.urls.create : $P.ntcControl.urls.update,
data : info,
success : (resp) => {
if(resp.saved){
dialog.close("ntcInfoDialog");
dialog.alert({
content:"저장되었습니다.",
onOK : () => $P.provided.refreshList()
});
}
}
});
}
$P.fnRemove = () => {
var info = $P.formFields.get();
ajax.post({
url : $P.ntcControl.urls.remove,
data : info,
success : (resp) => {
if(resp.saved){
dialog.close("ntcInfoDialog");
dialog.alert({
content:"삭제되었습니다.",
onOK : () => $P.provided.refreshList()
});
}
}
});
}
/**************************************************************************
* element.on
**************************************************************************/
$("#btnSave--${pageName}").on('click', () => $P.fnSave());
$("#btnRemove--${pageName}").on('click', () => $P.fnRemove());
/**************************************************************************
* 초기화
**************************************************************************/
var ntcInfo = ${ntcInfo};
if(ntcInfo != null){
$P.ntcControl.dataset.setData([ntcInfo]);
} else {
$P.ntcControl.dataset.setData([]);
$("#sggCd--${pageName}").val(MY_INFO.info.sggCd);
$("#btnRemove--${pageName}").attr("hidden","hidden");
}
if(MY_INFO.institute != "default"){
$("#btnSave--${pageName}").attr("hidden","hidden");
$("#btnRemove--${pageName}").attr("hidden","hidden");
}
});
</script>
Loading…
Cancel
Save