[BO] 임가 현황 - 임가 등록 작업 중 (5)

This commit is contained in:
kangsunlee
2025-06-15 22:08:17 +09:00
parent 9723b58aa9
commit cfd7d94744
43 changed files with 1341 additions and 216 deletions

View File

@@ -223,7 +223,7 @@
<select class="select-list" name="isPanel" th:field="*{isPanel}">
<option value="">전체</option>
<option value="true">유지</option>
<option value="false">비유지</option>
<option value="false">탈락</option>
</select>
</div>
</div>
@@ -286,10 +286,13 @@
<button type="button" class="btn">
<span class="btn-txt">엑셀 다운로드 <i class="ico-download ico-small" aria-hidden="true"></i></span>
</button>
<button type="button" class="btn">
<!-- 관리자만 노출 -->
<button type="button" class="btn" th:if="${userRole == 'ROLE_ADMIN'}"
onclick="location.href='/household/households/create'">
<span class="btn-txt">임가 등록</span>
</button>
<button type="button" class="btn">
<!-- 관리자, 지방실사만 노출 -->
<button type="button" class="btn" th:if="${userRole != 'ROLE_RESEARCHER'}">
<span class="btn-txt">조사원 매핑</span>
</button>
</div>
@@ -297,32 +300,26 @@
</div>
</form>
<div>
<!-- <button>엑셀 다운로드</button>-->
<!-- <button>임가 등록</button>-->
<!-- <button>조사원 매핑</button>-->
</div>
</section>
<section layout:fragment="script">
<script th:inline="javascript">
// TODO : ajax 공통화 작업 후 수정해야
// 임가 목록 조회
const getHouseholds = (pageNo) => {
const f = document.reqForm;
f.page.value = pageNo;
let dataOj = $(f).serializeObject();
$.ajax({
method: 'GET',
url: '/api/household/households',
data: dataOj,
success(response) {
ajaxUtil._ajaxMethod(
'/api/household/households',
dataOj,
function(response) { // 성공
console.log("response", response);
$('#totalElements').text(response.totalElements);
// List 구성하기
const tbody = $('#listTBody');
tbody.empty();
@@ -356,21 +353,22 @@
);
});
// 현재 로그인한 유저의 역할
const isResearcher = f.userRole.value === 'ROLE_RESEARCHER';
const colspanLength = isResearcher ? 13 : 15;
// 조사원일 경우 조사원이름, 번호 칼럼 hide
$('.hide-role-researcher').toggle(!isResearcher);
// nodata 처리
if (!$(response.content).length) {
tbody.append(`
<tr>
<td colspan="15" class="text-center text-muted">게시물이 존재하지 않습니다.</td>
<td colspan="${colspanLength}" class="text-center text-muted">임가정보가 존재하지 않습니다.</td>
</tr>
`);
}
// 조사원일 경우 조사원이름, 번호 hide
if (f.userRole.value === 'ROLE_RESEARCHER') {
$('.hide-role-researcher').hide();
} else {
$('.hide-role-researcher').show();
}
// Pagination 구성하기
const paging = $('.paging');
paging.empty();
@@ -380,9 +378,13 @@
f.page.value = movePageNo;
goSearch();
}));
}
})
},
function (code, rstData) { // 실패
console.log("error : ", code);
},
'get',
'json'
);
}
// 최초 리스트 로드