91 lines
2.0 KiB
JavaScript
91 lines
2.0 KiB
JavaScript
|
|
let files = [];
|
||
|
|
|
||
|
|
$(document).on('click', '#addPartInfo', function (){
|
||
|
|
$.ajax({
|
||
|
|
url: '/target/partInfoEditModal',
|
||
|
|
type: 'GET',
|
||
|
|
dataType:"html",
|
||
|
|
success: function(html){
|
||
|
|
$("#partInfoEditModalEditModalContent").empty().append(html);
|
||
|
|
$("#partInfoEditModal").modal('show');
|
||
|
|
$("#rentPrice").hide();
|
||
|
|
$("#utilityPrice").hide();
|
||
|
|
setUploadDiv();
|
||
|
|
},
|
||
|
|
error:function(){
|
||
|
|
|
||
|
|
}
|
||
|
|
});
|
||
|
|
})
|
||
|
|
|
||
|
|
$(document).on('change', '#rentType', function (){
|
||
|
|
if($("#rentType").val() == 'Y'){
|
||
|
|
$("#rentPrice").show();
|
||
|
|
}else{
|
||
|
|
$("#rentPrice").hide();
|
||
|
|
$("#rentPrice").val('');
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
$(document).on('change', '#utilityType', function (){
|
||
|
|
if($("#utilityType").val() == 'Y'){
|
||
|
|
$("#utilityPrice").show();
|
||
|
|
}else{
|
||
|
|
$("#utilityPrice").hide();
|
||
|
|
$("#utilityPrice").val('');
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
$(document).on('change', '#mgtOrgan', function (){
|
||
|
|
const ogCd = $(this).val();
|
||
|
|
if(ogCd != ''){
|
||
|
|
$.ajax({
|
||
|
|
url: '/target/partInfoSelecBox',
|
||
|
|
data: {
|
||
|
|
ogCd,
|
||
|
|
},
|
||
|
|
type: 'GET',
|
||
|
|
dataType:"html",
|
||
|
|
success: function(html){
|
||
|
|
$("#piUserSeq").empty().append(html);
|
||
|
|
$("#piUserSeq").prop('disabled',false);
|
||
|
|
},
|
||
|
|
error:function(){
|
||
|
|
}
|
||
|
|
});
|
||
|
|
}else{
|
||
|
|
$("#piUserSeq").prop('disabled',true);
|
||
|
|
$("#piUserSeq").val('');
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
$(document).on('click', '#savePartInfo', function (){
|
||
|
|
if(confirm("저장하시겠습니까?")){
|
||
|
|
contentFade("in");
|
||
|
|
const formData = new FormData($("#partInfoSave")[0]);
|
||
|
|
for(const file of files) {
|
||
|
|
if(!file.isDelete)
|
||
|
|
formData.append('uploadFiles', file, file.name);
|
||
|
|
}
|
||
|
|
$.ajax({
|
||
|
|
type : 'POST',
|
||
|
|
data : formData,
|
||
|
|
url : "/target/savePartInfo",
|
||
|
|
processData: false,
|
||
|
|
contentType: false,
|
||
|
|
success : function(result) {
|
||
|
|
alert("저장되었습니다.");
|
||
|
|
contentFade("out");
|
||
|
|
location.reload();
|
||
|
|
},
|
||
|
|
error : function(xhr, status) {
|
||
|
|
alert("저장에 실패하였습니다.")
|
||
|
|
contentFade("out");
|
||
|
|
}
|
||
|
|
})
|
||
|
|
}
|
||
|
|
})
|
||
|
|
|
||
|
|
|
||
|
|
|