diff --git a/src/main/java/kr/xit/fims/biz/ec/service/Ec0100Service.java b/src/main/java/kr/xit/fims/biz/ec/service/Ec0100Service.java index 4590e18d..5053745a 100644 --- a/src/main/java/kr/xit/fims/biz/ec/service/Ec0100Service.java +++ b/src/main/java/kr/xit/fims/biz/ec/service/Ec0100Service.java @@ -7,5 +7,5 @@ import org.apache.ibatis.session.RowBounds; public interface Ec0100Service { List> findEc0100List(Map paramMap, RowBounds pagingInfo); - Map findEc0100(); + Map findEc0100(String keyField); } diff --git a/src/main/java/kr/xit/fims/biz/ec/service/impl/Ec0100ServiceImpl.java b/src/main/java/kr/xit/fims/biz/ec/service/impl/Ec0100ServiceImpl.java index afa29891..34fce923 100644 --- a/src/main/java/kr/xit/fims/biz/ec/service/impl/Ec0100ServiceImpl.java +++ b/src/main/java/kr/xit/fims/biz/ec/service/impl/Ec0100ServiceImpl.java @@ -21,7 +21,7 @@ public class Ec0100ServiceImpl implements Ec0100Service { } @Override - public Map findEc0100() { + public Map findEc0100(String keyField) { return mapper.selectEc0100(); } } diff --git a/src/main/java/kr/xit/fims/biz/ec/web/Ec0100Controler.java b/src/main/java/kr/xit/fims/biz/ec/web/Ec0100Controler.java index 87932dbc..88295dbd 100644 --- a/src/main/java/kr/xit/fims/biz/ec/web/Ec0100Controler.java +++ b/src/main/java/kr/xit/fims/biz/ec/web/Ec0100Controler.java @@ -4,13 +4,20 @@ import java.util.Map; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; +import kr.xit.fims.biz.cmm.FimsConst; import kr.xit.fims.biz.ec.service.Ec0100Service; +import kr.xit.framework.biz.mng.menu.model.ProgramMngVO; +import kr.xit.framework.core.constants.FrameworkConstants; import kr.xit.framework.core.model.ResultResponse; import kr.xit.framework.support.mybatis.MybatisUtils; +import kr.xit.framework.support.util.AjaxMessageMapRenderer; +import kr.xit.framework.support.util.Checks; +import kr.xit.framework.support.util.constants.MessageKey; import lombok.AllArgsConstructor; @AllArgsConstructor @@ -24,13 +31,54 @@ public class Ec0100Controler { } + @GetMapping(value = "/ec0100Popup") + public ModelAndView ec0100Popup(@RequestParam(required = false) String keyField) { + ModelAndView mav = new ModelAndView(); + + mav.setViewName(FimsConst.FIMS_JSP_BASE_PATH +"ec/ec0100Popup.popup"); + if(Checks.isEmpty(keyField)) mav.addObject("", new ProgramMngVO()); + else mav.addObject("", service.findEc0100(keyField)); + + return mav; + } + @GetMapping(value = "/findEc0100List") public ModelAndView findEc0100List(@RequestParam Map paramMap){ return ResultResponse.of(service.findEc0100List(paramMap, MybatisUtils.getPagingInfo(paramMap))); } @GetMapping(value = "/findEc0100") - public ModelAndView findEc0100(){ - return ResultResponse.of(service.findEc0100()); + public ModelAndView findEc0100(String key){ + return ResultResponse.of(service.findEc0100(key)); + } + + @PostMapping(value = "/addEc0100") + public ModelAndView addEc0100(@RequestParam Map paramMap){ + ModelAndView mav = new ModelAndView(FrameworkConstants.JSON_VIEW); + + // 서비스 호출 + + AjaxMessageMapRenderer.success(mav, MessageKey.CMM_INSERT_SUCCESS); + return mav; + } + + @PostMapping(value = "/modifyEc0100") + public ModelAndView modifyEc0100(@RequestParam Map paramMap){ + ModelAndView mav = new ModelAndView(FrameworkConstants.JSON_VIEW); + + // 서비스 호출 + + AjaxMessageMapRenderer.success(mav, MessageKey.CMM_UPDATE_SUCCESS); + return mav; + } + + @PostMapping(value = "/removeEc0100") + public ModelAndView removeEc0100(@RequestParam String key){ + ModelAndView mav = new ModelAndView(FrameworkConstants.JSON_VIEW); + + // 서비스 호출 + + AjaxMessageMapRenderer.success(mav, MessageKey.CMM_INSERT_SUCCESS); + return mav; } } diff --git a/src/main/webapp/WEB-INF/jsp/fims/biz/common/popup/fimsTotal_popup.jsp b/src/main/webapp/WEB-INF/jsp/fims/biz/common/popup/fimsTotal_popup.jsp index f69af9c7..1a4c5143 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/biz/common/popup/fimsTotal_popup.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/biz/common/popup/fimsTotal_popup.jsp @@ -669,52 +669,37 @@ * 데이터 등록 ======================== */ addData : function(){ - var param = $("#frmSearch").serialize(); - $.ajax({ - url : "/adm/send/rqst/mng/proc.do", - data : param, - type : "POST", - dataType : "json", - success : function(data) { - }, - error: function(){ - + fnAjax( + 'post', + '', + $("#frmSearch").serialize(), + () => { } - }); + ); }, /* ======================== * 데이터 수정 ======================== */ modifyData : function(){ - var param = $("#frmSearch").serialize(); - $.ajax({ - url : "/adm/send/rqst/mng/proc.do", - data : param, - type : "PUT", - dataType : "json", - success : function(data) { - }, - error: function(){ - + fnAjax( + 'post', + '', + $("#frmSearch").serialize(), + () => { } - }); + ); }, /* ======================== * 데이터 삭제 ======================== */ removeData : function(){ - var param = $("#frmSearch").serialize(); - $.ajax({ - url : "/adm/send/rqst/mng/proc.do", - data : param, - type : "DELETE", - dataType : "json", - success : function(data) { - }, - error: function(){ - + fnAjax( + 'post', + '', + $("#frmSearch").serialize(), + () => { } - }); + ); }, /* ======================== * 유효성 검증 diff --git a/src/main/webapp/WEB-INF/jsp/fims/biz/ec/ec0100Form.jsp b/src/main/webapp/WEB-INF/jsp/fims/biz/ec/ec0100Form.jsp new file mode 100644 index 00000000..0ea8c19e --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/fims/biz/ec/ec0100Form.jsp @@ -0,0 +1,197 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> + +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> + + +
+ + +
+ + + + + + + +
+ + 등록 + +
+ +
+
+ + +
+ + diff --git a/src/main/webapp/WEB-INF/jsp/fims/biz/ec/ec0100Popup.jsp b/src/main/webapp/WEB-INF/jsp/fims/biz/ec/ec0100Popup.jsp new file mode 100644 index 00000000..30ae0e01 --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/fims/biz/ec/ec0100Popup.jsp @@ -0,0 +1,154 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> +<%@ taglib prefix="validator" uri="http://www.springmodules.org/tags/commons-validator" %> + + +
+ + + + + + diff --git a/src/main/webapp/WEB-INF/jsp/fims/biz/rt/rt0200Sel.jsp b/src/main/webapp/WEB-INF/jsp/fims/biz/rt/rt0200Sel.jsp index 85130936..544655bb 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/biz/rt/rt0200Sel.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/biz/rt/rt0200Sel.jsp @@ -408,49 +408,33 @@ addData: function(){ - var param = $("#frmSearch").serialize(); - $.ajax({ - url : "/adm/send/rqst/mng/proc.do", - data : param, - type : "POST", - dataType : "json", - success : function(data) { - }, - error: function(){ - + fnAjax( + 'post', + '', + $("#frmSearch").serialize(), + () => { } - }); + ); }, modifyData: function(){ - var param = $("#frmSearch").serialize(); - $.ajax({ - url : "/adm/send/rqst/mng/proc.do", - data : param, - type : "PUT", - dataType : "json", - success : function(data) { - ARR_INSTANCE[CUR_TAB_SEQ].resetData(data); - }, - error: function(){ - + fnAjax( + 'post', + '', + $("#frmSearch").serialize(), + () => { } - }); + ); }, removeData: function(){ - var param = $("#frmSearch").serialize(); - $.ajax({ - url : "/adm/send/rqst/mng/proc.do", - data : param, - type : "DELETE", - dataType : "json", - success : function(data) { - }, - error: function(){ - + fnAjax( + 'post', + '', + $("#frmSearch").serialize(), + () => { } - }); + ); }, validate: function(flag){ diff --git a/src/main/webapp/WEB-INF/jsp/framework/biz/mng/menu/mngProgramMgtPopup.jsp b/src/main/webapp/WEB-INF/jsp/framework/biz/mng/menu/mngProgramMgtPopup.jsp index 33eb7046..d862d25f 100644 --- a/src/main/webapp/WEB-INF/jsp/framework/biz/mng/menu/mngProgramMgtPopup.jsp +++ b/src/main/webapp/WEB-INF/jsp/framework/biz/mng/menu/mngProgramMgtPopup.jsp @@ -109,24 +109,18 @@ addProgram : function(){ if(!validateProgrmMngVO(document.getElementById("progrmMngVO"))) return; -; + var varFrom = document.getElementById("progrmMngVO"); if(confirm("저장 하시겠습니까?")){ - var param = $(varFrom).serialize(); - $.ajax({ - url : "framework/biz/mng/menu/addProgram.do", - data : param, - type : "post", - dataType : "json", - success : function(data) { - alert(data.message); + fnAjax( + 'post', + '', + $(varFrom).serialize(), + () => { window.opener.findPrograms(); window.close(); - }, - error: function(){ - } - }); + ); } } /* ======================== @@ -138,42 +132,31 @@ var varFrom = document.getElementById("progrmMngVO"); if(confirm("변경 하시겠습니까?")){ - var param = $(varFrom).serialize(); - $.ajax({ - url : "framework/biz/mng/menu/modifyProgram.do", - data : param, - type : "post", - dataType : "json", - success : function(data) { - alert(data.message); + fnAjax( + 'post', + '', + $(varFrom).serialize(), + () => { window.opener.findPrograms(); window.close(); } - }); + ); } } /* ======================== * 데이터 삭제 ======================== */ ,removeProgram : function(){ - var varFrom = document.getElementById("progrmMngVO"); if(confirm("삭제 하시겠습니까?")){ - var param = $(varFrom).serialize(); - $.ajax({ - url : "framework/biz/mng/menu/removeProgram.do", - data : {progrmFileNm: $('#progrmFileNm').val()}, - type : "post", - dataType : "json", - success : function(data) { - alert(data.message); - console.log(data) - window.opener.findPrograms();//.mngProgramMgtForm.findData(); + fnAjax( + 'post', + '', + { progrmFileNm: $('#progrmFileNm').val() }, + () => { + window.opener.findPrograms(); window.close(); - }, - error: function(){ - } - }); + ); } } } diff --git a/src/main/webapp/resources/js/framework/cmmn/XitCmmnUtil.js b/src/main/webapp/resources/js/framework/cmmn/XitCmmnUtil.js index dbb51de7..41e1fb77 100644 --- a/src/main/webapp/resources/js/framework/cmmn/XitCmmnUtil.js +++ b/src/main/webapp/resources/js/framework/cmmn/XitCmmnUtil.js @@ -454,3 +454,25 @@ function toStringByFormatting(source, delimiter = '-') { return [year, month, day].join(delimiter); } + +/** + * + * @param {String} method POST / GET + * @param {String} url + * @param {Object} data + * @param {Function} callback + */ +const fnAjax = (method, url, data, callback) => { + $.ajax({ + url: url, + data: data, + type: method, + dataType: "json", + success: function (data) { + alert(data.message); + if (callback) callback() + }, + error: function () { + } + }) +};