From 44a2834ccc504b16af39ee72027c42e2fa0854c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EC=84=9D=20=EC=B5=9C?= Date: Thu, 8 Dec 2022 11:07:56 +0900 Subject: [PATCH] =?UTF-8?q?=EC=99=B8=EC=82=AC=EC=88=98=EC=82=AC=EA=B4=80?= =?UTF-8?q?=EB=A6=AC=20=EB=AA=A8=EB=8B=AC=20=EC=88=98=EC=A0=95=20=EC=99=84?= =?UTF-8?q?=EB=A3=8C.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/static/js/ivsgt/ivsgt.js | 284 ++++++++---------- .../templates/ivsgt/ivsgtEditModal.html | 248 +++++++-------- .../templates/ivsgt/ivsgtViewModal.html | 7 +- 3 files changed, 260 insertions(+), 279 deletions(-) diff --git a/src/main/resources/static/js/ivsgt/ivsgt.js b/src/main/resources/static/js/ivsgt/ivsgt.js index 3b951e8e..f14164af 100644 --- a/src/main/resources/static/js/ivsgt/ivsgt.js +++ b/src/main/resources/static/js/ivsgt/ivsgt.js @@ -1,212 +1,190 @@ $(document).on('click', '#ivsgtAddBtn', function () { - getIvsgtEditModal(null, $("input[name='ivsgtType']").val()); + getIvsgtEditModal(null, $("input[name='ivsgtType']").val()); }); $(document).on('click', '#ivsgtEditBtn', function () { - $("#ivsgtViewModal").modal('hide'); - getIvsgtEditModal(Number($("#ivsgtViewBody").find("[name='ivsgtKey']").val())); -}); - - -$(document).on('click', '#contentInfoAddBtn', function (){ - $("#contentInfoDiv").append("") + $("#ivsgtViewModal").modal('hide'); + getIvsgtEditModal(Number($("#ivsgtViewBody").find("[name='ivsgtKey']").val())); }); $(document).on('click', '#saveIvsgtBtn', function (){ - saveBoardInvestigation('N') + saveBoardInvestigation('N') }); $(document).on('click', '#saveTempBtn', function (){ - saveBoardInvestigation('Y') + saveBoardInvestigation('Y') }); $(document).on('click', '.tr', function (){ - getIvsgtViewModal($(this).data('key')); + getIvsgtViewModal($(this).data('key')); }); $(document).on('click', '.ivsgtTab', function (){ - location.href = "/ivsgt/"+ $(this).data("ivsgt-type"); + location.href = "/ivsgt/"+ $(this).data("ivsgt-type"); }); $(document).on('click', '#relatedReportSearchBtn', function (){ - let contentTitle = $("#ivsgtEditBody").find("[name='searchTitle']").val(); - let ivsgtType = $("#ivsgtEditBody").find("[name='ivsgtType']").val(); - getSearchViewModal(ivsgtType, contentTitle) + let contentTitle = $("#ivsgtEditBody").find("[name='searchTitle']").val(); + let ivsgtType = $("#ivsgtEditBody").find("[name='ivsgtType']").val(); + getSearchViewModal(ivsgtType, contentTitle) }); $(document).on('click', '#completeBtn', function (){ - const checkbox = document.getElementsByClassName('reportChk'); + const checkbox = document.getElementsByClassName('reportChk'); - Array.from(checkbox).forEach(function(element) { - if (element.checked) { - $('#relatedReportSearchDiv').append( - '' - + '' - + '
' - + '
' - ) - } - }); + Array.from(checkbox).forEach(function(element) { + if (element.checked) { + $('#relatedReportSearchDiv').append( + '
' + + ' '+ + ' '+ + ' '+ + '
' + + ' '+ + ' ' + + '
' + + '
' + ) + } + }); }); $(document).on('click', '.cancel-btn', function (){ - $(this).parent().remove(); - let deleteKey = $(this).parent().children("input[name='relatedReportsKeyList']").val(); - $("#ivsgtEditForm").append(''); + $(this).parent().remove(); + let deleteKey = $(this).parent().children("input[name='relatedReportsKeyList']").val(); + $("#ivsgtEditForm").append(''); }); $(document).on('change', '#arrestCd', function (){ - dynamicOption('#arrestCd2', $(this).val()); + dynamicOption('#arrestCd2', $(this).val()); }); $(document).on('change', '#searchArrestCd', function (){ - dynamicOption('#searchArrestCd2', $(this).val(), '검거유형2'); + dynamicOption('#searchArrestCd2', $(this).val(), '검거유형2'); }); $(function(){ - $("#dateSelectorDiv").datepicker({ - format: "yyyy-mm-dd", - language: "ko", - autoclose: true - }); + $("#dateSelectorDiv").datepicker({ + format: "yyyy-mm-dd", + language: "ko", + autoclose: true + }); }); function getIvsgtViewModal(ivsgtKey){ - $.ajax({ - url: '/ivsgt/ivsgtViewModal', - data: {ivsgtKey: ivsgtKey}, - type: 'GET', - dataType:"html", - success: function(html){ - $("#ivsgtViewBody").empty().append(html) - $("#ivsgtViewModal").modal('show'); - }, - error:function(){ + $.ajax({ + url: '/ivsgt/ivsgtViewModal', + data: {ivsgtKey: ivsgtKey}, + type: 'GET', + dataType:"html", + success: function(html){ + $("#ivsgtViewBody").empty().append(html) + $("#ivsgtViewModal").modal('show'); + }, + error:function(){ - } - }); + } + }); } function getIvsgtEditModal(ivsgtKey, ivsgtType){ - $.ajax({ - url: '/ivsgt/ivsgtEditModal', - data: { - ivsgtKey: ivsgtKey, - ivsgtType: ivsgtType - }, - type: 'GET', - dataType:"html", - success: function(html){ - $("#ivsgtViewBody").empty(); - $("#ivsgtEditModalContent").empty().append(html) - $("#ivsgtEditModal").modal('show'); - $("[name='contentInfo']").summernote({ - lang:'ko-KR', - height: 120, - disableDragAndDrop: true, - toolbar: [ - ['style', ['style']], - ['font', ['bold', 'underline', 'clear']], - ['color', ['color']], - ['para', ['ul', 'ol', 'paragraph']], - ['table', ['table']] - ] - }); - $("[name='contentMain']").summernote({ - lang:'ko-KR', - height: 120, - disableDragAndDrop: true, - toolbar: [ - ['style', ['style']], - ['font', ['bold', 'underline', 'clear']], - ['color', ['color']], - ['para', ['ul', 'ol', 'paragraph']], - ['table', ['table']] - ] - }); - setUploadDiv(); - }, - error:function(){ + $.ajax({ + url: '/ivsgt/ivsgtEditModal', + data: { + ivsgtKey: ivsgtKey, + ivsgtType: ivsgtType + }, + type: 'GET', + dataType:"html", + success: function(html){ + $("#ivsgtViewBody").empty(); + $("#ivsgtEditModalContent").empty().append(html) + $("#ivsgtEditModal").modal('show'); + setEditor('editor', '400') + setUploadDiv(); + }, + error:function(){ - } - }); + } + }); } function getSearchViewModal(ivsgtType, contentTitle){ - $.ajax({ - url: '/ivsgt/searchViewModal', - data: { - contentTitle: contentTitle, - ivsgtType: ivsgtType - }, - type: 'GET', - dataType:"html", - success: function(html){ - $("#searchViewBody").empty().append(html) - $("#searchViewModal").modal('show'); - }, - error:function(){ + $.ajax({ + url: '/ivsgt/searchViewModal', + data: { + contentTitle: contentTitle, + ivsgtType: ivsgtType + }, + type: 'GET', + dataType:"html", + success: function(html){ + $("#searchViewBody").empty().append(html) + $("#searchViewModal").modal('show'); + }, + error:function(){ - } - }); + } + }); } function saveBoardInvestigation(contentState){ - if(contentCheck()){ - if(confirm("저장하시겠습니까?")){ - $("#contentStatus").val(contentState); - contentFade("in"); - const formData = new FormData($("#ivsgtEditForm")[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")); - }) - $.ajax({ - type : 'POST', - data : formData, - url : "/ivsgt/saveBoardInvestigation", - processData: false, - contentType: false, - success : function(result) { - alert("저장되었습니다."); - contentFade("out"); - $("#ivsgtEditModal").modal('hide'); - getIvsgtViewModal(result); - }, - error : function(xhr, status) { - alert("저장에 실패하였습니다.") - contentFade("out"); - } - }) + if(contentCheck()){ + if(confirm("저장하시겠습니까?")){ + $("#contentStatus").val(contentState); + contentFade("in"); + const formData = new FormData($("#ivsgtEditForm")[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('contentMain', CrossEditor.GetBodyValue()); + $.ajax({ + type : 'POST', + data : formData, + url : "/ivsgt/saveBoardInvestigation", + processData: false, + contentType: false, + success : function(result) { + alert("저장되었습니다."); + contentFade("out"); + $("#ivsgtEditModal").modal('hide'); + getIvsgtViewModal(result); + }, + error : function(xhr, status) { + alert("저장에 실패하였습니다.") + contentFade("out"); } + }) } + } } function contentCheck(){ - let flag = true; - if(!$("#contentTitle").val()){ - alert("제목을 입력해주세요.") - flag = false; - } - else if(!$("#arrestCd").val()){ - alert("검거유형1을 선택해주세요.") - flag = false; - } - else if(!$("#arrestCd2").val()){ - alert("검거유형2를 선택해주세요.") - flag = false; - } - else if(!$("#relatedReport").is(':checked') && $("input[name='ivsgtType']").val() != "arrest") { - if ($('input[name="relatedReportsText"]').length < 1) { - alert("연관보고서를 확인해 주세요.") - flag = false; - } + let flag = true; + if(!$("#contentTitle").val()){ + alert("제목을 입력해주세요.") + flag = false; + } + else if(!$("#arrestCd").val()){ + alert("검거유형1을 선택해주세요.") + flag = false; + } + else if(!$("#arrestCd2").val()){ + alert("검거유형2를 선택해주세요.") + flag = false; + } + else if(!$("#relatedReport").is(':checked') && $("input[name='ivsgtType']").val() != "arrest") { + if ($('input[name="relatedReportsText"]').length < 1) { + alert("연관보고서를 확인해 주세요.") + flag = false; } + } - flag = fileCheck(flag, files); - return flag; + flag = fileCheck(flag, files); + return flag; } \ No newline at end of file diff --git a/src/main/resources/templates/ivsgt/ivsgtEditModal.html b/src/main/resources/templates/ivsgt/ivsgtEditModal.html index 25332c52..344dfc71 100644 --- a/src/main/resources/templates/ivsgt/ivsgtEditModal.html +++ b/src/main/resources/templates/ivsgt/ivsgtEditModal.html @@ -1,7 +1,7 @@ - +