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

120 lines
3.1 KiB
JavaScript
Raw Normal View History

2023-01-06 05:58:37 +00:00
$(function(){
$("#dateSelectorDiv").datepicker({
format: "yyyy-mm-dd",
language: "ko",
autoclose: true
});
})
2023-01-04 00:04:39 +00:00
$(document).on('click', '#addBtn', function (){
getCiaSaftyDemandEditModal(null);
})
function getCiaSaftyDemandEditModal(ciKey){
$.ajax({
url: '/counterIntelligence/ciaSaftyDemandEditModal',
data: {ciKey: ciKey},
type: 'GET',
dataType:"html",
success: function(html){
$("#ciaSaftyDemandEditModalContent").empty().append(html)
setUploadDiv();
$("#ciaSaftyDemandEditModal").modal('show');
},
error:function(){
}
});
}
$(document).on('click', '#saveBtn', function (){
if(confirm("저장하시겠습니까?")){
2023-01-06 05:58:37 +00:00
save('DST007');
}
})
$(document).on('click', '#saveTempBtn', function (){
if(confirm("임시저장 하시겠습니까?")){
save('DST001');
}
})
function save(contentStatus){
const formData = new FormData($("#ciaSaftyDemandEditForm")[0]);
2023-01-04 00:04:39 +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"));
})
2023-01-06 05:58:37 +00:00
formData.append('contentStatus', contentStatus);
2023-01-04 00:04:39 +00:00
$.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");
}
})
2023-01-06 05:58:37 +00:00
}
$(document).on('click', '#deleteBtn', function (){
const ciKey = $(this).attr("data-cikey");
if(confirm("삭제 하시겠습니까?")){
$.ajax({
type : 'POST',
url : "/counterIntelligence/deleteCounterIntelligenceActivity",
2023-01-06 08:58:15 +00:00
data : JSON.stringify({ciKey:ciKey}),
2023-01-06 05:58:37 +00:00
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("삭제처리에 실패하였습니다");
}
})
2023-01-04 00:04:39 +00:00
}
})
$(document).on('click', '.sdiTr', function (){
2023-01-04 00:44:48 +00:00
getCiaSaftyDemandViewModal($(this).find(".ciKey").val());
2023-01-04 00:04:39 +00:00
})
2023-01-04 00:44:48 +00:00
function getCiaSaftyDemandViewModal(ciKey){
$.ajax({
url: '/counterIntelligence/ciaSaftyDemandViewModal',
data: {ciKey: ciKey},
type: 'GET',
dataType:"html",
success: function(html){
2023-01-04 08:54:59 +00:00
$("#ciaSaftyDemandViewModalBody").empty().append(html)
$("#ciaSaftyDemandViewModal").modal('show');
2023-01-04 00:44:48 +00:00
},
error:function(){
}
});
}
2023-01-04 08:54:59 +00:00
$(document).on('click', '#editBtn', function (){
$("#ciaSaftyDemandViewModal").modal('hide');
getCiaSaftyDemandEditModal($(this).attr("data-cikey"));
})
2023-01-06 05:58:37 +00:00
$(document).on('click', '#excelDown', function (){
exportExcel("치안수요 분석결과","sdiTb");
})