2022-10-05 08:00:03 +00:00
|
|
|
let files = [];
|
|
|
|
|
|
|
|
|
|
$(function(){
|
|
|
|
|
$("#dateSelectorDiv").datepicker({
|
|
|
|
|
format: "yyyy-mm-dd",
|
|
|
|
|
language: "ko"
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
|
2022-10-06 09:43:36 +00:00
|
|
|
$(document).on('click', '#resultTab', function (){
|
|
|
|
|
location.href = "/affairResult/resultMgt";
|
2022-10-05 08:00:03 +00:00
|
|
|
})
|
|
|
|
|
$(document).on('click', '#stayTab', function (){
|
2022-10-06 09:43:36 +00:00
|
|
|
location.href = "/affairResult/stayPage";
|
2022-10-05 08:00:03 +00:00
|
|
|
})
|
|
|
|
|
$(document).on('click', '#commitTab', function (){
|
2022-10-06 09:43:36 +00:00
|
|
|
location.href = "/affairResult/commitPage";
|
2022-10-05 08:00:03 +00:00
|
|
|
})
|
|
|
|
|
|
2022-10-06 09:43:36 +00:00
|
|
|
$(document).on('click', '#addResultBtn', function (){
|
|
|
|
|
getResultEditModal(null)
|
2022-10-05 08:00:03 +00:00
|
|
|
})
|
2022-10-06 09:43:36 +00:00
|
|
|
$(document).on('click', '#editResultBtn', function (){
|
|
|
|
|
$("#resultViewModal").modal('hide');
|
|
|
|
|
getResultEditModal(Number($("#resultViewBody").find("[name='resultKey']").val()));
|
2022-10-05 08:00:03 +00:00
|
|
|
})
|
|
|
|
|
|
2022-10-06 09:43:36 +00:00
|
|
|
$(document).on('click', '#resultAddBtn', function (){
|
|
|
|
|
$("#resultDiv").append("<input type='text' class='form-control' name='resultInfos'>")
|
2022-10-05 08:00:03 +00:00
|
|
|
})
|
|
|
|
|
|
2022-10-06 09:43:36 +00:00
|
|
|
$(document).on('click', '#detailResultAddBtn', function (){
|
|
|
|
|
const detailResultDiv = $("#detailResultDiv");
|
|
|
|
|
detailResultDiv.append("<textarea type='text' name='detailResultInfos'></textarea>");
|
|
|
|
|
const lastAppendTextarea = detailResultDiv.children()[detailResultDiv.children().length-1];
|
2022-10-05 08:00:03 +00:00
|
|
|
$(lastAppendTextarea).summernote({
|
|
|
|
|
lang:'ko-KR',
|
|
|
|
|
height: 120,
|
|
|
|
|
disableDragAndDrop: true,
|
|
|
|
|
toolbar: [
|
|
|
|
|
['style', ['style']],
|
|
|
|
|
['font', ['bold', 'underline', 'clear']],
|
|
|
|
|
['color', ['color']],
|
|
|
|
|
['para', ['ul', 'ol', 'paragraph']],
|
|
|
|
|
['table', ['table']]
|
|
|
|
|
]
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
|
2022-10-06 09:43:36 +00:00
|
|
|
$(document).on('click', '#saveResultBtn', function (){
|
|
|
|
|
saveResult('DST002')
|
2022-10-05 08:00:03 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
$(document).on('click', '#saveTempBtn', function (){
|
2022-10-06 09:43:36 +00:00
|
|
|
saveResult('DST001')
|
2022-10-05 08:00:03 +00:00
|
|
|
})
|
|
|
|
|
|
2022-10-06 09:43:36 +00:00
|
|
|
$(document).on('click', '.resultTr', function (){
|
2022-10-05 08:00:03 +00:00
|
|
|
$(".trChkBox").prop("checked", false);
|
|
|
|
|
$(this).find(".trChkBox").prop("checked", true);
|
2022-10-06 09:43:36 +00:00
|
|
|
getResultViewModal(Number($(this).find(".resultKey").val()));
|
2022-10-05 08:00:03 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
$(document).on('click', '.apprvBtn', function (){
|
2022-10-06 09:43:36 +00:00
|
|
|
$("#apprvFormResultKey").val($("#viewModalResultKey").val());
|
|
|
|
|
$("#viewModalApprvValue").val($(this).attr("data-resultstate"));
|
2022-10-05 08:00:03 +00:00
|
|
|
if(confirm($(this).val()+"하시겠습니까?")){
|
|
|
|
|
const formData = new FormData($("#apprvForm")[0]);
|
|
|
|
|
contentFade("in")
|
|
|
|
|
$.ajax({
|
|
|
|
|
type : 'POST',
|
|
|
|
|
data : formData,
|
2022-10-06 09:43:36 +00:00
|
|
|
url : "/affairResult/resultStateChange",
|
2022-10-05 08:00:03 +00:00
|
|
|
processData: false,
|
|
|
|
|
contentType: false,
|
|
|
|
|
beforeSend: function (xhr){
|
|
|
|
|
xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val());
|
|
|
|
|
},
|
|
|
|
|
success : function(result) {
|
|
|
|
|
alert("저장되었습니다")
|
2022-10-06 09:43:36 +00:00
|
|
|
getResultViewModal(result);
|
2022-10-05 08:00:03 +00:00
|
|
|
contentFade("out");
|
|
|
|
|
},
|
|
|
|
|
error : function(xhr, status) {
|
|
|
|
|
alert("저장에 실패하였습니다.");
|
|
|
|
|
contentFade("out");
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
2022-10-06 09:43:36 +00:00
|
|
|
function getResultViewModal(resultKey){
|
2022-10-05 08:00:03 +00:00
|
|
|
$.ajax({
|
2022-10-06 09:43:36 +00:00
|
|
|
url: '/affairResult/resultViewModal',
|
|
|
|
|
data: {resultKey: resultKey},
|
2022-10-05 08:00:03 +00:00
|
|
|
type: 'GET',
|
|
|
|
|
dataType:"html",
|
|
|
|
|
success: function(html){
|
2022-10-06 09:43:36 +00:00
|
|
|
$("#resultViewBody").empty().append(html)
|
|
|
|
|
$("#resultViewModal").modal('show');
|
2022-10-05 08:00:03 +00:00
|
|
|
},
|
|
|
|
|
error:function(){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-06 09:43:36 +00:00
|
|
|
function getResultEditModal(resultKey){
|
2022-10-05 08:00:03 +00:00
|
|
|
$.ajax({
|
2022-10-06 09:43:36 +00:00
|
|
|
url: '/affairResult/resultEditModal',
|
|
|
|
|
data: {resultKey: resultKey},
|
2022-10-05 08:00:03 +00:00
|
|
|
type: 'GET',
|
|
|
|
|
dataType:"html",
|
|
|
|
|
success: function(html){
|
2022-10-06 09:43:36 +00:00
|
|
|
$("#resultEditModalContent").empty().append(html)
|
|
|
|
|
$("#resultEditModal").modal('show');
|
|
|
|
|
$("#resultDt").datepicker({
|
2022-10-05 08:00:03 +00:00
|
|
|
format: "yyyy-mm-dd",
|
|
|
|
|
language: "ko"
|
|
|
|
|
});
|
2022-10-06 09:43:36 +00:00
|
|
|
$("[name='detailResultInfos']").summernote({
|
2022-10-05 08:00:03 +00:00
|
|
|
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(){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2022-10-06 09:43:36 +00:00
|
|
|
function saveResult(resultState){
|
2022-10-05 08:00:03 +00:00
|
|
|
if(contentCheck()){
|
|
|
|
|
if(confirm("저장하시겠습니까?")){
|
2022-10-06 09:43:36 +00:00
|
|
|
$("#resultState").val(resultState);
|
2022-10-05 08:00:03 +00:00
|
|
|
contentFade("in");
|
2022-10-06 09:43:36 +00:00
|
|
|
const formData = new FormData($("#resultEditForm")[0]);
|
2022-10-05 08:00:03 +00:00
|
|
|
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,
|
2022-10-06 09:43:36 +00:00
|
|
|
url : "/affairResult/saveResult",
|
2022-10-05 08:00:03 +00:00
|
|
|
processData: false,
|
|
|
|
|
contentType: false,
|
|
|
|
|
success : function(result) {
|
|
|
|
|
alert("저장되었습니다.");
|
|
|
|
|
contentFade("out");
|
2022-10-06 09:43:36 +00:00
|
|
|
$("#resultEditModal").modal('hide');
|
|
|
|
|
getResultViewModal(result);
|
2022-10-05 08:00:03 +00:00
|
|
|
},
|
|
|
|
|
error : function(xhr, status) {
|
|
|
|
|
alert("저장에 실패하였습니다.")
|
|
|
|
|
contentFade("out");
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function contentCheck(){
|
|
|
|
|
let flag = true;
|
|
|
|
|
if(!$("#contentTitle").val()){
|
|
|
|
|
alert("제목을 입력해주세요.")
|
|
|
|
|
flag = false;
|
|
|
|
|
}
|
2022-10-06 09:43:36 +00:00
|
|
|
if(!$("#resultDt").val()){
|
2022-10-05 08:00:03 +00:00
|
|
|
alert("시행일자를 입력해주세요.")
|
|
|
|
|
flag = false;
|
|
|
|
|
}
|
|
|
|
|
flag = fileCheck(flag, files);
|
|
|
|
|
return flag;
|
|
|
|
|
}
|