[BO] 커뮤니케이션 - 건의사항 작업

This commit is contained in:
kangsunlee
2025-07-04 16:41:34 +09:00
parent a6cba3f0b5
commit 684732d675
28 changed files with 652 additions and 11040 deletions

View File

@@ -3,7 +3,166 @@
layout:decorate="~{layout/layout}">
<section layout:fragment="content">
<h1>/communication/suggestions</h1>
<form autocomplete="off" method="get" name="reqForm" th:action="@{/communication/suggestions}"
th:object="${reqVO}">
<input name="page" th:field="*{page}" type="hidden"/>
<input name="size" th:field="*{size}" type="hidden"/>
<div class="content-inner">
<!-- 필터 영역 -->
<section class="filter-wrap">
<div class="form-area">
<!-- 연/월 -->
<div class="input-group">
<div class="input-label">
<p class="label-txt">
연/월
</p>
</div>
<div class="component-select">
<select class="select-list" name="recordMonth" th:field="*{recordMonth}" required>
<option th:each="month : ${monthList}"
th:value="${month.value}"
th:text="${month.label}"
th:selected="${month.value == currentMonth}">
</option>
</select>
</div>
</div>
<!-- 경영주 -->
<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" name="ownerField" th:field="*{ownerField}">
<option value="">전체</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" name="ownerValue" th:field="*{ownerValue}" placeholder="이름 입력">
</div>
</div>
</div>
</div>
</div>
<!-- 버튼 그룹 -->
<div class="component-btns">
<div class="btns-row">
<button type="button" class="btn" onclick="location.href = location.pathname">
<span class="btn-txt">초기화</span>
</button>
<button type="submit" class="btn btn-primary">
<span class="btn-txt">검색</span>
</button>
</div>
</div>
</section>
<section>
<p class="input-label" style="font-size: 16px;">총 <span id="totalElements">0</span>건</p>
<!-- 테이블 영역 -->
<table>
<thead>
<tr>
<th style="width: 60%">내용</th>
<th style="width: 10%">경영주명</th>
<th style="width: 15%">전화번호</th>
<th style="width: 15%">최종 수정자</th>
</tr>
</thead>
<tbody id="listTBody">
</tbody>
</table>
</section>
<!-- 페이지네이션 -->
<div class="row paging"></div>
</div>
</form>
</section>
<section layout:fragment="script">
<script>
// 건의사항 목록 조회
const getSuggestions = (pageNo) => {
const f = document.reqForm;
f.page.value = pageNo;
let dataOj = $(f).serializeObject();
ajaxUtil._ajaxMethod(
'/api/communication/suggestions',
dataOj,
function(response) { // 성공
console.log("response", response);
$('#totalElements').text(response.totalElements);
const tbody = $('#listTBody');
tbody.empty();
$(response.content).each((idx, ct) => {
tbody.append(
`
<tr>
<td class="underline"><a class="ellipsis" href="/communication/suggestions/${ct.id}">${ct.content}</a></td><!-- 내용 -->
<td>${ct.ownerName}</td><!-- 경영주명 -->
<td>${ct.phone}</td><!-- 전화번호 -->
<td>${ct.updatedBy} (${ct.updatedAt})</td><!-- 최종수정자 -->
</tr>
`
);
});
// nodata 처리
if (!$(response.content).length) {
tbody.append(`
<tr>
<td colspan="4" 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("error : ", code);
},
'get',
'json'
);
}
// 최초 리스트 로드
getSuggestions(document.reqForm.page.value);
</script>
<script th:inline="javascript">
const goSearch = () => {
const f = document.reqForm;
f.method = 'GET';
f.submit();
}
</script>
</section>
</html>

View File

@@ -0,0 +1,73 @@
<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org"
layout:decorate="~{layout/layout}">
<section layout:fragment="content">
<form autocomplete="off" method="get" name="reqForm">
<div class="content-inner">
<section>
<table class="type-form confirm">
<colgroup>
<col width="8%" />
<col width="25.3%" />
<col width="8%" />
<col width="25.3%" />
<col width="8%" />
<col width="25.3%" />
</colgroup>
<tbody>
<tr>
<th>임가번호</th>
<td>
<span th:text="${item.householdNum}">16750</span>
</td>
<th>경영주</th>
<td>
<span th:text="${item.ownerName}">홍길동</span>
</td>
<th>휴대폰 번호</th>
<td>
<span th:text="${item.ownerPhone}">010-0000-0000</span>
</td>
</tr>
<tr>
<th>실사</th>
<td>
<span th:text="${item.regionMainName}">서울</span>
</td>
</tr>
<tr>
<th>조사원</th>
<td>
<span th:text="${item.researcherName}">김조사</span>
</td>
<th>조사원 연락처</th>
<td>
<span th:text="${item.researcherPhone}">010-0000-0000</span>
</td>
</tr>
</tbody>
</table>
</section>
<section>
<p class="input-label" style="font-size: 16px; font-weight: bold;">내용</p>
<div class="component-input">
<div class="input-textarea-field">
<textarea id="memo" name="memo" class="textarea" placeholder="" th:text="${item.content}"></textarea>
</div>
</div>
<div class="component-btns bottom-btn-group">
<div class="btns-row align-right">
<button type="button" class="btn" onclick="location.href='/communication/suggestions'">
<span class="btn-txt">목록</span>
</button>
</div>
</div>
</section>
</div>
</form>
</section>
</html>