120 lines
3.1 KiB
JavaScript
120 lines
3.1 KiB
JavaScript
$(function(){
|
|
$("#dateSelectorDiv").datepicker({
|
|
format: "yyyy-mm-dd",
|
|
language: "ko",
|
|
autoclose: true
|
|
});
|
|
})
|
|
|
|
$(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("저장하시겠습니까?")){
|
|
save('DST007');
|
|
}
|
|
})
|
|
|
|
$(document).on('click', '#saveTempBtn', function (){
|
|
if(confirm("임시저장 하시겠습니까?")){
|
|
save('DST001');
|
|
}
|
|
})
|
|
|
|
function save(contentStatus){
|
|
const formData = new FormData($("#ciaSaftyDemandEditForm")[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', '#deleteBtn', function (){
|
|
const ciKey = $(this).attr("data-cikey");
|
|
if(confirm("삭제 하시겠습니까?")){
|
|
$.ajax({
|
|
type : 'POST',
|
|
url : "/counterIntelligence/deleteCounterIntelligenceActivity",
|
|
data : JSON.stringify({ciKey:ciKey}),
|
|
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("삭제처리에 실패하였습니다");
|
|
}
|
|
})
|
|
}
|
|
})
|
|
|
|
$(document).on('click', '.sdiTr', function (){
|
|
getCiaSaftyDemandViewModal($(this).find(".ciKey").val());
|
|
})
|
|
|
|
function getCiaSaftyDemandViewModal(ciKey){
|
|
$.ajax({
|
|
url: '/counterIntelligence/ciaSaftyDemandViewModal',
|
|
data: {ciKey: ciKey},
|
|
type: 'GET',
|
|
dataType:"html",
|
|
success: function(html){
|
|
$("#ciaSaftyDemandViewModalBody").empty().append(html)
|
|
$("#ciaSaftyDemandViewModal").modal('show');
|
|
},
|
|
error:function(){
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
$(document).on('click', '#editBtn', function (){
|
|
$("#ciaSaftyDemandViewModal").modal('hide');
|
|
getCiaSaftyDemandEditModal($(this).attr("data-cikey"));
|
|
})
|
|
|
|
$(document).on('click', '#excelDown', function (){
|
|
exportExcel("치안수요 분석결과","sdiTb");
|
|
})
|