탭 항목 스장

This commit is contained in:
주수현
2025-06-14 12:39:28 +09:00
parent 0015b8c651
commit eccbf2a6e7
11 changed files with 483 additions and 9 deletions

View File

@@ -0,0 +1,317 @@
<!DOCTYPE html>
<html layout:decorate="~{layout/layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:th="http://www.thymeleaf.org">
<section layout:fragment="content">
<section>
<!-- 테이블 영역 -->
<table class="type-form confirm" th:object="${researcherDto}" >
<tbody>
<tr>
<th>아이디</th>
<td>
<span th:text="*{id}"></span>
</td>
<th>이름</th>
<td>
<span th:text="*{name}"></span>
</td>
<th>휴대폰번호</th>
<td>
<span th:text="*{phone}"></span>
</td>
</tr>
<tr>
<th>실사</th>
<td>
<span th:text="*{regionMainCodeName}"></span>
</td>
<th>계정사용여부</th>
<td>
<span th:text="*{accountDisabledFlag}"></span>
</td>
</tr>
</tbody>
</table>
<div class="component-btns bottom-btn-group">
<div class="btns-row align-right">
<button type="button" class="btn">
<span class="btn-txt">정보수정</span>
</button>
</div>
</div>
</section>
<section>
<div class="component-tab" data-active="tab1">
<div class="tab-head">
<button type="button" class="tab-label" data-tab-value="tab1">담당 임가 목록</button>
<button type="button" class="tab-label" data-tab-value="tab2">임가방문정보</button>
</div>
<span id="household-totalElements"></span>
<form autocomplete="off" method="get" name="householdReqForm" th:object="${reqVO}">
<!-- hidden parameters -->
<input name="page" th:field="*{page}" type="hidden"/>
<input name="adminSeq" th:field="${researcherDto.seq}" type="hidden"/>
</form>
<div class="tab-body">
<div class="tab-content" data-tab-value="tab1">
<div class="content-inner">
<table>
<thead>
<tr>
<th>임가번호</th>
<th>경영주명</th>
<th>휴대폰번호</th>
<th>실사</th>
<th>지역</th>
<th>세부지역</th>
<th>업종 대분류</th>
<th>업종 중분류1</th>
<th>유지여부</th>
</tr>
</thead>
<tbody id="household-list">
</tbody>
</table>
</div>
</div>
<div class="tab-content" data-tab-value="tab2">
<div class="component-btns bottom-btn-group">
<div class="btns-row two-col">
<div class="btns-col-1 align-right">
<button type="button" class="btn" onClick="goRemove();">
<span class="btn-txt">삭제 <i class="ico-print" aria-hidden="true"></i></span>
</button>
</div>
</div>
</div>-
<div class="content-inner">
<table>
<thead>
<tr>
<th>
<input class="form-check-input" onchange="toggleCheckbox(this);" type="checkbox"/>
</th>
<th>임가번호</th>
<th>경영주명</th>
<th>방문일</th>
<th>관리분야</th>
<th>내용</th>
<th>작성일</th>
<th>답례품 전달</th>
</tr>
</thead>
<tbody id="household-visit-list">
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="component-btns bottom-btn-group">
<div class="btns-row two-col">
<div class="btns-col-1">
<button type="button" class="btn" onclick="location.href='/researcher/researchers'">
<span class="btn-txt">목록</span>
</button>
</div>
<div class="btns-col-2 align-right">
<button type="button" class="btn">
<span class="btn-txt">엑셀 다운로드 <i class="ico-download" aria-hidden="true"></i></span>
</button>
<button type="button" class="btn">
<span class="btn-txt">인쇄 <i class="ico-print" aria-hidden="true"></i></span>
</button>
</div>
</div>
</div>-
</section>
<section layout:fragment="script">
<script>
// 담당 임가 목록
const getHouseholdList = (pageNo) => {
const f = document.householdReqForm;
f.page.value = pageNo;
let dataOj = $(f).serializeObject();
ajaxUtil._ajaxMethod(
'/researcher/mappingHousehold',
dataOj,
function (response) {
$('#household-totalElements').text(response.totalElements);
// List 구성하기
const tbody = $('#household-list');
tbody.empty();
$(response.content).each((idx, ct) => {
tbody.append(
`
<tr data-id="${ct.id}">
<td>
<label>
<input class="form-check-input" name="selectIds" type="checkbox" value="${ct.id}"/>
</label>
</td>
<td class="underline"><a href="">${ct.householdNum}</a></td>
<td>${ct.name}</td>
<td>${ct.phone}</td>
<td>${ct.regionMainCodeName}</td>
<td>${ct.regionSubCodeName}</td>
<td>${ct.regionDetailCodeName}</td>
<td>${ct.industryLargeCodeName}</td>
<td>${ct.industryMiddleCodeName}</td>
<td>${ct.panelFlag}</td>
</tr>
`
);
});
// TODO 임가번호 OR 경영주명 선택시 임가현황 상세화면으로 이동
if (!$(response.content).length) {
tbody.append(`
<tr>
<td colspan="10" class="text-center text-muted">담당임가정보가 존재하지 않습니다.</td>
</tr>
`);
}
// Pagination 구성하기
const paging = $('.paging');
paging.empty();
paging.append(
uiUtil.getPagingUI(pageNo, f.size.value, response.totalPages,
(movePageNo) => {
f.page.value = movePageNo;
goSearch();
}));
},
function (code, rstData) {
console.log("왜지 ");
},
'get',
'json',
null
);
}
// 최초 리스트 로드
getHouseholdList(document.householdReqForm.page.value);
</script>
<script th:inline="javascript">
// 임가 방문 정보
const getHouseholdVisitList = (pageNo) => {
const f = document.householdReqForm;
f.page.value = pageNo;
let dataOj = $(f).serializeObject();
ajaxUtil._ajaxMethod(
'/researcher/visitHouseholdList',
dataOj,
function (response) {
$('#household-totalElements').text(response.totalElements);
// List 구성하기
const tbody = $('#household-visit-list');
tbody.empty();
$(response.content).each((idx, ct) => {
tbody.append(
`
<tr data-id="${ct.id}">
<td class="underline"><a href="">${ct.householdNum}</a></td>
<td>${ct.name}</td>
<td>${ct.visitDate}</td>
<td>${ct.Memo}</td>
<td>${ct.Memo}</td>
<td>${ct.createdAt}</td>
<td>${ct.isGiftSentFlag}</td>
</tr>
`
);
});
if (!$(response.content).length) {
tbody.append(`
<tr>
<td colspan="10" class="text-center text-muted">임가 방문 정보가 존재하지 않습니다.</td>
</tr>
`);
}
// Pagination 구성하기
const paging = $('.paging');
paging.empty();
paging.append(
uiUtil.getPagingUI(pageNo, f.size.value, response.totalPages,
(movePageNo) => {
f.page.value = movePageNo;
goSearch();
}));
},
function (code, rstData) {
console.log("왜지 ");
},
'get',
'json',
null
);
}
function goExcel() {
const f = document.householdReqForm;
const data = $(f).serializeObject();
// size 를 제거하면 전체 목록을 가져온다.
delete data.size;
location.href = '/admin/researchers/excel?' + new URLSearchParams(data).toString();
}
// 체크박스 선택/해제
function toggleCheckbox(oj) {
$('input[name=selectIds]').prop("checked", oj.checked);
}
function goRemove() {
if (!$('input[name=selectIds]').is(':checked')) {
alert(/*[[#{operation.common.remove.choose}]]*/);
return;
}
if (confirm(/*[[#{operation.common.remove.ask}]]*/)) {
const f = document.householdReqForm;
const data = $(f).serializeObject();
$.ajax({
'method': 'DELETE',
'url': '/researchers/householdVisit/remove',
'data': {
'selectIds': data.selectIds
},
beforeSend: function (xhr) {
xhr.setRequestHeader(
$("meta[name='_csrf_header']").attr("content"),
$("meta[name='_csrf']").attr("content"));
},
success(res) {
alert('선택한 아이템이 삭제되었습니다.');
f.method = 'GET';
f.submit();
}
});
}
}
</script>
</section>
</html>