[BO] 임가현황 작업 중 (10)

This commit is contained in:
kangsunlee
2025-06-18 21:21:06 +09:00
parent 693de9259f
commit ecf2dd8dbe
42 changed files with 878 additions and 235 deletions

View File

@@ -252,7 +252,7 @@
<th>
<div class="component-input">
<label class="checkbox-inner">
<input type="checkbox" id="temp_checkbox_0003" name="temp_checkbox_0001">
<input type="checkbox" id="checkedAll" name="checkedAll">
</label>
</div>
</th>
@@ -265,8 +265,8 @@
<th>업종(대분류)</th>
<th>업종(중분류)</th>
<th>당월 일계부 현황</th>
<th>당월 1차 일가방문</th>
<th>당월 2차 일가방문</th>
<th>당월 1차 임가방문</th>
<th>당월 2차 임가방문</th>
<th>답례품 전달</th>
<th class="hide-role-researcher">조사원</th>
<th class="hide-role-researcher">조사원 휴대전화</th>
@@ -292,7 +292,7 @@
<span class="btn-txt">임가 등록</span>
</button>
<!-- 관리자, 지방실사만 노출 -->
<button type="button" class="btn" th:if="${userRole != 'ROLE_RESEARCHER'}">
<button type="button" class="btn" th:if="${userRole != 'ROLE_RESEARCHER'}" onclick="showResearcherModal();">
<span class="btn-txt">조사원 매핑</span>
</button>
</div>
@@ -300,7 +300,7 @@
</div>
</form>
<div th:replace="common/modal-researcher-mapping :: modalFragment"></div>
</section>
<section layout:fragment="script">
@@ -330,7 +330,7 @@
<td>
<div class="component-input">
<label class="checkbox-inner">
<input type="checkbox" id="temp_checkbox_000${ct.householdSeq}" name="temp_checkbox_000${ct.householdSeq}">
<input type="checkbox" id="chkBox_${ct.householdSeq}" name="chkBox" value="${ct.householdSeq}">
</label>
</div>
</td>
@@ -340,14 +340,14 @@
<td>${ct.regionMainName}</td><!-- 실사 -->
<td>${ct.regionSubName}</td><!-- 지역 -->
<td>${ct.regionDetailName}</td><!-- 세부지역 -->
<td>${ifNullDash(ct.industryLargeName)}</td><!-- 업종 대분류 -->
<td>${ifNullDash(ct.industryMiddleName)}</td><!-- 업종 중분류1 -->
<td>${ifNullHyphen(ct.industryLargeName)}</td><!-- 업종 대분류 -->
<td>${ifNullHyphen(ct.industryMiddleName)}</td><!-- 업종 중분류1 -->
<td>${ct.progressPercent}%</td><!-- 임가 진행 상황 -->
<td>${ifNullDash(ct.firstVisitDate)}</td><!-- 1차방문날짜 -->
<td>${ifNullDash(ct.secondVisitDate)}</td><!-- 2차방문날짜 -->
<td>${ifNullHyphen(ct.firstVisitDate)}</td><!-- 1차방문날짜 -->
<td>${ifNullHyphen(ct.secondVisitDate)}</td><!-- 2차방문날짜 -->
<td>${ct.isGiftSent ? "전달" : "미전달"}</td> <!-- 답례품 -->
<td class="hide-role-researcher">${ifNullDash(ct.researcherName)}</td> <!-- 조사원이름 -->
<td class="hide-role-researcher">${ifNullDash(ct.researcherPhone)}</td> <!-- 조사원번호 -->
<td class="hide-role-researcher">${ifNullHyphen(ct.researcherName)}</td> <!-- 조사원이름 -->
<td class="hide-role-researcher">${ifNullHyphen(ct.researcherPhone)}</td> <!-- 조사원번호 -->
</tr>
`
);
@@ -398,6 +398,55 @@
f.submit();
}
</script>
<script>
// 조사원 매핑 팝업의 선택된 조사원 가져오기.
const getSelectedResearcher = (data, closeModal) => {
const checked = document.querySelectorAll('input[name="chkBox"]:checked');
const householdSeqs = Array.from(checked).map(el => el.value);
if(checked.length == 0) {
alert("임가를 선택해주세요.");
return;
}
ajaxUtil._ajaxMethod(
'/api/household/researcherMapping/create',
JSON.stringify({
adminSeq: data.adminSeq,
householdSeqs: householdSeqs
}),
() => { // 성공
alert("등록이 완료되었습니다.");
closeModal();
// 새로고침이 버벅거려서 일단 setTimeout 처리..
setTimeout(() => {
location.reload();
}, 200);
},
function (code, rstData) {
if(code == 422) alert(rstData.responseText);
if(code == 400) alert(rstData.responseJSON.message); //임가번호 중복체크
},
'post',
'json',
{ handle422Type: 'alert' }
);
}
</script>
<script>
// 체크박스 전체 선택
document.getElementById('checkedAll').addEventListener('change', function () {
const isChecked = this.checked;
const checkboxes = document.querySelectorAll('input[name="chkBox"]');
checkboxes.forEach(cb => {
cb.checked = isChecked;
});
});
</script>
</section>
</html>