Merge branch 'household_tab' into dev
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -164,8 +164,17 @@
|
||||
<span class="btn-txt">목록</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="btns-col-2 align-right" th:unless="${activeProfile != 'local'}">
|
||||
<button type="button" class="btn">
|
||||
<div class="btns-col-2 align-right _excelDownload" th:unless="${activeProfile != 'local'}">
|
||||
<button type="button" class="btn" data-tab-type="daily-record" data-tab-value="tab1" onclick="goExcel(this)">
|
||||
<span class="btn-txt">엑셀 다운로드 <i class="ico-download" aria-hidden="true"></i></span>
|
||||
</button>
|
||||
<button type="button" class="btn" data-tab-type="forest-product" data-tab-value="tab2" onclick="goExcel(this)">
|
||||
<span class="btn-txt">엑셀 다운로드 <i class="ico-download" aria-hidden="true"></i></span>
|
||||
</button>
|
||||
<button type="button" class="btn" data-tab-type="bank-auto-transfer" data-tab-value="tab3" onclick="goExcel(this)">
|
||||
<span class="btn-txt">엑셀 다운로드 <i class="ico-download" aria-hidden="true"></i></span>
|
||||
</button>
|
||||
<button type="button" class="btn" data-tab-type="household-visit" data-tab-value="tab4" onclick="goExcel(this)">
|
||||
<span class="btn-txt">엑셀 다운로드 <i class="ico-download" aria-hidden="true"></i></span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -221,12 +230,32 @@
|
||||
</script>
|
||||
|
||||
<script>
|
||||
const tabStorageName = 'tabActive';
|
||||
let tabActive = 'tab1';
|
||||
window.onpageshow = function (event) {
|
||||
if (event.persisted || (window.performance && window.performance.navigation.type == 1)) {
|
||||
if (('sessionStorage' in window) && window['sessionStorage'] !== null) {
|
||||
if (sessionStorage.getItem(tabStorageName)) {
|
||||
tabActive = sessionStorage.getItem(tabStorageName);
|
||||
}
|
||||
}
|
||||
} else if (event.persisted || (window.performance && window.performance.navigation.type == 2)) {
|
||||
sessionStorage.removeItem(tabStorageName);
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(() => {
|
||||
getDailyRecords();
|
||||
$('._excelDownload button').hide();
|
||||
|
||||
setTimeout(function () {
|
||||
let $tab = $('.component-tab button[data-tab-value="' + tabActive + '"]');
|
||||
|
||||
getTabData($tab.data('tabType'), $tab.data('tabValue'));
|
||||
}, 500);
|
||||
});
|
||||
|
||||
$('.select-tab').on('click', function () {
|
||||
getTabData(this.dataset.tabType);
|
||||
getTabData(this.dataset.tabType, this.dataset.tabValue);
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -239,7 +268,7 @@
|
||||
getTabData(selectedTab.dataset.tabType);
|
||||
}
|
||||
|
||||
const getTabData = (tabType) => {
|
||||
const getTabData = (tabType, tabValue) => {
|
||||
switch (tabType) {
|
||||
case 'daily-record': // 일계부 등록 현황
|
||||
getDailyRecords();
|
||||
@@ -254,6 +283,13 @@
|
||||
getVisitInfo();
|
||||
break;
|
||||
}
|
||||
|
||||
sessionStorage.setItem(tabStorageName, tabValue);
|
||||
|
||||
document.querySelector('.component-tab').ui.setValue(tabValue);
|
||||
|
||||
$('._excelDownload button').hide();
|
||||
$('._excelDownload button[data-tab-value="' + tabValue + '"]').show();
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -360,6 +396,36 @@
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// 엑셀 다운로드
|
||||
const goExcel = (el) => {
|
||||
let url = '';
|
||||
if (el.dataset.tabValue === 'tab1') {
|
||||
url = $('.tab-content .daily-record-list').is(':hidden') ? '' : '/api/household/dailyRecordsStatus/excel';
|
||||
} else if (el.dataset.tabValue === 'tab2') {
|
||||
url = '';
|
||||
} else if (el.dataset.tabValue === 'tab3') {
|
||||
url = '';
|
||||
} else if (el.dataset.tabValue === 'tab4') {
|
||||
url = '';
|
||||
}
|
||||
|
||||
console.log('goExcel', el.dataset.tabValue, url);
|
||||
|
||||
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>
|
||||
</section>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user