FAISP/src/main/resources/static/js/counterIntelligence/ciaForeigner.js

109 lines
2.6 KiB
JavaScript

$(function(){
$("#dateSelectorDiv").datepicker({
format: "yyyy-mm-dd",
language: "ko",
autoclose: true
});
})
$(document).on('click', '#addBtn', function (){
getCiaForeignerEditModal(null);
})
function getCiaForeignerEditModal(ciKey){
$.ajax({
url: '/counterIntelligence/ciaForeignerEditModal',
data: {ciKey: ciKey},
type: 'GET',
dataType:"html",
success: function(html){
$("#ciaForeignerEditModalContent").empty().append(html);
$("#fixDate").datepicker({
format: "yyyy-mm-dd",
language: "ko",
autoclose: true
});
setUploadDiv();
$("#ciaForeignerEditModal").modal('show');
},
error:function(){
}
});
}
$(document).on('click', '#saveBtn', function (){
if(confirm("저장하시겠습니까?")){
save('DST007');
}
})
$(document).on('click', '#saveTempBtn', function (){
if(confirm("임시저장 하시겠습니까?")){
save('DST001');
}
})
function save(contentStatus){
const formData = new FormData($("#ciaForeignerEditForm")[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('contentStatus', contentStatus);
$.ajax({
type : 'POST',
data : formData,
url : "/counterIntelligence/saveCiActivity",
processData: false,
contentType: false,
success : function(result) {
alert("저장되었습니다.");
contentFade("out");
location.reload();
},
error : function(xhr, status) {
alert("저장에 실패하였습니다.")
contentFade("out");
}
})
}
$(document).on('click', '.fiTr', function (){
getCiaForeignerViewModal($(this).find(".ciKey").val());
})
function getCiaForeignerViewModal(ciKey){
$.ajax({
url: '/counterIntelligence/ciaForeignerViewModal',
data: {ciKey: ciKey},
type: 'GET',
dataType:"html",
success: function(html){
$("#ciaForeignerViewModalBody").empty().append(html)
$("#ciaForeignerViewModal").modal('show');
},
error:function(){
}
});
}
$(document).on('click', '#editBtn', function (){
$("#ciaForeignerViewModal").modal('hide');
getCiaForeignerEditModal($(this).attr("data-cikey"));
})
$(document).on('click', '#imgView', function (){
window.open($(this).attr("data-img"));
})
$(document).on('click', '#excelDown', function (){
exportExcel("외국인 커뮤니티 모니터링 현황","ciaForeignerTb");
})