|
|
@@ -27,7 +27,27 @@
|
|
|
|
|
|
<!-- 검색조건 영역 -->
|
|
|
<div class="panelStyle">
|
|
|
- <form id="registerForm" name="registerForm" action="#" th:action="@{'/system/sample/file/save'}">
|
|
|
+ <!-- Search -->
|
|
|
+ <form id="searchForm" name="searchForm" action="#" th:action="@{'/system/sample/file/list'}" onsubmit="$('#btnSearch').trigger('click'); return false;">
|
|
|
+ <ul class="panelBar">
|
|
|
+ <li class="center">
|
|
|
+ <button type="button" class="btn btn-base btn-lg" id="btnSearch">조회</button>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </form>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 리스트 영역 -->
|
|
|
+ <div class="panelStyle">
|
|
|
+ <div id="gridList" style="width: 100%; height: 470px" class="ag-theme-balham"></div>
|
|
|
+ </div>
|
|
|
+ <!-- //리스트 영역 -->
|
|
|
+
|
|
|
+ <!-- 등록/수정 영역 -->
|
|
|
+ <div class="panelStyle">
|
|
|
+ <form id="detailForm" name="detailForm" action="#" th:action="@{'/system/sample/file/save'}">
|
|
|
+ <input type="hidden" name="mode" value="N"/>
|
|
|
+
|
|
|
<table class="frmStyle" aria-describedby="신규">
|
|
|
<colgroup>
|
|
|
<col style="width:10%;"/>
|
|
|
@@ -69,20 +89,14 @@
|
|
|
</table>
|
|
|
|
|
|
<ul class="panelBar">
|
|
|
- <li class="center">
|
|
|
+ <li class="right">
|
|
|
<button type="button" class="btn btn-info btn-lg" id="btnNew">신규</button>
|
|
|
<button type="button" class="btn btn-success btn-lg" id="btnSave">저장</button>
|
|
|
</li>
|
|
|
</ul>
|
|
|
</form>
|
|
|
</div>
|
|
|
- <!-- //검색조건 영역 -->
|
|
|
-
|
|
|
- <!-- 리스트 영역 -->
|
|
|
- <div class="panelStyle">
|
|
|
- <div id="gridList" style="width: 100%; height: 570px" class="ag-theme-balham"></div>
|
|
|
- </div>
|
|
|
- <!-- //리스트 영역 -->
|
|
|
+ <!-- //등록/수정 영역 -->
|
|
|
</div>
|
|
|
|
|
|
<script th:inline="javascript">
|
|
|
@@ -108,31 +122,39 @@
|
|
|
if (event.colDef.field != 'sampleFileNm')
|
|
|
return;
|
|
|
|
|
|
- $('#registerForm input[name=sampleFileId]').val(event.data.sampleFileId);
|
|
|
- $('#registerForm input[name=sampleFileNm]').val(event.data.sampleFileNm);
|
|
|
- $('#registerForm input[name=orgFileNm]').val(event.data.orgFileNm);
|
|
|
- $('#registerForm input[name=sysFileNm]').val(event.data.sysFileNm);
|
|
|
+ $('#detailForm input[name=mode]').val('U');
|
|
|
+ $('#detailForm input[name=sampleFileId]').val(event.data.sampleFileId);
|
|
|
+ $('#detailForm input[name=sampleFileNm]').val(event.data.sampleFileNm);
|
|
|
+ $('#detailForm input[name=orgFileNm]').val(event.data.orgFileNm);
|
|
|
+ $('#detailForm input[name=sysFileNm]').val(event.data.sysFileNm);
|
|
|
$('#sampleFileList').html('<a href="javascript:void(0);" onclick="cfnDownloadSampleFile(\'' + event.data.sampleFileId + '\');">' + event.data.sysFileNm + '</a>');
|
|
|
$('#sampleFileList').show();
|
|
|
|
|
|
if (event.data.useYn == 'Y') {
|
|
|
- $("#registerForm input:checkbox[name=chkUseYn]").prop('checked', true);
|
|
|
+ $("#detailForm input:checkbox[name=chkUseYn]").prop('checked', true);
|
|
|
} else {
|
|
|
- $("#registerForm input:checkbox[name=chkUseYn]").prop('checked', false);
|
|
|
+ $("#detailForm input:checkbox[name=chkUseYn]").prop('checked', false);
|
|
|
}
|
|
|
+
|
|
|
+ $('#detailForm input:checkbox[name=chkUseYn]').attr('readonly', false);
|
|
|
}
|
|
|
|
|
|
// 조회
|
|
|
- $('#searchForm').on('click', function() {
|
|
|
- gagaAgGrid.fetch('/system/sample/file/list', gridOptions);
|
|
|
+ $('#btnSearch').on('click', function() {
|
|
|
+ let actionUrl = $('#searchForm').prop('action') + '?' + $('#searchForm').serialize();
|
|
|
+
|
|
|
+ // Fetch data
|
|
|
+ gagaAgGrid.fetch(actionUrl, gridOptions);
|
|
|
});
|
|
|
|
|
|
// 신규
|
|
|
$('#btnNew').on('click', function() {
|
|
|
- $('#registerForm')[0].reset();
|
|
|
- $('#registerForm input[name=sampleFileId]').val('자동생성');
|
|
|
- $('#registerForm input[name=file]').val('');
|
|
|
- $('#registerForm input:checkbox[name=chkUseYn]').prop('checked', true);
|
|
|
+ $('#detailForm')[0].reset();
|
|
|
+ $('#detailForm input[name=mode]').val('N');
|
|
|
+ $('#detailForm input[name=sampleFileId]').val('자동생성');
|
|
|
+ $('#detailForm input[name=file]').val('');
|
|
|
+ $('#detailForm input:checkbox[name=chkUseYn]').prop('checked', true);
|
|
|
+ $('#detailForm input:checkbox[name=chkUseYn]').attr('readonly', true);
|
|
|
$('#sampleFileList').html('');
|
|
|
$('#sampleFileList').hide();
|
|
|
});
|
|
|
@@ -140,25 +162,25 @@
|
|
|
// 저장 처리
|
|
|
$('#btnSave').on('click', function() {
|
|
|
// 입력 값 체크
|
|
|
- if (!gagajf.validation('#registerForm'))
|
|
|
+ if (!gagajf.validation('#detailForm'))
|
|
|
return;
|
|
|
|
|
|
- if (gagajf.isNull($('#registerForm input[name=sysFileNm]').val())) {
|
|
|
+ if (gagajf.isNull($('#detailForm input[name=sysFileNm]').val())) {
|
|
|
mcxDialog.alert('샘플파일을 선택해 주세요.');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- $('#registerForm input[name=useYn]').val($('#registerForm input:checkbox[name=chkUseYn]').is(":checked") ? 'Y' : 'N');
|
|
|
+ $('#detailForm input[name=useYn]').val($('#detailForm input:checkbox[name=chkUseYn]').is(":checked") ? 'Y' : 'N');
|
|
|
|
|
|
mcxDialog.confirm("저장하시겠습니까?", {
|
|
|
cancelBtnText: "취소",
|
|
|
sureBtnText: "확인",
|
|
|
sureBtnClick: function() {
|
|
|
- gagajf.ajaxFormSubmit($('#registerForm').prop('action')
|
|
|
- , $('#registerForm')
|
|
|
+ gagajf.ajaxFormSubmit($('#detailForm').prop('action')
|
|
|
+ , $('#detailForm')
|
|
|
, function() {
|
|
|
$('#btnNew').trigger('click');
|
|
|
- fnSearch();
|
|
|
+ $('#btnSearch').trigger('click');
|
|
|
}
|
|
|
);
|
|
|
}
|
|
|
@@ -166,7 +188,7 @@
|
|
|
});
|
|
|
|
|
|
// 파일첨부 선택 시
|
|
|
- $('#registerForm input[name=file]').on('change', function() {
|
|
|
+ $('#detailForm input[name=file]').on('change', function() {
|
|
|
// multiple 속성이 있으면 files에는 다수의 객체가 할당됨
|
|
|
var file = this.files[0];
|
|
|
|
|
|
@@ -175,8 +197,8 @@
|
|
|
, file
|
|
|
, function(result) {
|
|
|
// 업로드한 파일명 설정
|
|
|
- $('#registerForm input[name=orgFileNm]').val(result.oldFileName);
|
|
|
- $('#registerForm input[name=sysFileNm]').val(result.newFileName);
|
|
|
+ $('#detailForm input[name=orgFileNm]').val(result.oldFileName);
|
|
|
+ $('#detailForm input[name=sysFileNm]').val(result.newFileName);
|
|
|
}
|
|
|
);
|
|
|
});
|