150 lines
3.7 KiB
JavaScript
150 lines
3.7 KiB
JavaScript
let selectedList = [];
|
|
$(function(){
|
|
$("#dateSelectorDiv").datepicker({
|
|
format: "yyyy-mm-dd",
|
|
language: "ko"
|
|
});
|
|
})
|
|
|
|
$(document).on('click', '#sendTab', function (){
|
|
location.href = "/faRpt/faRptBoard?activeTab=send";
|
|
})
|
|
$(document).on('click', '#receiveTab', function (){
|
|
location.href = "/faRpt/faRptBoard?activeTab=receive";
|
|
})
|
|
$(document).on('click', '#allTab', function (){
|
|
location.href = "/faRpt/faRptBoard?activeTab=all";
|
|
})
|
|
|
|
$(document).on('click', '#addFaRptBtn', function (){
|
|
getFaRptEditModal(null)
|
|
})
|
|
$(document).on('click', '#editFaRptBtn', function (){
|
|
$("#faRptViewModal").modal('hide');
|
|
getFaRptEditModal(Number($("#faRptViewBody").find("[name='faRptKey']").val()));
|
|
})
|
|
|
|
$(document).on('click', '#addReadUserBtn', function (){
|
|
searchModalSubmit(1);
|
|
$("#userModal").modal('show');
|
|
})
|
|
|
|
$(document).on('click', '#saveFaRptBtn', function (){
|
|
saveFaRpt('DST002')
|
|
})
|
|
|
|
$(document).on('click', '#saveTempBtn', function (){
|
|
saveFaRpt('DST001')
|
|
})
|
|
|
|
$(document).on('click', '.faRptTr', function (){
|
|
const chkBox = $(this).find(".rowChkBox");
|
|
if(chkBox.length>0){
|
|
$(".trChkBox").prop("checked", false);
|
|
chkBox[0].checked = !chkBox[0].checked;
|
|
}
|
|
getFaRptViewModal(Number($(this).find(".faRptKey").val()));
|
|
})
|
|
|
|
|
|
function getFaRptViewModal(faRptKey){
|
|
$.ajax({
|
|
url: '/faRpt/faRptViewModal',
|
|
data: {faRptKey: faRptKey},
|
|
type: 'GET',
|
|
dataType:"html",
|
|
success: function(html){
|
|
$("#faRptViewBody").empty().append(html)
|
|
$("#faRptViewModal").modal('show');
|
|
},
|
|
error:function(){
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
function getFaRptEditModal(faRptKey){
|
|
$.ajax({
|
|
url: '/faRpt/faRptEditModal',
|
|
data: {faRptKey: faRptKey},
|
|
type: 'GET',
|
|
dataType:"html",
|
|
success: function(html){
|
|
$("#faRptEditModalContent").empty().append(html)
|
|
$("#faRptEditModal").modal('show');
|
|
$("#faRptDt").datepicker({
|
|
format: "yyyy-mm-dd",
|
|
language: "ko"
|
|
});
|
|
$("#content").summernote({
|
|
lang:'ko-KR',
|
|
height: 300,
|
|
disableDragAndDrop: true,
|
|
toolbar: [
|
|
['style', ['style']],
|
|
['font', ['bold', 'underline', 'clear']],
|
|
['color', ['color']],
|
|
['para', ['ul', 'ol', 'paragraph']],
|
|
['table', ['table']]
|
|
]
|
|
});
|
|
setUploadDiv();
|
|
},
|
|
error:function(){
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
function saveFaRpt(faRptState){
|
|
if(contentCheck()){
|
|
if(confirm("저장하시겠습니까?")){
|
|
$("#faRptState").val(faRptState);
|
|
contentFade("in");
|
|
const formData = new FormData($("#faRptEditForm")[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 : "/faRpt/saveFaRpt",
|
|
processData: false,
|
|
contentType: false,
|
|
success : function(result) {
|
|
alert("저장되었습니다.");
|
|
contentFade("out");
|
|
$("#faRptEditModal").modal('hide');
|
|
getFaRptViewModal(result);
|
|
},
|
|
error : function(xhr, status) {
|
|
alert("저장에 실패하였습니다.")
|
|
contentFade("out");
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
function contentCheck(){
|
|
let flag = true;
|
|
if(!$("#faRptType").val()){
|
|
alert("분류를 선택해주세요.")
|
|
flag = false;
|
|
}
|
|
if(!$("#title").val()){
|
|
alert("제목을 입력해주세요.")
|
|
flag = false;
|
|
}
|
|
if($("#readUserRow").children().length===0){
|
|
alert("수신자를 입력해주세요.")
|
|
flag = false;
|
|
}
|
|
flag = fileCheck(flag, files);
|
|
return flag;
|
|
} |