Merge branch 'susu' into dev

This commit is contained in:
주수현
2025-06-27 18:56:26 +09:00
30 changed files with 757 additions and 15 deletions

View File

@@ -284,6 +284,9 @@
<div class="component-btns bottom-btn-group" th:unless="${activeProfile != 'local'}">
<div class="btns-row align-right">
<button type="button" class="btn" onclick="showExcelHouseholdModal();">
<span class="btn-txt">엑셀 업로드 <i class="ico-download ico-small" aria-hidden="true"></i></span>
</button>
<button type="button" class="btn">
<span class="btn-txt">엑셀 다운로드 <i class="ico-download ico-small" aria-hidden="true"></i></span>
</button>
@@ -302,6 +305,7 @@
</form>
<div th:replace="common/modal-researcher-mapping :: modalFragment"></div>
<div th:replace="households/modal/modal-excel-household :: modalFragment"></div>
</section>
<section layout:fragment="script">

View File

@@ -0,0 +1,85 @@
<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org"
layout:decorate="~{layout/layout}">
<div class="layer-wrap" th:fragment="modalFragment">
<form autocomplete="off" method="get" name="reqHouseholdExcelForm">
<div class="component-modal mypage-wrap modal01 modal-excel-household" data-props-dimm-click="true" data-state="close">
<div class="modal-dimm"></div>
<div class="modal-frame">
<div class="modal-container">
<div class="modal-header">
<h3 class="modal-tit">
임가 등록 엑셀업로드
</h3>
</div>
<div class="modal-content">
<div class="modal-content-inner">
<label for="householdFile" class="input-file-btn">
<input type="file" name="file" id="householdFile" accept=".xlsx, .xls">
</label>
<div class="component-btns bottom-btn-group">
<div class="btns-row align-right">
<button type="button" class="btn btn-primary" onclick="ExcelUploadHousehold();">
<span class="btn-txt">등록</span>
</button>
</div>
</div>
</div>
</div>
<button type="button" class="modal-close"></button>
</div>
</div>
</div>
</form>
<script th:inline="javascript">
// 임가방문정보 모달창 띄우기
const showExcelHouseholdModal = () => {
document.querySelector(".modal-excel-household").ui.open();
}
// 임가방문정보 등록
const ExcelUploadHousehold = () => {
event.preventDefault();
const fileInput = document.getElementById('householdFile');
if (fileInput.files.length === 0) {
alert('업로드할 엑셀 파일을 선택해주세요.');
return;
}
let formData = new FormData();
formData.append('file', fileInput.files[0]);
$.ajax({
method: 'POST',
url: '/api/household/excelUpload',
data: formData,
contentType: false, // * 중요 *
processData: false, // * 중요 *
enctype: 'multipart/form-data', // * 중요 *
beforeSend: function (xhr) {
xhr.setRequestHeader(
$("meta[name='_csrf_header']").attr("content"),
$("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');
}
}
});
}
</script>
</div>
</html>