임가 등록/ 조사원 매팡 엑셀 파일 업로드 추가 개발중,,,,,

This commit is contained in:
주수현
2025-06-27 16:47:54 +09:00
parent e7dbb8b938
commit dd55024a0b
8 changed files with 283 additions and 7 deletions

View File

@@ -217,10 +217,9 @@
}
const uploadAdminExcel = () => {
event.preventDefault(); // 폼 기본 제출 방지
event.preventDefault();
const fileInput = document.getElementById('file');
if (fileInput.files.length === 0) {
alert('업로드할 엑셀 파일을 선택해주세요.');
return;
@@ -229,11 +228,6 @@
let formData = new FormData();
formData.append('file', fileInput.files[0]);
const csrfToken = $("meta[name='_csrf']").attr("content");
const csrfHeader = $("meta[name='_csrf_header']").attr("content");
console.log('FormData:', formData);
debugger
$.ajax({
method: 'POST',
url: '/api/settings/admin/excelUpload',
@@ -247,6 +241,14 @@
$("meta[name='_csrf']").attr("content"));
},
success(res) {
alert("총 "+res.total+"건 중에 "+res.success+"건 등록되었습니다.");
},
statusCode: {
422: (res) => {
const resJson = res.responseJSON;
$(input).parent().find('.invalid-feedback').text(resJson.message);
$(input).addClass('is-invalid');
}
}
});
};
@@ -254,6 +256,7 @@
const closeModal = () => {
document.querySelector(".modal02").ui.close();
};
</script>
</section>