237 lines
8.8 KiB
HTML
237 lines
8.8 KiB
HTML
<!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">
|
|
<form autocomplete="off" method="get" name="reqForm" th:action="@{/researcher/researchers}" th:object="${reqVO}">
|
|
<section class="filter-wrap">
|
|
<div class="form-area">
|
|
<!-- hidden parameters -->
|
|
<input name="sort" th:field="*{sort}" type="hidden"/>
|
|
<input name="page" th:field="*{page}" type="hidden"/>
|
|
<div class="input-group">
|
|
<div class="input-label">
|
|
<p class="label-txt">
|
|
조사원
|
|
</p>
|
|
</div>
|
|
<div class="d-flex">
|
|
<div class="component-select">
|
|
<select class="select-list" required th:field="*{searchField}">
|
|
<option value="" selected>전체</option>
|
|
<option value="name">이름</option>
|
|
<option value="phone">전화번호</option>
|
|
</select>
|
|
</div>
|
|
<div class="component-input">
|
|
<div class="input-field">
|
|
<input type="text" id="temp_input_0001" th:field="*{searchValue}" placeholder="검색어를 입력하세요.">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="input-group">
|
|
<div class="input-label">
|
|
<p class="label-txt">
|
|
실사지역
|
|
</p>
|
|
</div>
|
|
<div class="component-select">
|
|
<select class="select-list" required th:field="*{searchArea}">
|
|
<option selected value="">전체</option>
|
|
<option
|
|
th:each="item : ${inspectionArea}"
|
|
th:text="${item.codeText}" th:value="${item.id}"></option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="input-group">
|
|
<div class="input-label">
|
|
<p class="label-txt">
|
|
계정사용여부
|
|
</p>
|
|
</div>
|
|
<div class="component-select">
|
|
<select class="select-list" required th:field="*{searchAccountDisabled}">
|
|
<option selected value="">전체</option>
|
|
<option value="false">사용</option>
|
|
<option value="true">미사용</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="component-btns">
|
|
<div class="btns-row">
|
|
<button type="button" class="btn" onclick="goInit();">
|
|
<span class="btn-txt">초기화</span>
|
|
</button>
|
|
<button type="button" class="btn btn-primary" onclick="goSearch();" >
|
|
<span class="btn-txt">검색</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<section>
|
|
<p class="input-label" style="font-size: 16px;">
|
|
총 <span id="totalElements"></span>건
|
|
</p>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>이름</th>
|
|
<th>전화번호</th>
|
|
<th>실사지역</th>
|
|
<th>임가수</th>
|
|
<th>사용여부</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="listTBody">
|
|
|
|
</tbody>
|
|
</table>
|
|
</section>
|
|
|
|
<div class="row paging"></div>
|
|
|
|
<div class="component-btns bottom-btn-group" th:unless="${activeProfile != 'local'}">
|
|
<div class="btns-row align-right">
|
|
<button type="button" class="btn" onclick="goExcel();">
|
|
<span class="btn-txt">엑셀 다운로드 <i class="ico-download ico-small" aria-hidden="true"></i></span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</section>
|
|
|
|
<section layout:fragment="script">
|
|
<script>
|
|
const getResearchers = (pageNo) => {
|
|
const f = document.reqForm;
|
|
f.page.value = pageNo;
|
|
|
|
let dataOj = $(f).serializeObject();
|
|
|
|
ajaxUtil._ajaxMethod(
|
|
'/api/researcher/list',
|
|
dataOj,
|
|
function (response) {
|
|
$('#totalElements').text(response.totalElements);
|
|
|
|
// List 구성하기
|
|
const tbody = $('#listTBody');
|
|
tbody.empty();
|
|
|
|
$(response.content).each((idx, ct) => {
|
|
tbody.append(
|
|
`
|
|
<tr data-id="${ct.id}">
|
|
<td><a href="javascript:goDetail(${ct.seq})">${ct.name || '-'}</a></td>
|
|
<td>${ct.phone || '-'}</td>
|
|
<td>${ct.regionMainCodeName || '-'}</td>
|
|
<td>${ct.householdCount || '-'}</td>
|
|
<td>${ct.accountDisabledFlag || '-'}</td>
|
|
</tr>
|
|
`
|
|
);
|
|
});
|
|
|
|
if (!$(response.content).length) {
|
|
tbody.append(`
|
|
<tr>
|
|
<td colspan="5" class="text-center text-muted">조사원이 존재하지 않습니다.</td>
|
|
</tr>
|
|
`);
|
|
}
|
|
|
|
// Pagination 구성하기
|
|
const paging = $('.paging');
|
|
paging.empty();
|
|
paging.append(
|
|
uiUtil.getPagingUI(pageNo, response.size, response.totalPages,
|
|
(movePageNo) => {
|
|
f.page.value = movePageNo;
|
|
getResearchers(movePageNo);
|
|
}));
|
|
|
|
},
|
|
function (code, rstData) {
|
|
console.log("왜지 ");
|
|
|
|
},
|
|
'get',
|
|
'json',
|
|
null
|
|
);
|
|
}
|
|
// 최초 리스트 로드
|
|
getResearchers(document.reqForm.page.value);
|
|
</script>
|
|
|
|
<script th:inline="javascript">
|
|
const goSearch = () => {
|
|
const f = document.reqForm;
|
|
f.method = 'GET';
|
|
f.submit();
|
|
}
|
|
|
|
// 초기화
|
|
function goInit() {
|
|
const f = document.reqForm;
|
|
f.searchField.value = '';
|
|
f.searchValue.value = '';
|
|
f.searchArea.value = '';
|
|
f.searchAccountDisabled.value = '';
|
|
}
|
|
// 상세페이지 이동
|
|
function goDetail(seq) {
|
|
location.href = '/researcher/' + seq;
|
|
}
|
|
|
|
function goExcel() {
|
|
const f = document.reqForm;
|
|
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.reqForm;
|
|
const data = $(f).serializeObject();
|
|
|
|
$.ajax({
|
|
'method': 'DELETE',
|
|
'url': '/api/researchers/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> |