수수료 조회 페이지 오류 상황 노출 개선
This commit is contained in:
@@ -14,35 +14,17 @@
|
|||||||
</section>
|
</section>
|
||||||
<section layout:fragment="contentFragment" class="content">
|
<section layout:fragment="contentFragment" class="content">
|
||||||
<div class="searchBox row-two">
|
<div class="searchBox row-two">
|
||||||
<span class="form-inline">
|
|
||||||
<label for="providers">제공기관</label>
|
|
||||||
<select id="providers" class="form-control">
|
|
||||||
<option value="">- 선택 -</option>
|
|
||||||
<option value="1" selected>광주은행</option>
|
|
||||||
<option value="2">한국은행</option>
|
|
||||||
</select>
|
|
||||||
</span>
|
|
||||||
<span class="form-inline">
|
|
||||||
<label for="organizations">이용기관</label>
|
|
||||||
<select id="organizations" class="form-control">
|
|
||||||
<option value="">- 선택 -</option>
|
|
||||||
<option value="1" selected th:text="${organization?.orgName ?: 'ABC 핀테크'}"></option>
|
|
||||||
</select>
|
|
||||||
</span>
|
|
||||||
<span class="form-inline form-inline--period">
|
<span class="form-inline form-inline--period">
|
||||||
<label for="forYear">조회기간</label>
|
<label for="forYear">조회기간</label>
|
||||||
<span class="period-selects">
|
<span class="period-selects">
|
||||||
<select id="forYear" class="form-control">
|
<select id="forYear" class="form-control">
|
||||||
<option value="">- 선택 -</option>
|
<option value="">- 선택 -</option>
|
||||||
<option value="2023">2023</option>
|
|
||||||
<option value="2024">2024</option>
|
|
||||||
<option value="2025" selected>2025</option>
|
|
||||||
</select> <span class="period-unit">년</span>
|
</select> <span class="period-unit">년</span>
|
||||||
<select id="forMonth" class="form-control">
|
<select id="forMonth" class="form-control">
|
||||||
<option value="">- 선택 -</option>
|
<option value="">- 선택 -</option>
|
||||||
<option value="1">1</option>
|
<option value="1">1</option>
|
||||||
<option value="2">2</option>
|
<option value="2">2</option>
|
||||||
<option value="3" selected>3</option>
|
<option value="3">3</option>
|
||||||
<option value="4">4</option>
|
<option value="4">4</option>
|
||||||
<option value="5">5</option>
|
<option value="5">5</option>
|
||||||
<option value="6">6</option>
|
<option value="6">6</option>
|
||||||
@@ -204,6 +186,41 @@
|
|||||||
|
|
||||||
<th:block layout:fragment="contentScript">
|
<th:block layout:fragment="contentScript">
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
|
// 페이지 로드 시 초기화
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
initializeDateSelects();
|
||||||
|
});
|
||||||
|
|
||||||
|
function initializeDateSelects() {
|
||||||
|
const now = new Date();
|
||||||
|
const currentYear = now.getFullYear();
|
||||||
|
const currentMonth = now.getMonth() + 1; // 0-indexed
|
||||||
|
|
||||||
|
// 전월 계산
|
||||||
|
let lastMonth = currentMonth - 1;
|
||||||
|
let lastMonthYear = currentYear;
|
||||||
|
if (lastMonth === 0) {
|
||||||
|
lastMonth = 12;
|
||||||
|
lastMonthYear = currentYear - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 연도 옵션 동적 생성 (최근 3년)
|
||||||
|
const yearSelect = document.getElementById('forYear');
|
||||||
|
for (let year = currentYear; year >= currentYear - 2; year--) {
|
||||||
|
const option = document.createElement('option');
|
||||||
|
option.value = year;
|
||||||
|
option.textContent = year;
|
||||||
|
if (year === lastMonthYear) {
|
||||||
|
option.selected = true;
|
||||||
|
}
|
||||||
|
yearSelect.appendChild(option);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 월 기본값 설정 (전월)
|
||||||
|
const monthSelect = document.getElementById('forMonth');
|
||||||
|
monthSelect.value = lastMonth.toString();
|
||||||
|
}
|
||||||
|
|
||||||
function formatNumber(num) {
|
function formatNumber(num) {
|
||||||
return new Intl.NumberFormat('ko-KR').format(num);
|
return new Intl.NumberFormat('ko-KR').format(num);
|
||||||
}
|
}
|
||||||
@@ -230,15 +247,19 @@
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (!response.ok) {
|
return response.json().then(data => {
|
||||||
throw new Error('데이터 조회에 실패했습니다.');
|
if (!response.ok) {
|
||||||
}
|
// 서버에서 반환한 에러 메시지 추출
|
||||||
return response.json();
|
const errorMessage = data.description || data.message || '데이터 조회에 실패했습니다.';
|
||||||
|
throw new Error(errorMessage);
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
});
|
||||||
})
|
})
|
||||||
.then(data => renderCommissionData(data, year, month))
|
.then(data => renderCommissionData(data, year, month))
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.error('Error:', error);
|
console.error('Error:', error);
|
||||||
customPopups.showAlert('데이터 조회 중 오류가 발생했습니다.');
|
customPopups.showAlert(error.message || '데이터 조회 중 오류가 발생했습니다.');
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -180,8 +180,17 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script th:if="${error}" th:inline="javascript">
|
<script th:if="${error}" th:inline="javascript">
|
||||||
$(document).ready(function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
customPopups.showAlert([[${error}]]);
|
var errorMessage = /*[[${error}]]*/ '';
|
||||||
|
if (errorMessage) {
|
||||||
|
alert(errorMessage);
|
||||||
|
// 에러 발생 시 인쇄 버튼 비활성화
|
||||||
|
var printButton = document.getElementById('printButton');
|
||||||
|
if (printButton) {
|
||||||
|
printButton.disabled = true;
|
||||||
|
printButton.value = '조회 오류';
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Reference in New Issue
Block a user