[st] - 검토단 작업 완료 및 입력6-1, 10-1 운영데이터업데이트 기능 추가, 텝 영역 우클릭 후 텝 닫기 기능 추가
This commit is contained in:
@@ -234,6 +234,7 @@ export function VerificationResultHistoryDialog({
|
||||
};
|
||||
const checkedVrfcByTabRef = useRef(checkedVrfcByTab);
|
||||
checkedVrfcByTabRef.current = checkedVrfcByTab;
|
||||
const loadedTabKeysRef = useRef<Set<VerificationHistoryTabKey>>(new Set());
|
||||
|
||||
const resetState = useCallback(() => {
|
||||
setActiveTab("NV");
|
||||
@@ -243,6 +244,7 @@ export function VerificationResultHistoryDialog({
|
||||
setErrorMessage(null);
|
||||
setResetSubmitting(false);
|
||||
setCheckedVrfcByTab(createEmptyCheckedVrfcByTab());
|
||||
loadedTabKeysRef.current.clear();
|
||||
}, []);
|
||||
|
||||
const fetchVerificationResultPage = useCallback(
|
||||
@@ -279,10 +281,10 @@ export function VerificationResultHistoryDialog({
|
||||
);
|
||||
|
||||
const loadTabPage = useCallback(
|
||||
async (tab: VerificationHistoryTabKey, pageIndex: number) => {
|
||||
async (tab: VerificationHistoryTabKey, pageIndex: number): Promise<boolean> => {
|
||||
if (!stableQueryContext) {
|
||||
setErrorMessage("조회 조건이 없어 검증 결과를 불러올 수 없습니다.");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
setErrorMessage(null);
|
||||
setLoadingByTab((prev) => ({ ...prev, [tab]: true }));
|
||||
@@ -296,10 +298,12 @@ export function VerificationResultHistoryDialog({
|
||||
? Math.max(0, Number(apiCurrentPage) - 1)
|
||||
: pageIndex;
|
||||
applyPageResponse(tab, resolvedPageIndex, list, totalPages);
|
||||
return true;
|
||||
} catch {
|
||||
const tabLabel =
|
||||
verificationHistoryTabs.find((t) => t.value === tab)?.label ?? tab;
|
||||
setErrorMessage(`${tabLabel} 조회 중 오류가 발생했습니다.`);
|
||||
return false;
|
||||
} finally {
|
||||
setLoadingByTab((prev) => ({ ...prev, [tab]: false }));
|
||||
}
|
||||
@@ -314,40 +318,27 @@ export function VerificationResultHistoryDialog({
|
||||
}
|
||||
setErrorMessage(null);
|
||||
setTabPages(initialTabPageState());
|
||||
setLoadingByTab({ NV: true, IMR: true, HB: true });
|
||||
try {
|
||||
const results = await Promise.all(
|
||||
verificationHistoryTabs.map((tab) =>
|
||||
fetchVerificationResultPage(tab.value, 0),
|
||||
),
|
||||
);
|
||||
setEntriesByTab({
|
||||
NV: results[0]?.data?.verifyResultList ?? [],
|
||||
IMR: results[1]?.data?.verifyResultList ?? [],
|
||||
HB: results[2]?.data?.verifyResultList ?? [],
|
||||
});
|
||||
setTabPages({
|
||||
NV: {
|
||||
pageIndex: 0,
|
||||
pageCount: Math.max(results[0]?.data?.pageInfo?.totalPages ?? 1, 1),
|
||||
},
|
||||
IMR: {
|
||||
pageIndex: 0,
|
||||
pageCount: Math.max(results[1]?.data?.pageInfo?.totalPages ?? 1, 1),
|
||||
},
|
||||
HB: {
|
||||
pageIndex: 0,
|
||||
pageCount: Math.max(results[2]?.data?.pageInfo?.totalPages ?? 1, 1),
|
||||
},
|
||||
});
|
||||
} catch {
|
||||
setEntriesByTab({ NV: [], IMR: [], HB: [] });
|
||||
setTabPages(initialTabPageState());
|
||||
setErrorMessage("검증 결과 내역 조회 중 오류가 발생했습니다.");
|
||||
} finally {
|
||||
setLoadingByTab({ NV: false, IMR: false, HB: false });
|
||||
setEntriesByTab({ NV: [], IMR: [], HB: [] });
|
||||
loadedTabKeysRef.current.clear();
|
||||
const loaded = await loadTabPage("NV", 0);
|
||||
if (loaded) {
|
||||
loadedTabKeysRef.current.add("NV");
|
||||
}
|
||||
}, [fetchVerificationResultPage, stableQueryContext]);
|
||||
}, [loadTabPage, stableQueryContext]);
|
||||
|
||||
const handleActiveTabChange = useCallback(
|
||||
(tab: VerificationHistoryTabKey) => {
|
||||
setActiveTab(tab);
|
||||
if (loadedTabKeysRef.current.has(tab)) return;
|
||||
void (async () => {
|
||||
const loaded = await loadTabPage(tab, 0);
|
||||
if (loaded) {
|
||||
loadedTabKeysRef.current.add(tab);
|
||||
}
|
||||
})();
|
||||
},
|
||||
[loadTabPage],
|
||||
);
|
||||
|
||||
const handleTabPageChange = useCallback(
|
||||
(tab: VerificationHistoryTabKey, pageIndex: number) => {
|
||||
@@ -577,7 +568,7 @@ export function VerificationResultHistoryDialog({
|
||||
)}
|
||||
<Tabs
|
||||
value={activeTab}
|
||||
onValueChange={(value) => setActiveTab(value as VerificationHistoryTabKey)}
|
||||
onValueChange={(value) => handleActiveTabChange(value as VerificationHistoryTabKey)}
|
||||
className="w-full"
|
||||
variant="default"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user