diff --git a/apps/st/src/components/statistics/input/ExcretaTreatmentFacilityInp.tsx b/apps/st/src/components/statistics/input/ExcretaTreatmentFacilityInp.tsx index 2b5eb6dc5..8aa9b1231 100644 --- a/apps/st/src/components/statistics/input/ExcretaTreatmentFacilityInp.tsx +++ b/apps/st/src/components/statistics/input/ExcretaTreatmentFacilityInp.tsx @@ -872,6 +872,7 @@ const ExcretaTreatmentFacilityInp = () => { flushSync(() => { setSggOptions(list); setRowData([...currentRows, newRow]); + setIsNotApplicable(false); }); }; diff --git a/apps/st/src/components/statistics/input/PumpingStationInp.tsx b/apps/st/src/components/statistics/input/PumpingStationInp.tsx index 09910a3df..0ba599429 100644 --- a/apps/st/src/components/statistics/input/PumpingStationInp.tsx +++ b/apps/st/src/components/statistics/input/PumpingStationInp.tsx @@ -856,6 +856,7 @@ const PumpingStationInp = () => { flushSync(() => { setSggOptions(list); setRowData([...currentRows, newRow]); + setIsNotApplicable(false); }); }; diff --git a/apps/st/src/components/statistics/input/SewageExcretaRelatedInp.tsx b/apps/st/src/components/statistics/input/SewageExcretaRelatedInp.tsx index 974b47556..6fc83def9 100644 --- a/apps/st/src/components/statistics/input/SewageExcretaRelatedInp.tsx +++ b/apps/st/src/components/statistics/input/SewageExcretaRelatedInp.tsx @@ -1681,12 +1681,6 @@ const SewageExcretaRelatedInp = () => { return; } - const noApplicable = isNotApplicableByTab.get(tabKey) ?? false; - if (noApplicable) { - alert("해당사항 없음이 체크된 상태에서는 항목을 추가할 수 없습니다."); - return; - } - let list = sggOptions; if (sggOptionsSidoRef.current !== ctx.sido || list.length === 0) { list = await loadSggOptions(ctx.sido); @@ -1715,6 +1709,7 @@ const SewageExcretaRelatedInp = () => { next.set(tabKey, [...currentRows, newRow]); return next; }); + setIsNotApplicableForTab(tabKey, false); }); commitToolbarSnapshotForLoadedTab( diff --git a/apps/st/src/components/statistics/input/SewageExcretaSlurgeInp.tsx b/apps/st/src/components/statistics/input/SewageExcretaSlurgeInp.tsx index 90ad9e99c..4ddc75984 100644 --- a/apps/st/src/components/statistics/input/SewageExcretaSlurgeInp.tsx +++ b/apps/st/src/components/statistics/input/SewageExcretaSlurgeInp.tsx @@ -1809,6 +1809,7 @@ const SewageExcretaSlurgeInp = () => { next.set(tabKey, [...currentRows, newRow]); return next; }); + setIsNotApplicableForTab(tabKey, false); }); const statusInfo = tabStatusInfoMap.get(tabKey) ?? null; diff --git a/apps/st/src/components/statistics/input/SewageReservoirPumpInp.tsx b/apps/st/src/components/statistics/input/SewageReservoirPumpInp.tsx index 6d0f8104b..80a9eb537 100644 --- a/apps/st/src/components/statistics/input/SewageReservoirPumpInp.tsx +++ b/apps/st/src/components/statistics/input/SewageReservoirPumpInp.tsx @@ -1426,6 +1426,7 @@ const SewageReservoirPumpInp = () => { next.set(tabKey, [...currentRows, newRow]); return next; }); + setIsNotApplicableForTab(tabKey, false); }); const statusInfo = tabStatusInfoMap.get(tabKey) ?? null; diff --git a/apps/st/src/components/statistics/input/WaterReuseInp.tsx b/apps/st/src/components/statistics/input/WaterReuseInp.tsx index d3ef54a83..d003934bc 100644 --- a/apps/st/src/components/statistics/input/WaterReuseInp.tsx +++ b/apps/st/src/components/statistics/input/WaterReuseInp.tsx @@ -117,7 +117,10 @@ const ARTICLE_EDIT_TAB_KEYS = new Set([ TreatWaterReuseBusinessApprStatusInpColumn.tabKey, ]); -const NO_APPLICABLE_TAB_KEYS = ARTICLE_EDIT_TAB_KEYS; +const NO_APPLICABLE_TAB_KEYS = new Set([ + PublicSewageTreatWaterReuseInpColumn.tabKey, + ...ARTICLE_EDIT_TAB_KEYS, +]); const WATER_REUSE_TAB_BY_KEY = new Map( WaterReuseInpTabList.map((tab) => [tab.tabKey, tab]), @@ -1073,19 +1076,11 @@ const WaterReuseInp = () => { return; } - if (isPublicSewageTab) { - const currentData = getTabGridRows(tabKey); - if (currentData.length === 0) { - alert("제출할 데이터가 없습니다."); - return; - } - } else { - const noApplicable = isNotApplicableByTab.get(tabKey) ?? false; - const currentData = getTabGridRows(tabKey); - if (!noApplicable && currentData.length === 0) { - alert("해당사항 없음을 체크해주세요."); - return; - } + const noApplicable = isNotApplicableByTab.get(tabKey) ?? false; + const currentData = getTabGridRows(tabKey); + if (!noApplicable && currentData.length === 0) { + alert("해당사항 없음을 체크해주세요."); + return; } if (await confirm("제출 하시겠습니까?")) { @@ -1179,17 +1174,20 @@ const WaterReuseInp = () => { }; if (isPublicSewageTab) { + const noApplicable = isNotApplicableByTab.get(tabKey) ?? false; const currentData = getTabGridRows(tabKey); - const submitList = currentData.map(buildPublicSewageTreatWaterReuseSaveItem); - if (submitList.length === 0) { - alert("제출할 데이터가 없습니다."); + const submitList = noApplicable + ? [] + : currentData.map(buildPublicSewageTreatWaterReuseSaveItem); + if (!noApplicable && submitList.length === 0) { + alert("해당사항 없음을 체크해주세요."); return; } response = await statisticsInputWaterReuseApi.submitPublicSewageTreatWaterReuse({ ...submitRequestBase, userId: userInfo.userUnqId, - noApplicable: false, + noApplicable, submitList, }); } else { @@ -1420,9 +1418,13 @@ const WaterReuseInp = () => { }; if (tabKey === PublicSewageTreatWaterReuseInpColumn.tabKey) { + const noApplicable = isNotApplicableByTab.get(tabKey) ?? false; const currentData = getTabGridRows(tabKey); - if (currentData.length === 0) { - alert("저장할 데이터가 없습니다."); + const saveList = noApplicable + ? [] + : currentData.map(buildPublicSewageTreatWaterReuseSaveItem); + if (!noApplicable && saveList.length === 0) { + alert("해당사항 없음을 체크해주세요."); return; } @@ -1433,8 +1435,8 @@ const WaterReuseInp = () => { await statisticsInputWaterReuseApi.savePublicSewageTreatWaterReuse({ ...requestBase, userId: userInfo.userUnqId, - noApplicable: false, - saveList: currentData.map(buildPublicSewageTreatWaterReuseSaveItem), + noApplicable, + saveList, }); if (response.status === "success") { @@ -1792,6 +1794,7 @@ const WaterReuseInp = () => { next.set(tabKey, [...currentRows, newRow]); return next; }); + setIsNotApplicableForTab(tabKey, false); }); const statusInfo = tabStatusInfoMap.get(tabKey) ?? null;