fix: ajax call 공통처리
parent
bbf3f49240
commit
fbdbc8f089
@ -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" %>
|
||||
<style type="text/css">
|
||||
h1 {font-size:12px;}
|
||||
caption {visibility:hidden; font-size:0; height:0; margin:0; padding:0; line-height:0;}
|
||||
</style>
|
||||
|
||||
<form name="frmSearch" id="frmSearch">
|
||||
|
||||
<div class="search r2">
|
||||
<table>
|
||||
<caption>검색조건</caption>
|
||||
<colgroup>
|
||||
<col style="width: 15%">
|
||||
<col style="width: 20%;">
|
||||
<col style="width: 8%;">
|
||||
<col>
|
||||
<col style="width: 8%;">
|
||||
<col>
|
||||
<col style="width: 7%;">
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<th>프로그램 한글명</th>
|
||||
<td>
|
||||
<input name="searchKeyword" id="searchKeyword" type="text" size="60" value="<c:out value='${searchKeyword}'/>" maxlength="60" title="검색조건">
|
||||
</td>
|
||||
<td colspan="6">
|
||||
<input type="button" id="btnSearch" class="btn_search" title="검색" value="검색" />
|
||||
</td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
<!-- //검색 -->
|
||||
|
||||
<!-- 페이지 Open 방식에 따라 버튼 표출 분기(일반페이지 or 팝업페이지) -->
|
||||
<c:choose>
|
||||
<c:when test="${param.tilesDef == 'popup'}">
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<div class="page_btn">
|
||||
<span class="flr">
|
||||
<a href="#" class="btn darkgray" id="btnRegist" title="등록" onClick="mngProgramMgtForm.addProgram()">등록</a>
|
||||
</span>
|
||||
</div>
|
||||
<!-- //버튼 및 페이지정보 -->
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
|
||||
<!-- 데이터 출력 -->
|
||||
<div id="grid_t0"></div>
|
||||
|
||||
<script type="text/javaScript" language="javascript">
|
||||
let GRID = null;
|
||||
|
||||
/* ========================
|
||||
* 데이터 조회 : popup에서 사용
|
||||
======================== */
|
||||
var findEc0100List = function(){
|
||||
GRID.reloadData();
|
||||
};
|
||||
|
||||
/* ========================
|
||||
* 상세 팝업 오픈 버튼 클릭
|
||||
-상세 팝업을 OPEN 한다.
|
||||
======================== */
|
||||
const fnClickProgramBtn = (props) => {
|
||||
const rowData = props.grid.getRow(props.rowKey);
|
||||
|
||||
CmmPopup.open(
|
||||
'<c:url value="/fims/biz/ec/ec0100Popup.do"/>'
|
||||
, {
|
||||
progrmFileNm: rowData.progrmFileNm
|
||||
}
|
||||
, {
|
||||
width: 720
|
||||
, height: 655
|
||||
}
|
||||
, '프로그램 상세'
|
||||
)
|
||||
};
|
||||
|
||||
const init = () => {
|
||||
|
||||
const gridColumns = [ //Grid 컬럼 정보(명칭,매핑 field, 기타옵션 등)
|
||||
{
|
||||
header: '프로그램 파일명',
|
||||
name: 'progrmFileNm',
|
||||
minWidth: 200,
|
||||
sortable: true,
|
||||
sortingType: 'desc',
|
||||
align: 'left',
|
||||
<!-- 페이지 Open 방식에 따라 버튼 표출 분기(일반페이지 or 팝업페이지) -->
|
||||
<c:if test="${param.tilesDef != 'popup'}">
|
||||
renderer: {
|
||||
type: CustomButtonRenderer,
|
||||
options: {
|
||||
formatter : (props) => ({
|
||||
formatter : props.grid.getRow(props.rowKey).progrmFileNm
|
||||
, element: "text"
|
||||
})
|
||||
, eventFunction: this.fnClickProgramBtn //function(){alert("1234")}
|
||||
, eventType : "click"
|
||||
}
|
||||
}
|
||||
</c:if>
|
||||
},
|
||||
{
|
||||
header: '프로그램 한글명',
|
||||
name: 'progrmKoreanNm',
|
||||
minWidth: 200,
|
||||
sortable: false,
|
||||
align: 'left'
|
||||
},
|
||||
{
|
||||
header: 'URL',
|
||||
name: 'url',
|
||||
minWidth: 300,
|
||||
sortable: true,
|
||||
align: 'left'
|
||||
},
|
||||
{
|
||||
header: '프로그램 설명',
|
||||
name: 'progrmDc',
|
||||
width: 150,
|
||||
sortable: false,
|
||||
align: 'left'
|
||||
}
|
||||
];
|
||||
const gridDatasource = { //DataSource
|
||||
/* -----------------------
|
||||
* DataSource API Setting
|
||||
----------------------- */
|
||||
//initialRequest: true, // 화면 load시 조회 안함 - default
|
||||
api: {
|
||||
readData: {
|
||||
url: '<c:url value="/fims/biz/ec/findEc0100List.do"/>'
|
||||
, method: 'get'
|
||||
, serializer: (params) => {
|
||||
return fnAddPageInfo(document.frmSearch, params);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const gridOptions = {
|
||||
el: 'grid_t0',
|
||||
rowHeaders: ['rowNum'],
|
||||
columns: gridColumns,
|
||||
columnOptions: {
|
||||
frozenCount: 1 //고정컬럼 갯수
|
||||
, minWidth: 80 //최소 사이즈
|
||||
}
|
||||
};
|
||||
GRID = TuiGrid.of(gridOptions, gridDatasource, (res) => {
|
||||
console.log('Grid~~~~~~~~~');
|
||||
|
||||
});
|
||||
/* ******************************
|
||||
* Grid end
|
||||
****************************** */
|
||||
|
||||
/** ******************************
|
||||
* Event 정의
|
||||
* ******************************/
|
||||
$('#btnSearch').on('click', () => {
|
||||
GRID.reloadData();
|
||||
//GRID.refreshLayout();
|
||||
});
|
||||
};
|
||||
|
||||
/* ========================
|
||||
* 데이터 등록
|
||||
======================== */
|
||||
const addProgram = () => {
|
||||
CmmPopup.open(
|
||||
'<c:url value="/fims/biz/ec/ec0100Popup.do"/>'
|
||||
, null
|
||||
, {
|
||||
width: 720
|
||||
, height: 655
|
||||
}
|
||||
, 'EC ㄷㅡㅇ록'
|
||||
)
|
||||
};
|
||||
|
||||
|
||||
// initialize
|
||||
$(document).ready(function(){
|
||||
init();
|
||||
});
|
||||
</script>
|
@ -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" %>
|
||||
|
||||
|
||||
<form id="frmEc0100">
|
||||
|
||||
<div class="popup" style="min-width: 700px;">
|
||||
<div class="popup_inner" style="max-width:700px;">
|
||||
<p class="pop_title"> 프로그램 상세조회 /수정</p>
|
||||
<table class="tbl03">
|
||||
<caption>프로그램 상세조회 /수정</caption>
|
||||
<colgroup>
|
||||
<col style="width: 20%; height: 23px;">
|
||||
<col style="width: 80%; height: 23px;">
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row" class="required"><label for="progrmFileNm">프로그램파일명</label>
|
||||
<td nowrap="nowrap">
|
||||
<c:choose>
|
||||
<c:when test="${!empty progrmMngVO.progrmFileNm and fn:length(progrmMngVO.progrmFileNm) > 0}">
|
||||
<input type="text" id='progrmFileNm' name='progrmFileNm' disabled="disabled" value="<c:out value='${progrmMngVO.progrmFileNm}'/>">
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<input type="text" id='progrmFileNm' name='progrmFileNm' value="<c:out value='${progrmMngVO.progrmFileNm}'/>">
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
<form:input path="progrmFileNm" size="50" maxlength="50" title="프로그램파일명" cssStyle="display:none" />
|
||||
<form:errors path="progrmFileNm"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="required" scope="row"><label for="progrmStrePath">저장경로</label>
|
||||
<td nowrap="nowrap">
|
||||
<form:input path="progrmStrePath" size="50" maxlength="50" title="저장경로" disabled="disabled"/>
|
||||
<form:errors path="progrmStrePath"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="required" scope="row"><label for="progrmKoreanNm">프로그램 한글명</label>
|
||||
<td nowrap="nowrap">
|
||||
<form:input path="progrmKoreanNm" size="60" maxlength="50" title="프로그램 한글명"/>
|
||||
<form:errors path="progrmKoreanNm" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="required" scope="row"><label for="URL">URL</label>
|
||||
<td nowrap="nowrap">
|
||||
<form:input path="URL" size="100" maxlength="100" title="URL" />
|
||||
<form:errors path="URL" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="required" scope="row"><label for="progrmDc">프로그램설명</label></th>
|
||||
<td>
|
||||
<form:textarea path="progrmDc" rows="14" cols="75" title="프로그램설명"/>
|
||||
<form:errors path="progrmDc"/>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="popup_btn">
|
||||
<span class="flr" colspan="4">
|
||||
<c:choose>
|
||||
<c:when test="${!empty progrmMngVO.progrmFileNm and fn:length(progrmMngVO.progrmFileNm) > 0}">
|
||||
<a href="#LINK" class="btn blue" id="btnUpdate" onclick="mngProgramMgtPopup.modifyProgram()">변경</a>
|
||||
<a href="#LINK" class="btn red" id="btnDelete" onclick="mngProgramMgtPopup.removeProgram()">삭제</a>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<a href="#LINK" class="btn blue" id="btnUpdate" onClick="mngProgramMgtPopup.addProgram()">등록</a>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
<a href="#" class="btn lightgray" id="btnClose" onclick="window.close()">닫기</a>
|
||||
</span>
|
||||
</div>
|
||||
<!-- //등록버튼 -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- //popup -->
|
||||
</form:form>
|
||||
|
||||
<script type="text/javaScript" language="javascript">
|
||||
const init = () => {
|
||||
//닫기 버튼 Event
|
||||
$("#btnClose").click(function() {
|
||||
window.close();
|
||||
});
|
||||
|
||||
$(".popup").css("position","absolute");
|
||||
$(".content_header").css("display","none");
|
||||
$("#cur_loc").css("display","none");
|
||||
};
|
||||
|
||||
const addEc0100 = () => {
|
||||
//유효성 체크
|
||||
//if(!validateProgrmMngVO(document.getElementById("progrmMngVO")))
|
||||
// return;
|
||||
|
||||
const varFrom = document.getElementById("frmEc0100");
|
||||
if(confirm("저장 하시겠습니까?")){
|
||||
fnAjax(
|
||||
'post',
|
||||
'/fims/biz/ec/addEc0100.do',
|
||||
$(varFrom).serialize(),
|
||||
() => {
|
||||
window.opener.findEc0100List();
|
||||
window.close();
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const modifyEc0100 = () => {
|
||||
//if(!validateProgrmMngVO(document.getElementById("progrmMngVO")))
|
||||
// return;
|
||||
|
||||
const varFrom = document.getElementById("frmEc0100");
|
||||
if(confirm("변경 하시겠습니까?")){
|
||||
fnAjax(
|
||||
'post',
|
||||
'<c:url value="/fims/biz/ec/modifyEc0100.do"/>',
|
||||
$(varFrom).serialize(),
|
||||
() => {
|
||||
window.opener.findEc0100List();
|
||||
window.close();
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const removeEc0100 = () => {
|
||||
if(confirm("삭제 하시겠습니까?")){
|
||||
fnAjax(
|
||||
'post',
|
||||
'<c:url value="fims/biz/ec/modifyEc0100.do"/>',
|
||||
{},
|
||||
() => {
|
||||
window.opener.findEc0100List();
|
||||
window.close();
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
$(document).ready(function(){
|
||||
mngProgramMgtPopup.init();
|
||||
});
|
||||
</script>
|
Loading…
Reference in New Issue