주요사건처리현황 임시저장수정

master
서예린 2023-01-08 21:31:03 +09:00
parent 98ee5f5630
commit 16b827ddb4
3 changed files with 107 additions and 79 deletions

View File

@ -6,6 +6,41 @@ $("#jqueryBtn").click(function(){
}); });
$(document).on('click', '#saveBtn', function (){
if(confirm("저장하시겠습니까?")){
if($('#contentTitle').val() == ''){
alert("제목을 입력해주세요.");
$('#contentTitle').focus();
return false;
}
if($('#majorType').val() == ''){
alert("종류를 선택해주세요.");
$('#majorType').focus();
return false;
}
saveContent('DST007');
}
})
$(document).on('click', '#saveTempBtn', function (){
if(confirm("임시저장 하시겠습니까?")){
if($('#contentTitle').val() == ''){
alert("제목을 입력해주세요.");
$('#contentTitle').focus();
return false;
}
if($('#majorType').val() == ''){
alert("종류를 선택해주세요.");
$('#majorType').focus();
return false;
}
saveContent('DST001');
}
})
$(document).on('click', '#addMajorBtn', function (){ $(document).on('click', '#addMajorBtn', function (){
getEditModal(null) getEditModal(null)
}) })
@ -16,17 +51,10 @@ $(document).on('click', '.tr', function (){
getViewModal(Number($(this).find(".majorKey").val())); getViewModal(Number($(this).find(".majorKey").val()));
}) })
// $(document).on('click', '.tr', function (event){
// const target = event.target;
// if(!(target.className === "cpChk" ||$(target).parents("td").length>0)){
// const phoneKey = (Number($(this).find(".phoneKey").val()));
// showModal(phoneKey);
// }
// });
$(document).on('click', '#saveBtn', function (){ // $(document).on('click', '#saveBtn', function (){
saveContent("MajorEditForm") // saveContent("MajorEditForm")
}) // })
$(document).on('click', '#editBtn', function (){ $(document).on('click', '#editBtn', function (){
$("#MajorViewModal").modal('hide') $("#MajorViewModal").modal('hide')
@ -72,37 +100,7 @@ $(document).on('click', '#deleteMajorBtn', function (){
} }
}) })
// $(document).on('click', '#delectMajorBtn', function (){
// if(confirm("선택한 대상을 삭제처리 하시겠습니까?")){
// const checkArr = [];
// $('input:checkbox[name=equChk]:checked').each(function (idx, el){
// checkArr.push({});
// const target = $(el);
// checkArr[idx].equKey = Number(target.parents('tr').find('.majorKey').val());
// })
// deleteMajor(checkArr);
//
// }
// })
// function deleteMajor(checkArr){
// $.ajax({
// type : 'POST',
// url : "/ivsgt/deleteContent",
// data : JSON.stringify(checkArr),
// contentType: 'application/json',
// beforeSend: function (xhr){
// xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val());
// },
// success : function() {
// alert("삭제처리 되었습니다.");
// location.reload();
// },
// error : function(xhr, status) {
// alert("삭제처리에 실패하였습니다");
// }
// })
// }
function getEditModal(majorKey){ function getEditModal(majorKey){
$.ajax({ $.ajax({
@ -140,16 +138,7 @@ function getViewModal(majorKey){
} }
function saveContent(contentStatus){ function saveContent(contentStatus){
if(confirm("저장하시겠습니까?")){ const formData = new FormData($("#MajorEditForm")[0]);
let flag = true;
if(contentStatus === "DST007"){
flag = contentCheck();
}
if(flag){
contentFade("in");
const MajorEditForm = $("#MajorEditForm");
MajorEditForm.find("contentStatus").val(contentStatus);
const formData = new FormData(MajorEditForm[0]);
for(const file of files) { for(const file of files) {
if(!file.isDelete) if(!file.isDelete)
formData.append('uploadFiles', file, file.name); formData.append('uploadFiles', file, file.name);
@ -157,7 +146,7 @@ function saveContent(contentStatus){
$(".text-decoration-line-through").each(function (idx, el){ $(".text-decoration-line-through").each(function (idx, el){
formData.append('fileSeq', $(el).attr("data-fileseq")); formData.append('fileSeq', $(el).attr("data-fileseq"));
}) })
formData.append('contentInfo', CrossEditor.GetBodyValue()); formData.append('contentStatus', contentStatus);
$.ajax({ $.ajax({
type : 'POST', type : 'POST',
data : formData, data : formData,
@ -167,8 +156,7 @@ function saveContent(contentStatus){
success : function(result) { success : function(result) {
alert("저장되었습니다."); alert("저장되었습니다.");
contentFade("out"); contentFade("out");
$("#MajorEditModal").modal('hide'); location.reload();
getViewModal(result);
}, },
error : function(xhr, status) { error : function(xhr, status) {
alert("저장에 실패하였습니다.") alert("저장에 실패하였습니다.")
@ -176,8 +164,47 @@ function saveContent(contentStatus){
} }
}) })
} }
}
}
// function saveContent(contentStatus){
// if(confirm("저장하시겠습니까?")){
// let flag = true;
// if(contentStatus === "DST007"){
// flag = contentCheck();
// }
// if(flag){
// contentFade("in");
// const MajorEditForm = $("#MajorEditForm");
// MajorEditForm.find("contentStatus").val(contentStatus);
// const formData = new FormData(MajorEditForm[0]);
// for(const file of files) {
// if(!file.isDelete)
// formData.append('uploadFiles', file, file.name);
// }
// $(".text-decoration-line-through").each(function (idx, el){
// formData.append('fileSeq', $(el).attr("data-fileseq"));
// })
// formData.append('contentInfo', CrossEditor.GetBodyValue());
// $.ajax({
// type : 'POST',
// data : formData,
// url : "/ivsgt/saveContent",
// processData: false,
// contentType: false,
// success : function(result) {
// alert("저장되었습니다.");
// contentFade("out");
// $("#MajorEditModal").modal('hide');
// getViewModal(result);
// },
// error : function(xhr, status) {
// alert("저장에 실패하였습니다.")
// contentFade("out");
// }
// })
// }
// }
// }
function contentCheck(formId){ function contentCheck(formId){
let flag = true; let flag = true;

View File

@ -14,7 +14,6 @@
<input type="hidden" name="wrtUserSeq" th:value="${majorStatus.wrtUserSeq}"> <input type="hidden" name="wrtUserSeq" th:value="${majorStatus.wrtUserSeq}">
<input type="hidden" name="wrtUserGrd" th:value="${majorStatus.wrtUserGrd}"> <input type="hidden" name="wrtUserGrd" th:value="${majorStatus.wrtUserGrd}">
<input type="hidden" name="wrtUserNm" th:value="${majorStatus.wrtUserNm}"> <input type="hidden" name="wrtUserNm" th:value="${majorStatus.wrtUserNm}">
<input type="hidden" name="contentStatus" id="contentStatus" th:value="${majorStatus.contentStatus}">
<div class="row mb-1"> <div class="row mb-1">
<label for="wrtUserNm" class="col-sm-2 col-form-label col-form-label-sm text-center">작성자</label> <label for="wrtUserNm" class="col-sm-2 col-form-label col-form-label-sm text-center">작성자</label>
<div class="col-sm-2"> <div class="col-sm-2">
@ -75,7 +74,7 @@
</form> </form>
</div> </div>
<div class="modal-footer bg-light"> <div class="modal-footer bg-light">
<button type="button" class="btn btn-warning" id="saveTempBtn" data-ContentStatus="DST001">임시저장</button> <button type="button" class="btn btn-warning" id="saveTempBtn" data-contentStatus="DST001">임시저장</button>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
<button type="button" class="btn btn-primary" id="saveBtn">저장</button> <button type="button" class="btn btn-primary" id="saveBtn">저장</button>
</div> </div>

View File

@ -79,7 +79,9 @@
<tr class="tr" th:each="major:${majorList}"> <tr class="tr" th:each="major:${majorList}">
<input type="hidden" class="majorKey" th:value="${major.majorKey}"> <input type="hidden" class="majorKey" th:value="${major.majorKey}">
<!-- <td><input type="checkbox" class="trChkBox"></td>--> <!-- <td><input type="checkbox" class="trChkBox"></td>-->
<td th:text="${major.majorType}"></td> <th:block th:each="commonCode:${session.commonCode.get('MST')}">
<td th:if="${major.majorType eq commonCode.itemCd}" th:text="${commonCode.itemValue}"></td>
</th:block>
<td th:text="|${major.contentStatus eq 'DST001'?'[임시]':''}${major.contentTitle}|"></td> <td th:text="|${major.contentStatus eq 'DST001'?'[임시]':''}${major.contentTitle}|"></td>
<th:block th:each="commonCode:${session.commonCode.get('OG')}"> <th:block th:each="commonCode:${session.commonCode.get('OG')}">
<td th:if="${major.wrtOrgan eq commonCode.itemCd}" th:text="${commonCode.itemValue}"></td> <td th:if="${major.wrtOrgan eq commonCode.itemCd}" th:text="${commonCode.itemValue}"></td>