[2차][BO] 일계부 등록 현황 SelectBox 선택시 Tab 활성화 오류 수정, 새로고침 검색월 유지 추가

This commit is contained in:
김현주
2025-07-02 16:34:16 +09:00
parent dc159e03e3
commit 4fee07880f

View File

@@ -228,16 +228,23 @@
<script> <script>
const tabStorageName = 'tabActive'; const tabStorageName = 'tabActive';
const monthStorageName = 'recordMonth';
let tabActive = 'tab1'; let tabActive = 'tab1';
let tabMonth = document.reqForm.recordMonth.value;
window.onpageshow = function (event) { window.onpageshow = function (event) {
if (event.persisted || (window.performance && window.performance.navigation.type == 1)) { if (event.persisted || (window.performance && window.performance.navigation.type == 1)) {
if (('sessionStorage' in window) && window['sessionStorage'] !== null) { if (('sessionStorage' in window) && window['sessionStorage'] !== null) {
if (sessionStorage.getItem(tabStorageName)) { if (sessionStorage.getItem(tabStorageName)) {
tabActive = sessionStorage.getItem(tabStorageName); tabActive = sessionStorage.getItem(tabStorageName);
} }
if (sessionStorage.getItem(monthStorageName)) {
tabMonth = sessionStorage.getItem(monthStorageName);
document.reqForm.recordMonth.value = tabMonth;
}
} }
} else if (event.persisted || (window.performance && window.performance.navigation.type == 2)) { } else if (event.persisted || (window.performance && window.performance.navigation.type == 2)) {
sessionStorage.removeItem(tabStorageName); sessionStorage.removeItem(tabStorageName);
sessionStorage.removeItem(monthStorageName);
} }
} }
@@ -262,7 +269,7 @@
const selectedTab = document.querySelector('.tab-label[aria-selected="true"]'); const selectedTab = document.querySelector('.tab-label[aria-selected="true"]');
if (!selectedTab) return; if (!selectedTab) return;
getTabData(selectedTab.dataset.tabType); getTabData(selectedTab.dataset.tabType, selectedTab.dataset.tabValue);
} }
const getTabData = (tabType, tabValue) => { const getTabData = (tabType, tabValue) => {
@@ -282,6 +289,7 @@
} }
sessionStorage.setItem(tabStorageName, tabValue); sessionStorage.setItem(tabStorageName, tabValue);
sessionStorage.setItem(monthStorageName, document.reqForm.recordMonth.value);
document.querySelector('.component-tab').ui.setValue(tabValue); document.querySelector('.component-tab').ui.setValue(tabValue);