[BO] 임가현황, 조사원현황 엑셀 다운로드 작업 중 (1)

This commit is contained in:
kangsunlee
2025-07-04 09:56:03 +09:00
parent 38a9ca2997
commit f53cab803b
23 changed files with 692 additions and 70 deletions

View File

@@ -275,7 +275,7 @@
<button type="button" class="btn" onclick="showExcelHouseholdModal();">
<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" onclick="goExcel();">
<span class="btn-txt">엑셀 다운로드 <i class="ico-download ico-small" aria-hidden="true"></i></span>
</button>
<!-- 관리자만 노출 -->
@@ -484,6 +484,24 @@
}
</script>
<script>
// 엑셀 다운로드
const goExcel = () => {
const url = '/api/households/excel';
const f = document.reqForm;
const data = $(f).serializeObject();
// size 를 제거하면 전체 목록을 가져온다.
delete data.size;
if (url !== '') {
location.href = url + '?' + new URLSearchParams(data).toString();
} else {
console.warn('엑셀 다운르도 경로 없음.')
}
}
</script>
<script>
// 체크박스 전체 선택
document.getElementById('checkedAll').addEventListener('change', function () {

View File

@@ -436,11 +436,11 @@
if (el.dataset.tabValue === 'tab1') {
url = $('.tab-content .daily-record-list').is(':hidden') ? '/api/household/dailyRecordStatus/excel' : '/api/household/dailyRecordsStatus/excel';
} else if (el.dataset.tabValue === 'tab2') {
url = '';
url = $('.tab-content .forest-product').is(':hidden') ? '' : '/api/household/forestProduct/excel';
} else if (el.dataset.tabValue === 'tab3') {
url = '';
url = $('.tab-content .bank-auto-transfer').is(':hidden') ? '' : '/api/household/bankAutoTransfer/excel';
} else if (el.dataset.tabValue === 'tab4') {
url = '';
url = $('.tab-content .household-visit').is(':hidden') ? '' : '/api/household/visitInfos/excel';
}
console.log('goExcel', el.dataset.tabValue, url);

View File

@@ -51,6 +51,7 @@
<section>
<form autocomplete="off" method="get" name="householdReqForm" th:object="${reqVO}">
<input type="hidden" name="currentMonth" th:value="${currentMonth}">
<input type="hidden" name="isPaging">
<div class="component-tab" data-active="tab1">
<div class="tab-head">
@@ -167,12 +168,9 @@
</button>
</div>
<div class="btns-col-2 align-right" th:unless="${activeProfile != 'local'}">
<button type="button" class="btn">
<button type="button" class="btn" onclick="goExcel();">
<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>
@@ -210,6 +208,7 @@
const getHouseholdList = (pageNo) => {
const f = document.householdReqForm;
f.page.value = pageNo;
f.isPaging.value = true;
let dataOj = $(f).serializeObject();
ajaxUtil._ajaxMethod(
'/api/researcher/mappingHouseholdList',
@@ -356,15 +355,29 @@
);
}
function goExcel() {
const selectedTab = document.querySelector('.tab-label[aria-selected="true"]');
let url = '';
if (selectedTab.dataset.tabValue === 'tab1') {
url = '/api/researcher/mappingHouseholdList/excel';
} else if (selectedTab.dataset.tabValue === 'tab2') {
url = ''; // 임가방문정보
}
const f = document.householdReqForm;
f.isPaging.value = false;
const data = $(f).serializeObject();
// size 를 제거하면 전체 목록을 가져온다.
delete data.size;
location.href = '/admin/researchers/excel?' + new URLSearchParams(data).toString();
if (url !== '') {
location.href = url + '?' + new URLSearchParams(data).toString();
} else {
console.warn('엑셀 다운르도 경로 없음.')
}
}
// 체크박스 선택/해제

View File

@@ -9,6 +9,8 @@
<!-- hidden parameters -->
<input name="sort" th:field="*{sort}" type="hidden"/>
<input name="page" th:field="*{page}" type="hidden"/>
<input name="isPaging" type="hidden"/>
<div class="input-group">
<div class="input-label">
<p class="label-txt">
@@ -108,6 +110,7 @@
const getResearchers = (pageNo) => {
const f = document.reqForm;
f.page.value = pageNo;
f.isPaging.value = true;
let dataOj = $(f).serializeObject();
@@ -191,12 +194,14 @@
function goExcel() {
const f = document.reqForm;
f.isPaging.value = false;
const data = $(f).serializeObject();
// size 를 제거하면 전체 목록을 가져온다.
delete data.size;
location.href = '/admin/researchers/excel?' + new URLSearchParams(data).toString();
location.href = '/api/researcher/list/excel?' + new URLSearchParams(data).toString();
}
// 체크박스 선택/해제