Merge branch 'iipbs/st/dev' of https://www.onasys.co.kr:3000/ONAANDALL/frontend into iipbs/st/dev
This commit is contained in:
@@ -40,6 +40,7 @@ import type { SearchFormValues } from "@/components/type/SearchForm.type";
|
||||
import { doList } from "@/components/util/column/input/DoList";
|
||||
import { toGridRows } from "@/components/util/grid/gridFunction";
|
||||
import { isVerificationFailedFromCommonInfo } from "@/components/util/input/verification-failed-flag";
|
||||
import type { VerificationResultLikeMap } from "@/components/util/input/verification-result-display";
|
||||
import { formatCompactYmdForGrid, toCompactYmdOrNull } from "@/components/util/grid/ymdFormat";
|
||||
import { statisticsInputExcretaTreatmentFacilityApi } from "@/entities/statistics/api/input/statistics-input-excreta-treatment-facility-service";
|
||||
import { statisticsInputSewSupplyRateApi } from "@/entities/statistics/api/input/statistics-input-sew-supply-rate-service";
|
||||
@@ -109,7 +110,7 @@ function computeTabToolbarSnapshot(
|
||||
const gugunOk = buildGugunOkForToolbar(searchContext);
|
||||
const enterable = computeTabEnterable(statusInfo, periodEnterable);
|
||||
const isSubmitted = statusInfo?.laeSbmsnSttsCd === "2";
|
||||
const showSaveInToolbar = (enterable || isAdminInfo) && gugunOk;
|
||||
const showSaveInToolbar = (enterable || isAdminInfo) && periodEnterable && gugunOk;
|
||||
const showEnterableToolbarButtons = enterable && gugunOk;
|
||||
const showSubmittedInInputPeriodToolbar =
|
||||
isSubmitted && periodEnterable && gugunOk;
|
||||
@@ -339,6 +340,8 @@ const ExcretaTreatmentFacilityInp = () => {
|
||||
const [statusInfo, setStatusInfo] = useState<SewerageStatusInfo | null>(null);
|
||||
const [statsCd, setStatsCd] = useState("");
|
||||
const [isVerificationFailed, setIsVerificationFailed] = useState(false);
|
||||
const [footerVerificationResult, setFooterVerificationResult] =
|
||||
useState<VerificationResultLikeMap | null>(null);
|
||||
const [inputPeriodEnterable, setInputPeriodEnterable] = useState(true);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [sggOptions, setSggOptions] = useState<Sgg[]>([]);
|
||||
@@ -406,7 +409,7 @@ const ExcretaTreatmentFacilityInp = () => {
|
||||
|
||||
const columnInfo = useMemo(() => {
|
||||
const enterable =
|
||||
computeTabEnterable(statusInfo, inputPeriodEnterable) || isAdminInfo;
|
||||
(computeTabEnterable(statusInfo, inputPeriodEnterable) || isAdminInfo) && inputPeriodEnterable;
|
||||
const rawColumns = ExcretaTreatFactInpColumn.columns ?? [];
|
||||
const base = enterable
|
||||
? rawColumns
|
||||
@@ -434,7 +437,7 @@ const ExcretaTreatmentFacilityInp = () => {
|
||||
}, [statusInfo, inputPeriodEnterable, isAdminInfo, sggOptions, columnGuidesByEngCol]);
|
||||
|
||||
const canEditGrid =
|
||||
computeTabEnterable(statusInfo, inputPeriodEnterable) || isAdminInfo;
|
||||
(computeTabEnterable(statusInfo, inputPeriodEnterable) || isAdminInfo) && inputPeriodEnterable;
|
||||
|
||||
const getCurrentRows = (): Record<string, string | number>[] =>
|
||||
gridGetRowsRef.current?.() ?? rowData;
|
||||
@@ -477,6 +480,7 @@ const ExcretaTreatmentFacilityInp = () => {
|
||||
setStatusInfo(nextStatusInfo);
|
||||
setStatsCd(commonInfo.statsCd);
|
||||
setIsVerificationFailed(isVerificationFailedFromCommonInfo(commonInfo));
|
||||
setFooterVerificationResult(commonInfo.verificationResult ?? null);
|
||||
if (overrides?.mode !== "PRE") {
|
||||
setIsNotApplicable(gridRows.length === 0);
|
||||
} else if (gridRows.length > 0) {
|
||||
@@ -536,6 +540,7 @@ const ExcretaTreatmentFacilityInp = () => {
|
||||
setStatusInfo(null);
|
||||
setStatsCd("");
|
||||
setIsVerificationFailed(false);
|
||||
setFooterVerificationResult(null);
|
||||
setIsNotApplicable(false);
|
||||
setInputPeriodEnterable(true);
|
||||
setSggOptions([]);
|
||||
@@ -984,7 +989,7 @@ const ExcretaTreatmentFacilityInp = () => {
|
||||
computeTabEnterable(statusInfo, inputPeriodEnterable);
|
||||
|
||||
const tabEnterableForGrid =
|
||||
computeTabEnterable(statusInfo, inputPeriodEnterable) || isAdminInfo;
|
||||
(computeTabEnterable(statusInfo, inputPeriodEnterable) || isAdminInfo) && inputPeriodEnterable;
|
||||
const gugunOk = buildGugunOkForToolbar(lastSearchedValues);
|
||||
|
||||
const verificationQueryContext = (() => {
|
||||
@@ -1017,7 +1022,7 @@ const ExcretaTreatmentFacilityInp = () => {
|
||||
onValuesChange={setSearchValues}
|
||||
/>
|
||||
{showActionToolbarCard && (
|
||||
<div className="card !py-0">
|
||||
<div className="card !py-0">
|
||||
<div className="m-[0.6rem] flex items-center justify-end gap-[0.6rem]">
|
||||
<VerificationResultButton
|
||||
VerificationResultButtonFunc={openVerificationHistoryDialog}
|
||||
@@ -1028,18 +1033,18 @@ const ExcretaTreatmentFacilityInp = () => {
|
||||
<LastYearDataButton
|
||||
getLastYearDataFunc={() => void getLastYearDataFunc()}
|
||||
/>
|
||||
<SubmitButton submitFunc={submitFunc} />
|
||||
<SubmitButton submitFunc={submitFunc} />
|
||||
</>
|
||||
)}
|
||||
{statusInfo?.laeSbmsnSttsCd === "2" && (
|
||||
<CancelSubmitButton cnacelSubmitFunc={cnacelSubmitFunc} />
|
||||
)}
|
||||
{showSaveInToolbar && <SaveButton saveFunc={saveFunc} />}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{showArticleToolbarCard && (
|
||||
<div className="card !py-0">
|
||||
<div className="card !py-0">
|
||||
<div className="m-[0.6rem] flex items-center justify-end gap-[0.6rem]">
|
||||
{showNotApplicable && (
|
||||
<NotApplicableCheckButton
|
||||
@@ -1047,10 +1052,10 @@ const ExcretaTreatmentFacilityInp = () => {
|
||||
setIsCheck={setIsNotApplicable}
|
||||
/>
|
||||
)}
|
||||
<AddArticleButton addArticleFunc={addArticleFunc} />
|
||||
<DeleteArticleButton deleteArticleFunc={deleteArticleFunc} />
|
||||
</div>
|
||||
</div>
|
||||
<AddArticleButton addArticleFunc={addArticleFunc} />
|
||||
<DeleteArticleButton deleteArticleFunc={deleteArticleFunc} />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{isLoading && (
|
||||
<div className="absolute inset-0 z-50 flex items-center justify-center rounded-lg p-10 [data-theme='black']:bg-transparent">
|
||||
@@ -1059,14 +1064,14 @@ const ExcretaTreatmentFacilityInp = () => {
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<DataGrid
|
||||
<DataGrid
|
||||
key={canEditGrid ? "enterable" : "readonly"}
|
||||
getGridRef={gridRef as RefObject<RealGridReact | null>}
|
||||
columnInfo={columnInfo}
|
||||
rowStartNum={ExcretaTreatFactInpColumn.rowStartNum}
|
||||
fixedColumns={ExcretaTreatFactInpColumn.fixedColumns}
|
||||
rowData={rowData}
|
||||
setRowData={setRowData}
|
||||
rowData={rowData}
|
||||
setRowData={setRowData}
|
||||
getGridDataRef={gridGetRowsRef}
|
||||
showHeaderCheckbox
|
||||
statusInfo={statusInfo}
|
||||
@@ -1076,6 +1081,7 @@ const ExcretaTreatmentFacilityInp = () => {
|
||||
excelImportSewerBzmnCd={(lastSearchedValues ?? searchValues)?.bsnmCd}
|
||||
excelExportSearchContext={toExcelExportSearchContextFromSearchForm(lastSearchedValues ?? searchValues)}
|
||||
cellStyleCallback={verificationCellStyle}
|
||||
footerVerificationResult={footerVerificationResult}
|
||||
cellTooltipCallback={verificationCellTooltip}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -58,7 +58,11 @@ import { SewageTreatFactStatusInpColumn } from "@/components/util/column/input/p
|
||||
import { toGridRows } from "@/components/util/grid/gridFunction";
|
||||
import { fetchColumnGuidesRecord } from "@/components/util/grid/columnGuides";
|
||||
import { useTabStore } from "@/store/tab-store";
|
||||
import { patchVerificationFailedByTab } from "@/components/util/input/verification-failed-flag";
|
||||
import {
|
||||
patchFooterVerificationByTab,
|
||||
patchVerificationFailedByTab,
|
||||
} from "@/components/util/input/verification-failed-flag";
|
||||
import type { VerificationResultLikeMap } from "@/components/util/input/verification-result-display";
|
||||
import { useAdminStore } from "@/store/admin-store";
|
||||
|
||||
const PrivateSewageFacilityInpTabList = [
|
||||
@@ -134,7 +138,7 @@ function computeTabToolbarSnapshot(
|
||||
const gugunOk = buildGugunOkForToolbar(searchContext);
|
||||
const enterable = computeTabEnterable(statusInfo, periodEnterable);
|
||||
const isSubmitted = statusInfo?.laeSbmsnSttsCd === "2";
|
||||
const showSaveInToolbar = (enterable || isAdminInfo) && gugunOk;
|
||||
const showSaveInToolbar = (enterable || isAdminInfo) && periodEnterable && gugunOk;
|
||||
const showEnterableToolbarButtons = enterable && gugunOk;
|
||||
const showSubmittedInInputPeriodToolbar = isSubmitted && periodEnterable && gugunOk;
|
||||
const showActionToolbarCard =
|
||||
@@ -343,6 +347,9 @@ const PrivateSewageFacilityInp = () => {
|
||||
const [isVerificationFailedByTab, setIsVerificationFailedByTab] = useState<
|
||||
Map<string, boolean>
|
||||
>(new Map());
|
||||
const [footerVerificationByTab, setFooterVerificationByTab] = useState<
|
||||
Map<string, VerificationResultLikeMap | null>
|
||||
>(new Map());
|
||||
const [toolbarSnapshotByTab, setToolbarSnapshotByTab] = useState<
|
||||
Map<string, TabToolbarSnapshot>
|
||||
>(new Map());
|
||||
@@ -458,6 +465,9 @@ const PrivateSewageFacilityInp = () => {
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
if (updateLastSearchedValues) setLastSearchedValues(searchContext);
|
||||
commitToolbarSnapshotForLoadedTab(tabKey, statusInfo, gridRows.length > 0, searchContext);
|
||||
return true;
|
||||
@@ -486,6 +496,9 @@ const PrivateSewageFacilityInp = () => {
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
if (updateLastSearchedValues) setLastSearchedValues(searchContext);
|
||||
commitToolbarSnapshotForLoadedTab(tabKey, statusInfo, gridRows.length > 0, searchContext);
|
||||
return true;
|
||||
@@ -514,6 +527,9 @@ const PrivateSewageFacilityInp = () => {
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
if (updateLastSearchedValues) setLastSearchedValues(searchContext);
|
||||
commitToolbarSnapshotForLoadedTab(tabKey, statusInfo, gridRows.length > 0, searchContext);
|
||||
return true;
|
||||
@@ -531,6 +547,7 @@ const PrivateSewageFacilityInp = () => {
|
||||
setTabStatusInfoMap(new Map());
|
||||
setTabStatsCdMap(new Map());
|
||||
setIsVerificationFailedByTab(new Map());
|
||||
setFooterVerificationByTab(new Map());
|
||||
setToolbarSnapshotByTab(new Map());
|
||||
setActiveTab(firstTabKey);
|
||||
activeTabRef.current = firstTabKey;
|
||||
@@ -573,6 +590,7 @@ const PrivateSewageFacilityInp = () => {
|
||||
setTabStatusInfoMap(new Map());
|
||||
setTabStatsCdMap(new Map());
|
||||
setIsVerificationFailedByTab(new Map());
|
||||
setFooterVerificationByTab(new Map());
|
||||
setToolbarSnapshotByTab(new Map());
|
||||
activeTabRef.current = firstTabKey;
|
||||
setActiveTab(firstTabKey);
|
||||
@@ -1067,10 +1085,10 @@ const PrivateSewageFacilityInp = () => {
|
||||
for (const tab of PrivateSewageFacilityInpTabList) {
|
||||
const tabKey = tab.tabKey;
|
||||
const canEdit =
|
||||
computeTabEnterable(
|
||||
(computeTabEnterable(
|
||||
tabStatusInfoMap.get(tabKey) ?? null,
|
||||
inputPeriodEnterable,
|
||||
) || isAdminInfo;
|
||||
) || isAdminInfo) && inputPeriodEnterable;
|
||||
const rawColumns = (tab.columns ?? []) as ColumnConfig[];
|
||||
const base = canEdit
|
||||
? rawColumns
|
||||
@@ -1213,10 +1231,10 @@ const PrivateSewageFacilityInp = () => {
|
||||
const tabKey = info.tabKey;
|
||||
const rowData = rowDataMap.get(tabKey) ?? [];
|
||||
const tabEnterableForGrid =
|
||||
computeTabEnterable(
|
||||
(computeTabEnterable(
|
||||
tabStatusInfoMap.get(tabKey) ?? null,
|
||||
inputPeriodEnterable,
|
||||
) || isAdminInfo;
|
||||
) || isAdminInfo) && inputPeriodEnterable;
|
||||
const gugunOk = buildGugunOkForToolbar(lastSearchedValues);
|
||||
const tabStatusInfo = tabStatusInfoMap.get(tabKey) ?? null;
|
||||
|
||||
@@ -1255,6 +1273,9 @@ const PrivateSewageFacilityInp = () => {
|
||||
excelExportSearchContext={toExcelExportSearchContextFromSearchForm(lastSearchedValues ?? searchValues)}
|
||||
isExcelExport
|
||||
cellStyleCallback={verificationCellStyle}
|
||||
footerVerificationResult={
|
||||
footerVerificationByTab.get(tabKey) ?? null
|
||||
}
|
||||
cellTooltipCallback={verificationCellTooltip}
|
||||
getGridDataRef={
|
||||
activeTab === tabKey ? getGridDataRef : undefined
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useEffect, useRef, useState, type Dispatch, type SetStateAction } from 'react';
|
||||
import { useEffect, useRef, useState, type Dispatch, type SetStateAction } from 'react';
|
||||
|
||||
import { useConfirm } from '@frontend-opensource/use-react-hooks';
|
||||
|
||||
@@ -51,7 +51,8 @@ import { PublicSewageFactInpColumnList } from '@/components/util/column/input/Pu
|
||||
import { toGridRows } from '@/components/util/grid/gridFunction';
|
||||
import { fetchColumnGuidesRecord } from '@/components/util/grid/columnGuides';
|
||||
import { useTabStore } from '@/store/tab-store';
|
||||
import { patchVerificationFailedByTab } from '@/components/util/input/verification-failed-flag';
|
||||
import { patchVerificationFailedByTab, patchFooterVerificationByTab } from '@/components/util/input/verification-failed-flag';
|
||||
import type { VerificationResultLikeMap } from '@/components/util/input/verification-result-display';
|
||||
import { useAdminStore } from '@/store/admin-store';
|
||||
|
||||
type GridRowWithVerification = Record<string, string | number> & {
|
||||
@@ -94,7 +95,7 @@ function computeTabToolbarSnapshot(
|
||||
const gugunOk = buildGugunOkForToolbar(searchContext);
|
||||
const enterable = computeTabEnterable(statusInfo, periodEnterable);
|
||||
const isSubmitted = statusInfo?.laeSbmsnSttsCd === '2';
|
||||
const showSaveInToolbar = (enterable || isAdminInfo) && gugunOk;
|
||||
const showSaveInToolbar = (enterable || isAdminInfo) && periodEnterable && gugunOk;
|
||||
const showEnterableToolbarButtons = enterable && gugunOk;
|
||||
const showSubmittedInInputPeriodToolbar = isSubmitted && periodEnterable && gugunOk;
|
||||
const showActionToolbarCard =
|
||||
@@ -201,6 +202,9 @@ const PublicSewageFacilityInp = () => {
|
||||
const [isVerificationFailedByTab, setIsVerificationFailedByTab] = useState<
|
||||
Map<string, boolean>
|
||||
>(new Map());
|
||||
const [footerVerificationByTab, setFooterVerificationByTab] = useState<
|
||||
Map<string, VerificationResultLikeMap | null>
|
||||
>(new Map());
|
||||
/** 탭키별 `engColNm -> columnGuide` 캐시 */
|
||||
const [columnGuidesByTab, setColumnGuidesByTab] = useState<Record<string, Record<string, string>>>({});
|
||||
const [_toolbarSnapshotByTab, setToolbarSnapshotByTab] = useState<Map<string, TabToolbarSnapshot>>(() => new Map());
|
||||
@@ -750,6 +754,9 @@ const PublicSewageFacilityInp = () => {
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setRowDataMap((prev) => {
|
||||
const next = new Map(prev);
|
||||
next.set('ST00060001', gridRows);
|
||||
@@ -797,6 +804,9 @@ const PublicSewageFacilityInp = () => {
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, response.data.commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, response.data.commonInfo),
|
||||
);
|
||||
setRowDataMap((prev) => {
|
||||
const next = new Map(prev);
|
||||
next.set('MainFacility', leftGridRows);
|
||||
@@ -959,6 +969,7 @@ const PublicSewageFacilityInp = () => {
|
||||
setTabStatusInfoMap(new Map());
|
||||
setTabStatsCdMap(new Map());
|
||||
setIsVerificationFailedByTab(new Map());
|
||||
setFooterVerificationByTab(new Map());
|
||||
setToolbarSnapshotByTab(new Map());
|
||||
activeTabRef.current = firstTabKey;
|
||||
setActiveTab(firstTabKey);
|
||||
@@ -1022,6 +1033,7 @@ const PublicSewageFacilityInp = () => {
|
||||
setTabStatusInfoMap(new Map());
|
||||
setTabStatsCdMap(new Map());
|
||||
setIsVerificationFailedByTab(new Map());
|
||||
setFooterVerificationByTab(new Map());
|
||||
setToolbarSnapshotByTab(new Map());
|
||||
|
||||
setInputPeriodEnterable(true);
|
||||
@@ -1080,13 +1092,16 @@ const PublicSewageFacilityInp = () => {
|
||||
const getGridColumnInfo = (
|
||||
tab: ColumnInfoList,
|
||||
guideTabKey?: string,
|
||||
canEdit = true,
|
||||
): ColumnInfo => ({
|
||||
columns: (tab.columns ?? []).map((col) => {
|
||||
const guide = columnGuidesByTab[guideTabKey ?? tab.tabKey]?.[col.fieldName]?.trim();
|
||||
return {
|
||||
const withGuide = {
|
||||
...col,
|
||||
tooltip: guide && guide.length > 0 ? guide : undefined,
|
||||
};
|
||||
if (canEdit) return withGuide;
|
||||
return { ...withGuide, editable: false as const };
|
||||
}),
|
||||
columnLayout: tab.columnLayout ?? [],
|
||||
});
|
||||
@@ -1164,7 +1179,7 @@ const PublicSewageFacilityInp = () => {
|
||||
isMainFacilityTab &&
|
||||
tabRowDataExists('ST00060002') &&
|
||||
gugunOkOrNotDoList &&
|
||||
(isAdminInfo || inputPeriodEnterable);
|
||||
inputPeriodEnterable;
|
||||
const showSaveInToolbar =
|
||||
toolbarGroupAllowed && (baseShowSaveInToolbar || showMainFacilitySaveInToolbar);
|
||||
const showEnterableToolbarButtons =
|
||||
@@ -1261,14 +1276,28 @@ const PublicSewageFacilityInp = () => {
|
||||
</TabsList>
|
||||
|
||||
{PublicSewageFactInpColumnList.map((tab) => {
|
||||
const tabStatus = tabStatusInfoMap.get(tab.tabKey) ?? null;
|
||||
const tabEnterableForGrid =
|
||||
(computeTabEnterable(tabStatus, inputPeriodEnterable) ||
|
||||
isAdminInfo) &&
|
||||
inputPeriodEnterable;
|
||||
|
||||
if (tab.isSplitGrid && tab.left && tab.right) {
|
||||
const leftKey = tab.left.tabKey ?? `${tab.tabKey}_left`;
|
||||
const rightKey = tab.right.tabKey ?? `${tab.tabKey}_right`;
|
||||
return (
|
||||
<TabsContent key={tab.tabKey} value={tab.tabKey}>
|
||||
<SplitDataGrid
|
||||
leftColumnInfo={getGridColumnInfo(tab.left, tab.tabKey)}
|
||||
rightColumnInfo={getGridColumnInfo(tab.right, tab.tabKey)}
|
||||
leftColumnInfo={getGridColumnInfo(
|
||||
tab.left,
|
||||
tab.tabKey,
|
||||
tabEnterableForGrid,
|
||||
)}
|
||||
rightColumnInfo={getGridColumnInfo(
|
||||
tab.right,
|
||||
tab.tabKey,
|
||||
tabEnterableForGrid,
|
||||
)}
|
||||
leftFixedColumns={tab.left.fixedColumns}
|
||||
rightFixedColumns={tab.right.fixedColumns}
|
||||
showHeaderCheckbox={true}
|
||||
@@ -1348,11 +1377,10 @@ const PublicSewageFacilityInp = () => {
|
||||
);
|
||||
}
|
||||
|
||||
const gridColumnInfo = getGridColumnInfo(tab);
|
||||
const tabStatus = tabStatusInfoMap.get(tab.tabKey) ?? null;
|
||||
const tabEnterableForGrid = computeTabEnterable(
|
||||
tabStatus,
|
||||
inputPeriodEnterable,
|
||||
const gridColumnInfo = getGridColumnInfo(
|
||||
tab,
|
||||
undefined,
|
||||
tabEnterableForGrid,
|
||||
);
|
||||
const excelToolbarEnabledForTab =
|
||||
tabRowDataExists(tab.tabKey) &&
|
||||
@@ -1362,7 +1390,7 @@ const PublicSewageFacilityInp = () => {
|
||||
return (
|
||||
<TabsContent key={tab.tabKey} value={tab.tabKey}>
|
||||
<DataGrid
|
||||
key={tab.tabKey}
|
||||
key={`${tab.tabKey}-${tabEnterableForGrid ? 'enterable' : 'readonly'}`}
|
||||
columnInfo={gridColumnInfo}
|
||||
rowStartNum={tab.rowStartNum}
|
||||
excelExportFileSuffix={tab.tabLabel || tab.tabKey}
|
||||
@@ -1399,6 +1427,9 @@ const PublicSewageFacilityInp = () => {
|
||||
return hasImr ? "rg-cell-verify-error-imr" : "rg-cell-verify-error";
|
||||
}
|
||||
}}
|
||||
footerVerificationResult={
|
||||
footerVerificationByTab.get(tab.tabKey) ?? null
|
||||
}
|
||||
cellTooltipCallback={({ row, fieldName }) => {
|
||||
const verification = (row as GridRowWithVerification).verificationResult;
|
||||
if (!verification) return;
|
||||
|
||||
@@ -40,6 +40,7 @@ import type { SearchFormValues } from "@/components/type/SearchForm.type";
|
||||
import { doList } from "@/components/util/column/input/DoList";
|
||||
import { toGridRows } from "@/components/util/grid/gridFunction";
|
||||
import { isVerificationFailedFromCommonInfo } from "@/components/util/input/verification-failed-flag";
|
||||
import type { VerificationResultLikeMap } from "@/components/util/input/verification-result-display";
|
||||
import { formatCompactYmdForGrid, toCompactYmdOrNull } from "@/components/util/grid/ymdFormat";
|
||||
import { statisticsInputPumpingStationApi } from "@/entities/statistics/api/input/statistics-input-pumping-station-service";
|
||||
import { statisticsInputSewSupplyRateApi } from "@/entities/statistics/api/input/statistics-input-sew-supply-rate-service";
|
||||
@@ -109,7 +110,7 @@ function computeTabToolbarSnapshot(
|
||||
const gugunOk = buildGugunOkForToolbar(searchContext);
|
||||
const enterable = computeTabEnterable(statusInfo, periodEnterable);
|
||||
const isSubmitted = statusInfo?.laeSbmsnSttsCd === "2";
|
||||
const showSaveInToolbar = (enterable || isAdminInfo) && gugunOk;
|
||||
const showSaveInToolbar = (enterable || isAdminInfo) && periodEnterable && gugunOk;
|
||||
const showEnterableToolbarButtons = enterable && gugunOk;
|
||||
const showSubmittedInInputPeriodToolbar =
|
||||
isSubmitted && periodEnterable && gugunOk;
|
||||
@@ -334,6 +335,8 @@ const PumpingStationInp = () => {
|
||||
const [statusInfo, setStatusInfo] = useState<SewerageStatusInfo | null>(null);
|
||||
const [statsCd, setStatsCd] = useState("");
|
||||
const [isVerificationFailed, setIsVerificationFailed] = useState(false);
|
||||
const [footerVerificationResult, setFooterVerificationResult] =
|
||||
useState<VerificationResultLikeMap | null>(null);
|
||||
const [inputPeriodEnterable, setInputPeriodEnterable] = useState(true);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [sggOptions, setSggOptions] = useState<Sgg[]>([]);
|
||||
@@ -401,7 +404,7 @@ const PumpingStationInp = () => {
|
||||
|
||||
const columnInfo = useMemo(() => {
|
||||
const enterable =
|
||||
computeTabEnterable(statusInfo, inputPeriodEnterable) || isAdminInfo;
|
||||
(computeTabEnterable(statusInfo, inputPeriodEnterable) || isAdminInfo) && inputPeriodEnterable;
|
||||
const rawColumns = PumpingStationInpColumn.columns ?? [];
|
||||
const base = enterable
|
||||
? rawColumns
|
||||
@@ -429,7 +432,7 @@ const PumpingStationInp = () => {
|
||||
}, [statusInfo, inputPeriodEnterable, isAdminInfo, sggOptions, columnGuidesByEngCol]);
|
||||
|
||||
const canEditGrid =
|
||||
computeTabEnterable(statusInfo, inputPeriodEnterable) || isAdminInfo;
|
||||
(computeTabEnterable(statusInfo, inputPeriodEnterable) || isAdminInfo) && inputPeriodEnterable;
|
||||
|
||||
const getCurrentRows = (): Record<string, string | number>[] =>
|
||||
gridGetRowsRef.current?.() ?? rowData;
|
||||
@@ -469,6 +472,7 @@ const PumpingStationInp = () => {
|
||||
setStatusInfo(nextStatusInfo);
|
||||
setStatsCd(commonInfo.statsCd);
|
||||
setIsVerificationFailed(isVerificationFailedFromCommonInfo(commonInfo));
|
||||
setFooterVerificationResult(commonInfo.verificationResult ?? null);
|
||||
if (overrides?.mode !== "PRE") {
|
||||
setIsNotApplicable(gridRows.length === 0);
|
||||
} else if (gridRows.length > 0) {
|
||||
@@ -528,6 +532,7 @@ const PumpingStationInp = () => {
|
||||
setStatusInfo(null);
|
||||
setStatsCd("");
|
||||
setIsVerificationFailed(false);
|
||||
setFooterVerificationResult(null);
|
||||
setIsNotApplicable(false);
|
||||
setInputPeriodEnterable(true);
|
||||
setSggOptions([]);
|
||||
@@ -968,7 +973,7 @@ const PumpingStationInp = () => {
|
||||
computeTabEnterable(statusInfo, inputPeriodEnterable);
|
||||
|
||||
const tabEnterableForGrid =
|
||||
computeTabEnterable(statusInfo, inputPeriodEnterable) || isAdminInfo;
|
||||
(computeTabEnterable(statusInfo, inputPeriodEnterable) || isAdminInfo) && inputPeriodEnterable;
|
||||
const gugunOk = buildGugunOkForToolbar(lastSearchedValues);
|
||||
|
||||
const verificationQueryContext = (() => {
|
||||
@@ -1060,6 +1065,7 @@ const PumpingStationInp = () => {
|
||||
excelImportSewerBzmnCd={(lastSearchedValues ?? searchValues)?.bsnmCd}
|
||||
excelExportSearchContext={toExcelExportSearchContextFromSearchForm(lastSearchedValues ?? searchValues)}
|
||||
cellStyleCallback={verificationCellStyle}
|
||||
footerVerificationResult={footerVerificationResult}
|
||||
cellTooltipCallback={verificationCellTooltip}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -38,7 +38,11 @@ import { PublicInstitutionSewerIndustryInpColumn } from "@/components/util/colum
|
||||
import { toGridRows } from "@/components/util/grid/gridFunction";
|
||||
import { fetchColumnGuidesRecord } from "@/components/util/grid/columnGuides";
|
||||
import { useTabStore } from "@/store/tab-store";
|
||||
import { patchVerificationFailedByTab } from "@/components/util/input/verification-failed-flag";
|
||||
import {
|
||||
patchFooterVerificationByTab,
|
||||
patchVerificationFailedByTab,
|
||||
} from "@/components/util/input/verification-failed-flag";
|
||||
import type { VerificationResultLikeMap } from "@/components/util/input/verification-result-display";
|
||||
import { statisticsInputSewageExcretaRelatedApi } from "@/entities/statistics/api/input/statistics-input-sewage-excreta-related-service";
|
||||
import { statisticsInputSewSupplyRateApi } from "@/entities/statistics/api/input/statistics-input-sew-supply-rate-service";
|
||||
import { statisticsApi } from "@/entities/statistics/api/statistics-service";
|
||||
@@ -73,10 +77,10 @@ import { getUserInfo } from "../../../../../../packages/common/components/src/ap
|
||||
|
||||
import SubmitDailog from "./SubmitDailog";
|
||||
|
||||
const SewageExcretaRelatedInpTabList = [
|
||||
PublicInstitutionSewerIndustryInpColumn,
|
||||
PublicInstitutionExcretaIndustryInpColumn,
|
||||
ExcretaRelatedIndustryInpColumn,
|
||||
const SewageExcretaRelatedInpTabList = [
|
||||
PublicInstitutionSewerIndustryInpColumn,
|
||||
PublicInstitutionExcretaIndustryInpColumn,
|
||||
ExcretaRelatedIndustryInpColumn,
|
||||
PrivateSewageTreatRelatedIndustryInpColumn,
|
||||
] as const;
|
||||
|
||||
@@ -169,7 +173,7 @@ function computeTabToolbarSnapshot(
|
||||
const gugunOk = buildGugunOkForToolbar(searchContext);
|
||||
const enterable = computeTabEnterable(statusInfo, periodEnterable);
|
||||
const isSubmitted = statusInfo?.laeSbmsnSttsCd === "2";
|
||||
const showSaveInToolbar = (enterable || isAdminInfo) && gugunOk;
|
||||
const showSaveInToolbar = (enterable || isAdminInfo) && periodEnterable && gugunOk;
|
||||
const showEnterableToolbarButtons = enterable && gugunOk;
|
||||
const showSubmittedInInputPeriodToolbar = isSubmitted && periodEnterable && gugunOk;
|
||||
const showActionToolbarCard =
|
||||
@@ -622,6 +626,9 @@ const SewageExcretaRelatedInp = () => {
|
||||
const [isVerificationFailedByTab, setIsVerificationFailedByTab] = useState<
|
||||
Map<string, boolean>
|
||||
>(new Map());
|
||||
const [footerVerificationByTab, setFooterVerificationByTab] = useState<
|
||||
Map<string, VerificationResultLikeMap | null>
|
||||
>(new Map());
|
||||
const [isNotApplicableByTab, setIsNotApplicableByTab] = useState<Map<string, boolean>>(
|
||||
() => new Map(),
|
||||
);
|
||||
@@ -866,6 +873,9 @@ const SewageExcretaRelatedInp = () => {
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
if (updateLastSearchedValues) setLastSearchedValues(searchContext);
|
||||
commitToolbarSnapshotForLoadedTab(
|
||||
tabKey,
|
||||
@@ -909,6 +919,9 @@ const SewageExcretaRelatedInp = () => {
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
if (updateLastSearchedValues) setLastSearchedValues(searchContext);
|
||||
commitToolbarSnapshotForLoadedTab(
|
||||
tabKey,
|
||||
@@ -940,6 +953,9 @@ const SewageExcretaRelatedInp = () => {
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
if (updateLastSearchedValues) setLastSearchedValues(searchContext);
|
||||
commitToolbarSnapshotForLoadedTab(
|
||||
tabKey,
|
||||
@@ -974,6 +990,9 @@ const SewageExcretaRelatedInp = () => {
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
if (updateLastSearchedValues) setLastSearchedValues(searchContext);
|
||||
commitToolbarSnapshotForLoadedTab(
|
||||
tabKey,
|
||||
@@ -1005,6 +1024,7 @@ const SewageExcretaRelatedInp = () => {
|
||||
setLoadedTabKeys(new Set());
|
||||
setTabStatsCdMap(new Map());
|
||||
setIsVerificationFailedByTab(new Map());
|
||||
setFooterVerificationByTab(new Map());
|
||||
setIsNotApplicableByTab(new Map());
|
||||
setDeleteListByTab(new Map());
|
||||
clearArticleOgnzSnTracking(
|
||||
@@ -1055,6 +1075,7 @@ const SewageExcretaRelatedInp = () => {
|
||||
setTabStatusInfoMap(new Map());
|
||||
setTabStatsCdMap(new Map());
|
||||
setIsVerificationFailedByTab(new Map());
|
||||
setFooterVerificationByTab(new Map());
|
||||
setToolbarSnapshotByTab(new Map());
|
||||
setIsNotApplicableByTab(new Map());
|
||||
setDeleteListByTab(new Map());
|
||||
@@ -1811,10 +1832,10 @@ const SewageExcretaRelatedInp = () => {
|
||||
for (const tab of SewageExcretaRelatedInpTabList) {
|
||||
const tabKey = tab.tabKey;
|
||||
const canEdit =
|
||||
computeTabEnterable(
|
||||
(computeTabEnterable(
|
||||
tabStatusInfoMap.get(tabKey) ?? null,
|
||||
inputPeriodEnterable,
|
||||
) || isAdminInfo;
|
||||
) || isAdminInfo) && inputPeriodEnterable;
|
||||
const rawColumns = (tab.columns ?? []) as ColumnConfig[];
|
||||
const base = canEdit
|
||||
? rawColumns
|
||||
@@ -1946,8 +1967,8 @@ const SewageExcretaRelatedInp = () => {
|
||||
onValuesChange={setSearchValues}
|
||||
/>
|
||||
{showActionToolbarCard && (
|
||||
<div className="card !py-0">
|
||||
<div className="flex justify-end items-center gap-[0.6rem] m-[0.6rem]">
|
||||
<div className="card !py-0">
|
||||
<div className="flex justify-end items-center gap-[0.6rem] m-[0.6rem]">
|
||||
<VerificationResultButton
|
||||
VerificationResultButtonFunc={openVerificationHistoryDialog}
|
||||
isVerificationFailed={
|
||||
@@ -1959,19 +1980,19 @@ const SewageExcretaRelatedInp = () => {
|
||||
<LastYearDataButton
|
||||
getLastYearDataFunc={() => void lastYearDataFunc()}
|
||||
/>
|
||||
<SubmitButton submitFunc={submitFunc} />
|
||||
<SubmitButton submitFunc={submitFunc} />
|
||||
</>
|
||||
)}
|
||||
{activeTabStatus?.laeSbmsnSttsCd === "2" && (
|
||||
<CancelSubmitButton cnacelSubmitFunc={cnacelSubmitFunc} />
|
||||
)}
|
||||
{showSaveInToolbar && <SaveButton saveFunc={saveFunc} />}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{showSecondaryToolbarCard && (
|
||||
<div className="card !py-0">
|
||||
<div className="flex justify-end items-center gap-[0.6rem] m-[0.6rem]">
|
||||
<div className="card !py-0">
|
||||
<div className="flex justify-end items-center gap-[0.6rem] m-[0.6rem]">
|
||||
{showNotApplicableForActiveTab && (
|
||||
<NotApplicableCheckButton
|
||||
isCheck={isNotApplicableForActiveTab}
|
||||
@@ -1981,11 +2002,11 @@ const SewageExcretaRelatedInp = () => {
|
||||
{showArticleEditButtons && (
|
||||
<>
|
||||
<AddArticleButton addArticleFunc={() => void addArticleFunc()} />
|
||||
<DeleteArticleButton deleteArticleFunc={deleteArticleFunc} />
|
||||
<DeleteArticleButton deleteArticleFunc={deleteArticleFunc} />
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{isLoading && (
|
||||
<div className="absolute inset-0 z-50 [data-theme='black']:bg-transparent rounded-lg p-10 flex justify-center items-center">
|
||||
@@ -2013,8 +2034,8 @@ const SewageExcretaRelatedInp = () => {
|
||||
const rowData = rowDataMap.get(tabKey) ?? [];
|
||||
const tabStatusInfo = tabStatusInfoMap.get(tabKey) ?? null;
|
||||
const tabEnterableForGrid =
|
||||
computeTabEnterable(tabStatusInfo, inputPeriodEnterable) ||
|
||||
isAdminInfo;
|
||||
(computeTabEnterable(tabStatusInfo, inputPeriodEnterable) ||
|
||||
isAdminInfo) && inputPeriodEnterable;
|
||||
|
||||
return (
|
||||
<TabsContent key={tabKey} value={tabKey}>
|
||||
@@ -2055,6 +2076,9 @@ const SewageExcretaRelatedInp = () => {
|
||||
}
|
||||
getGridRef={activeTab === tabKey ? getGridRef : undefined}
|
||||
cellStyleCallback={resolveGridCellStyleCallback(tabKey)}
|
||||
footerVerificationResult={
|
||||
footerVerificationByTab.get(tabKey) ?? null
|
||||
}
|
||||
cellTooltipCallback={verificationCellTooltip}
|
||||
/>
|
||||
</TabsContent>
|
||||
@@ -2102,7 +2126,7 @@ const SewageExcretaRelatedInp = () => {
|
||||
false,
|
||||
);
|
||||
}}
|
||||
/>
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -52,7 +52,11 @@ import { doList } from "@/components/util/column/input/DoList";
|
||||
import { toGridRows } from "@/components/util/grid/gridFunction";
|
||||
import { fetchColumnGuidesRecord } from "@/components/util/grid/columnGuides";
|
||||
import { useTabStore } from "@/store/tab-store";
|
||||
import { patchVerificationFailedByTab } from "@/components/util/input/verification-failed-flag";
|
||||
import {
|
||||
patchFooterVerificationByTab,
|
||||
patchVerificationFailedByTab,
|
||||
} from "@/components/util/input/verification-failed-flag";
|
||||
import type { VerificationResultLikeMap } from "@/components/util/input/verification-result-display";
|
||||
import { statisticsInputSewageExcretaSlurgeApi } from "@/entities/statistics/api/input/statistics-input-sewage-excreta-slurge-service";
|
||||
import { statisticsInputSewSupplyRateApi } from "@/entities/statistics/api/input/statistics-input-sew-supply-rate-service";
|
||||
import { statisticsApi } from "@/entities/statistics/api/statistics-service";
|
||||
@@ -177,10 +181,10 @@ function mapListToGridRows<T extends { verificationResult?: SewageExcretaSlurgeV
|
||||
});
|
||||
}
|
||||
|
||||
const SewageExcretaSlurgeInpTabList = [
|
||||
SlurgeProcessingFacStatusInpColumn,
|
||||
DigestorOperatingStatusInpColumn,
|
||||
SewageSlurgeProcessingFacStatusInpColumn,
|
||||
const SewageExcretaSlurgeInpTabList = [
|
||||
SlurgeProcessingFacStatusInpColumn,
|
||||
DigestorOperatingStatusInpColumn,
|
||||
SewageSlurgeProcessingFacStatusInpColumn,
|
||||
ExcretaSlurgeProcessingStatusInpColumn,
|
||||
] as const;
|
||||
|
||||
@@ -355,7 +359,7 @@ function computeTabToolbarSnapshot(
|
||||
const gugunOk = buildGugunOkForToolbar(searchContext);
|
||||
const enterable = computeTabEnterable(statusInfo, periodEnterable);
|
||||
const isSubmitted = statusInfo?.laeSbmsnSttsCd === "2";
|
||||
const showSaveInToolbar = (enterable || isAdminInfo) && gugunOk;
|
||||
const showSaveInToolbar = (enterable || isAdminInfo) && periodEnterable && gugunOk;
|
||||
const showEnterableToolbarButtons = enterable && gugunOk;
|
||||
const showSubmittedInInputPeriodToolbar =
|
||||
isSubmitted && periodEnterable && gugunOk;
|
||||
@@ -669,6 +673,9 @@ const SewageExcretaSlurgeInp = () => {
|
||||
const [isVerificationFailedByTab, setIsVerificationFailedByTab] = useState<
|
||||
Map<string, boolean>
|
||||
>(new Map());
|
||||
const [footerVerificationByTab, setFooterVerificationByTab] = useState<
|
||||
Map<string, VerificationResultLikeMap | null>
|
||||
>(new Map());
|
||||
const [_toolbarSnapshotByTab, setToolbarSnapshotByTab] = useState<
|
||||
Map<string, TabToolbarSnapshot>
|
||||
>(new Map());
|
||||
@@ -927,6 +934,9 @@ const SewageExcretaSlurgeInp = () => {
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
if (updateLastSearchedValues) setLastSearchedValues(searchContext);
|
||||
commitToolbarSnapshotForLoadedTab(
|
||||
tabKey,
|
||||
@@ -964,6 +974,9 @@ const SewageExcretaSlurgeInp = () => {
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
if (updateLastSearchedValues) setLastSearchedValues(searchContext);
|
||||
commitToolbarSnapshotForLoadedTab(
|
||||
tabKey,
|
||||
@@ -999,6 +1012,9 @@ const SewageExcretaSlurgeInp = () => {
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
if (updateLastSearchedValues) setLastSearchedValues(searchContext);
|
||||
commitToolbarSnapshotForLoadedTab(
|
||||
tabKey,
|
||||
@@ -1039,6 +1055,9 @@ const SewageExcretaSlurgeInp = () => {
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
if (updateLastSearchedValues) setLastSearchedValues(searchContext);
|
||||
commitToolbarSnapshotForLoadedTab(
|
||||
tabKey,
|
||||
@@ -1060,6 +1079,7 @@ const SewageExcretaSlurgeInp = () => {
|
||||
setTabStatusInfoMap(new Map());
|
||||
setTabStatsCdMap(new Map());
|
||||
setIsVerificationFailedByTab(new Map());
|
||||
setFooterVerificationByTab(new Map());
|
||||
setToolbarSnapshotByTab(new Map());
|
||||
setActiveTab(firstTabKey);
|
||||
activeTabRef.current = firstTabKey;
|
||||
@@ -1118,6 +1138,7 @@ const SewageExcretaSlurgeInp = () => {
|
||||
setTabStatusInfoMap(new Map());
|
||||
setTabStatsCdMap(new Map());
|
||||
setIsVerificationFailedByTab(new Map());
|
||||
setFooterVerificationByTab(new Map());
|
||||
setToolbarSnapshotByTab(new Map());
|
||||
loadedTabKeysRef.current.clear();
|
||||
setLoadedTabKeys(new Set());
|
||||
@@ -1876,10 +1897,10 @@ const SewageExcretaSlurgeInp = () => {
|
||||
for (const tab of SewageExcretaSlurgeInpTabList) {
|
||||
const tabKey = tab.tabKey;
|
||||
const canEdit =
|
||||
computeTabEnterable(
|
||||
(computeTabEnterable(
|
||||
tabStatusInfoMap.get(tabKey) ?? null,
|
||||
inputPeriodEnterable,
|
||||
) || isAdminInfo;
|
||||
) || isAdminInfo) && inputPeriodEnterable;
|
||||
const rawColumns = (tab.columns ?? []) as ColumnConfig[];
|
||||
const base = canEdit
|
||||
? rawColumns
|
||||
@@ -2050,8 +2071,8 @@ const SewageExcretaSlurgeInp = () => {
|
||||
onValuesChange={setSearchValues}
|
||||
/>
|
||||
{showActionToolbarCard && (
|
||||
<div className="card !py-0">
|
||||
<div className="flex justify-end items-center gap-[0.6rem] m-[0.6rem]">
|
||||
<div className="card !py-0">
|
||||
<div className="flex justify-end items-center gap-[0.6rem] m-[0.6rem]">
|
||||
<VerificationResultButton
|
||||
VerificationResultButtonFunc={openVerificationHistoryDialog}
|
||||
isVerificationFailed={
|
||||
@@ -2063,19 +2084,19 @@ const SewageExcretaSlurgeInp = () => {
|
||||
<LastYearDataButton
|
||||
getLastYearDataFunc={() => void lastYearDataFunc()}
|
||||
/>
|
||||
<SubmitButton submitFunc={submitFunc} />
|
||||
<SubmitButton submitFunc={submitFunc} />
|
||||
</>
|
||||
)}
|
||||
{activeTabStatus?.laeSbmsnSttsCd === "2" && (
|
||||
<CancelSubmitButton cnacelSubmitFunc={cnacelSubmitFunc} />
|
||||
)}
|
||||
{showSaveInToolbar && <SaveButton saveFunc={saveFunc} />}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{showSecondaryToolbarCard && (
|
||||
<div className="card !py-0">
|
||||
<div className="flex justify-end items-center gap-[0.6rem] m-[0.6rem]">
|
||||
<div className="card !py-0">
|
||||
<div className="flex justify-end items-center gap-[0.6rem] m-[0.6rem]">
|
||||
{showNotApplicableForActiveTab && (
|
||||
<NotApplicableCheckButton
|
||||
isCheck={isNotApplicableForActiveTab}
|
||||
@@ -2084,12 +2105,12 @@ const SewageExcretaSlurgeInp = () => {
|
||||
)}
|
||||
{showArticleEditButtons && (
|
||||
<>
|
||||
<AddArticleButton addArticleFunc={addArticleFunc} />
|
||||
<DeleteArticleButton deleteArticleFunc={deleteArticleFunc} />
|
||||
<AddArticleButton addArticleFunc={addArticleFunc} />
|
||||
<DeleteArticleButton deleteArticleFunc={deleteArticleFunc} />
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{isLoading && (
|
||||
<div className="absolute inset-0 z-50 [data-theme='black']:bg-transparent rounded-lg p-10 flex justify-center items-center">
|
||||
@@ -2154,6 +2175,9 @@ const SewageExcretaSlurgeInp = () => {
|
||||
activeTab === tabKey ? getGridRef : undefined
|
||||
}
|
||||
cellStyleCallback={resolveGridCellStyleCallback(tabKey)}
|
||||
footerVerificationResult={
|
||||
footerVerificationByTab.get(tabKey) ?? null
|
||||
}
|
||||
cellTooltipCallback={verificationCellTooltip}
|
||||
onCellEdited={
|
||||
tabKey === DigestorOperatingStatusInpColumn.tabKey
|
||||
|
||||
@@ -72,8 +72,10 @@ import { SewagePipeInpColumnInfoList } from "@/components/util/column/input/sewa
|
||||
import { toGridRows } from "@/components/util/grid/gridFunction";
|
||||
import { fetchColumnGuidesRecord } from "@/components/util/grid/columnGuides";
|
||||
import {
|
||||
patchFooterVerificationByTab,
|
||||
patchVerificationFailedByTab,
|
||||
} from "@/components/util/input/verification-failed-flag";
|
||||
import type { VerificationResultLikeMap } from "@/components/util/input/verification-result-display";
|
||||
import { useAdminStore } from "@/store/admin-store";
|
||||
import { useStatisticsInputFocusStore } from "@/store/statistics-input-focus-store";
|
||||
import { useTabStore } from "@/store/tab-store";
|
||||
@@ -215,6 +217,18 @@ const getManholeLastDataYear = () => {
|
||||
return Math.max(2014, lastDataYear);
|
||||
};
|
||||
|
||||
/** 2-3 관종별: verificationResult.prlgWhol → 총계 계(pipeByPrstWhol) */
|
||||
function remapPipeTypePrlgWholVerification(
|
||||
result?: SeweragePipeInputVerificationResult | null,
|
||||
): SeweragePipeInputVerificationResult | null | undefined {
|
||||
if (!result) return result;
|
||||
const fromAlias = result.prlgWhol;
|
||||
if (!Array.isArray(fromAlias) || fromAlias.length === 0) return result;
|
||||
const existing = result.pipeByPrstWhol;
|
||||
if (Array.isArray(existing) && existing.length > 0) return result;
|
||||
return { ...result, pipeByPrstWhol: fromAlias };
|
||||
}
|
||||
|
||||
/** 관종별 신 응답(yearlyStatList) -> 그리드 y{year}* 필드로 정규화 */
|
||||
function normalizePipeTypeStatusRow(
|
||||
row: SeweragePipeInputPipeTypeStatusItem,
|
||||
@@ -225,6 +239,7 @@ function normalizePipeTypeStatusRow(
|
||||
yearlyStatList,
|
||||
lyngPrlgWhol,
|
||||
dmltnPrlgWhol,
|
||||
verificationResult,
|
||||
...rest
|
||||
} = row;
|
||||
const yearFields: Record<string, number> = {};
|
||||
@@ -252,6 +267,7 @@ function normalizePipeTypeStatusRow(
|
||||
lyngPrlg: Number(row.lyngPrlg ?? lyngPrlgWhol ?? 0),
|
||||
dmltnPrlg: Number(row.dmltnPrlg ?? dmltnPrlgWhol ?? 0),
|
||||
...yearFields,
|
||||
verificationResult: remapPipeTypePrlgWholVerification(verificationResult) ?? undefined,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -435,7 +451,7 @@ function computeTabToolbarSnapshot(
|
||||
const gugunOk = buildGugunOkForToolbar(searchContext);
|
||||
const enterable = computeTabEnterable(statusInfo, periodEnterable);
|
||||
const isSubmitted = statusInfo?.laeSbmsnSttsCd === "2";
|
||||
const showSaveInToolbar = (enterable || isAdminInfo) && gugunOk;
|
||||
const showSaveInToolbar = (enterable || isAdminInfo) && periodEnterable && gugunOk;
|
||||
const showEnterableToolbarButtons = enterable && gugunOk;
|
||||
const showSubmittedInInputPeriodToolbar = isSubmitted && periodEnterable && gugunOk;
|
||||
const showActionToolbarCard =
|
||||
@@ -465,6 +481,9 @@ const SewagePipeInp = () => {
|
||||
const [isVerificationFailedByTab, setIsVerificationFailedByTab] = useState<
|
||||
Map<string, boolean>
|
||||
>(new Map());
|
||||
const [footerVerificationByTab, setFooterVerificationByTab] = useState<
|
||||
Map<string, VerificationResultLikeMap | null>
|
||||
>(new Map());
|
||||
const [verificationHistoryOpen, setVerificationHistoryOpen] = useState(false);
|
||||
const [periodCheckList, setPeriodCheckList] = useState<CheckInputPeriodItem[]>([]);
|
||||
/** 탭키별 `engColNm -> columnGuide` 캐시 */
|
||||
@@ -566,6 +585,7 @@ const SewagePipeInp = () => {
|
||||
setTabStatusInfoMap(new Map());
|
||||
setTabStatsCdMap(new Map());
|
||||
setIsVerificationFailedByTab(new Map());
|
||||
setFooterVerificationByTab(new Map());
|
||||
setLastSearchedYear(null);
|
||||
setLastSearchedValues(null);
|
||||
setHasSearched(false);
|
||||
@@ -594,7 +614,7 @@ const SewagePipeInp = () => {
|
||||
});
|
||||
return SewagePipeInpColumnInfoList.map((tab: ColumnInfoList) => {
|
||||
const canEdit =
|
||||
computeTabEnterable(tabStatusInfoMap.get(tab.tabKey) ?? null, inputPeriodEnterable) || isAdminInfo;
|
||||
(computeTabEnterable(tabStatusInfoMap.get(tab.tabKey) ?? null, inputPeriodEnterable) || isAdminInfo) && inputPeriodEnterable;
|
||||
const applyEditable = (cols: ColumnConfig[] | undefined) =>
|
||||
tab.tabKey === PIPE_TYPE_STATUS_TAB_KEY
|
||||
? applyPipeTypeStatusEditableColumns(
|
||||
@@ -703,6 +723,9 @@ const SewagePipeInp = () => {
|
||||
setTabStatsCdMap((prev) => new Map(prev).set(tabKey, commonInfo.statsCd));
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
syncTopStatusIfStillOnTab(tabKey, commonInfo.statsCd);
|
||||
if (updateLastSearchedValues) setLastSearchedValues(values);
|
||||
@@ -747,6 +770,9 @@ const SewagePipeInp = () => {
|
||||
setTabStatsCdMap((prev) => new Map(prev).set(tabKey, commonInfo.statsCd));
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
syncTopStatusIfStillOnTab(tabKey, commonInfo.statsCd);
|
||||
if (updateLastSearchedValues) setLastSearchedValues(values);
|
||||
@@ -773,6 +799,13 @@ const SewagePipeInp = () => {
|
||||
setTabStatsCdMap((prev) => new Map(prev).set(tabKey, commonInfo.statsCd));
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, {
|
||||
verificationResult:
|
||||
remapPipeTypePrlgWholVerification(commonInfo.verificationResult) ??
|
||||
null,
|
||||
}),
|
||||
);
|
||||
syncTopStatusIfStillOnTab(tabKey, commonInfo.statsCd);
|
||||
if (updateLastSearchedValues) setLastSearchedValues(values);
|
||||
@@ -800,6 +833,9 @@ const SewagePipeInp = () => {
|
||||
setTabStatsCdMap((prev) => new Map(prev).set(tabKey, commonInfo.statsCd));
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
syncTopStatusIfStillOnTab(tabKey, commonInfo.statsCd);
|
||||
if (updateLastSearchedValues) setLastSearchedValues(values);
|
||||
@@ -826,6 +862,9 @@ const SewagePipeInp = () => {
|
||||
setTabStatsCdMap((prev) => new Map(prev).set(tabKey, commonInfo.statsCd));
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
syncTopStatusIfStillOnTab(tabKey, commonInfo.statsCd);
|
||||
if (updateLastSearchedValues) setLastSearchedValues(values);
|
||||
@@ -859,6 +898,9 @@ const SewagePipeInp = () => {
|
||||
setTabStatsCdMap((prev) => new Map(prev).set(tabKey, commonInfo.statsCd));
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
syncTopStatusIfStillOnTab(tabKey, commonInfo.statsCd);
|
||||
if (updateLastSearchedValues) setLastSearchedValues(values);
|
||||
@@ -912,6 +954,7 @@ const SewagePipeInp = () => {
|
||||
setTabStatusInfoMap(new Map());
|
||||
setTabStatsCdMap(new Map());
|
||||
setIsVerificationFailedByTab(new Map());
|
||||
setFooterVerificationByTab(new Map());
|
||||
setStatsCd("");
|
||||
setToolbarSnapshotByTab(new Map());
|
||||
}
|
||||
@@ -2193,7 +2236,9 @@ const SewagePipeInp = () => {
|
||||
}}
|
||||
isExcelImport={excelToolbarEnabledForTab}
|
||||
excelImportSkipNonEditable={
|
||||
tabKey === PIPE_TYPE_STATUS_TAB_KEY ? !isAdminInfo : true
|
||||
tabKey === PIPE_TYPE_STATUS_TAB_KEY
|
||||
? !isAdminInfo
|
||||
: false
|
||||
}
|
||||
excelImportSewerBzmnCd={(lastSearchedValues ?? searchValues)?.bsnmCd}
|
||||
excelExportSearchContext={toExcelExportSearchContextFromSearchForm(lastSearchedValues ?? searchValues)}
|
||||
@@ -2224,6 +2269,9 @@ const SewagePipeInp = () => {
|
||||
return hasImr ? "rg-cell-verify-error-imr" : "rg-cell-verify-error";
|
||||
}
|
||||
}}
|
||||
footerVerificationResult={
|
||||
footerVerificationByTab.get(tabKey) ?? null
|
||||
}
|
||||
cellTooltipCallback={({ row, fieldName }) => {
|
||||
const verification = (row as GridRowWithVerification).verificationResult;
|
||||
if (!verification) return;
|
||||
|
||||
@@ -58,7 +58,11 @@ import { PipeDredgingStatusInpColumn } from "@/components/util/column/input/sewa
|
||||
import { RepairStatusInpColumn } from "@/components/util/column/input/sewagePipeMaintain/RepairStatusInpColumn";
|
||||
import { toGridRows } from "@/components/util/grid/gridFunction";
|
||||
import { fetchColumnGuidesRecord } from "@/components/util/grid/columnGuides";
|
||||
import { patchVerificationFailedByTab } from "@/components/util/input/verification-failed-flag";
|
||||
import {
|
||||
patchFooterVerificationByTab,
|
||||
patchVerificationFailedByTab,
|
||||
} from "@/components/util/input/verification-failed-flag";
|
||||
import type { VerificationResultLikeMap } from "@/components/util/input/verification-result-display";
|
||||
import { useAdminStore } from "@/store/admin-store";
|
||||
import { useStatisticsInputFocusStore } from "@/store/statistics-input-focus-store";
|
||||
import { useTabStore } from "@/store/tab-store";
|
||||
@@ -128,7 +132,7 @@ function computeTabToolbarSnapshot(
|
||||
const gugunOk = buildGugunOkForToolbar(searchContext);
|
||||
const enterable = computeTabEnterable(statusInfo, periodEnterable);
|
||||
const isSubmitted = statusInfo?.laeSbmsnSttsCd === "2";
|
||||
const showSaveInToolbar = (enterable || isAdminInfo) && gugunOk;
|
||||
const showSaveInToolbar = (enterable || isAdminInfo) && periodEnterable && gugunOk;
|
||||
const showEnterableToolbarButtons = enterable && gugunOk;
|
||||
const showSubmittedInInputPeriodToolbar =
|
||||
isSubmitted && periodEnterable && gugunOk;
|
||||
@@ -291,6 +295,9 @@ const SewagePipeMaintainInp = () => {
|
||||
const [isVerificationFailedByTab, setIsVerificationFailedByTab] = useState<
|
||||
Map<string, boolean>
|
||||
>(new Map());
|
||||
const [footerVerificationByTab, setFooterVerificationByTab] = useState<
|
||||
Map<string, VerificationResultLikeMap | null>
|
||||
>(new Map());
|
||||
const [toolbarSnapshotByTab, setToolbarSnapshotByTab] = useState<
|
||||
Map<string, TabToolbarSnapshot>
|
||||
>(new Map());
|
||||
@@ -435,6 +442,9 @@ const SewagePipeMaintainInp = () => {
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
if (updateLastSearchedValues) {
|
||||
setLastSearchedValues(searchContext);
|
||||
}
|
||||
@@ -471,6 +481,9 @@ const SewagePipeMaintainInp = () => {
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
if (updateLastSearchedValues) {
|
||||
setLastSearchedValues(searchContext);
|
||||
}
|
||||
@@ -866,6 +879,7 @@ const SewagePipeMaintainInp = () => {
|
||||
setTabStatusInfoMap(new Map());
|
||||
setTabStatsCdMap(new Map());
|
||||
setIsVerificationFailedByTab(new Map());
|
||||
setFooterVerificationByTab(new Map());
|
||||
setToolbarSnapshotByTab(new Map());
|
||||
setActiveTab(firstTabKey);
|
||||
setLastSearchedValues(null);
|
||||
@@ -911,6 +925,7 @@ const SewagePipeMaintainInp = () => {
|
||||
setTabStatusInfoMap(new Map());
|
||||
setTabStatsCdMap(new Map());
|
||||
setIsVerificationFailedByTab(new Map());
|
||||
setFooterVerificationByTab(new Map());
|
||||
setToolbarSnapshotByTab(new Map());
|
||||
activeTabRef.current = firstTabKey;
|
||||
setActiveTab(firstTabKey);
|
||||
@@ -986,10 +1001,10 @@ const SewagePipeMaintainInp = () => {
|
||||
for (const tab of SewagePipeMaintainInpTabList) {
|
||||
const tabKey = tab.tabKey;
|
||||
const canEdit =
|
||||
computeTabEnterable(
|
||||
(computeTabEnterable(
|
||||
tabStatusInfoMap.get(tabKey) ?? null,
|
||||
inputPeriodEnterable,
|
||||
) || isAdminInfo;
|
||||
) || isAdminInfo) && inputPeriodEnterable;
|
||||
const rawColumns = tab.columns ?? [];
|
||||
const base = canEdit
|
||||
? rawColumns
|
||||
@@ -1152,10 +1167,10 @@ const SewagePipeMaintainInp = () => {
|
||||
const tabKey = info.tabKey;
|
||||
const rowData = rowDataMap.get(tabKey) ?? [];
|
||||
const tabEnterableForGrid =
|
||||
computeTabEnterable(
|
||||
(computeTabEnterable(
|
||||
tabStatusInfoMap.get(tabKey) ?? null,
|
||||
inputPeriodEnterable,
|
||||
) || isAdminInfo;
|
||||
) || isAdminInfo) && inputPeriodEnterable;
|
||||
const gugunOk = buildGugunOkForToolbar(lastSearchedValues);
|
||||
const tabStatusInfo = tabStatusInfoMap.get(tabKey) ?? null;
|
||||
|
||||
@@ -1168,6 +1183,7 @@ const SewagePipeMaintainInp = () => {
|
||||
toGridColumnInfo(info)
|
||||
}
|
||||
excelExportFileSuffix={info.tabLabel || tabKey}
|
||||
fixedColumns={info.fixedColumns}
|
||||
rowData={rowData}
|
||||
setRowData={(updater) => {
|
||||
setRowDataMap((prev) => {
|
||||
@@ -1192,6 +1208,9 @@ const SewagePipeMaintainInp = () => {
|
||||
excelImportSewerBzmnCd={(lastSearchedValues ?? searchValues)?.bsnmCd}
|
||||
excelExportSearchContext={toExcelExportSearchContextFromSearchForm(lastSearchedValues ?? searchValues)}
|
||||
cellStyleCallback={verificationCellStyle}
|
||||
footerVerificationResult={
|
||||
footerVerificationByTab.get(tabKey) ?? null
|
||||
}
|
||||
cellTooltipCallback={verificationCellTooltip}
|
||||
getGridDataRef={
|
||||
activeTab === tabKey ? getGridDataRef : undefined
|
||||
|
||||
@@ -45,7 +45,11 @@ import { SewageReservoirInpColumn } from "@/components/util/column/input/sewageR
|
||||
import { toGridRows } from "@/components/util/grid/gridFunction";
|
||||
import { fetchColumnGuidesRecord } from "@/components/util/grid/columnGuides";
|
||||
import { useTabStore } from "@/store/tab-store";
|
||||
import { patchVerificationFailedByTab } from "@/components/util/input/verification-failed-flag";
|
||||
import {
|
||||
patchFooterVerificationByTab,
|
||||
patchVerificationFailedByTab,
|
||||
} from "@/components/util/input/verification-failed-flag";
|
||||
import type { VerificationResultLikeMap } from "@/components/util/input/verification-result-display";
|
||||
import {
|
||||
formatCompactYmdForGrid,
|
||||
normalizeOxYnValue,
|
||||
@@ -138,7 +142,7 @@ function computeTabToolbarSnapshot(
|
||||
const gugunOk = buildGugunOkForToolbar(searchContext);
|
||||
const enterable = computeTabEnterable(statusInfo, periodEnterable);
|
||||
const isSubmitted = statusInfo?.laeSbmsnSttsCd === "2";
|
||||
const showSaveInToolbar = (enterable || isAdminInfo) && gugunOk;
|
||||
const showSaveInToolbar = (enterable || isAdminInfo) && periodEnterable && gugunOk;
|
||||
const showEnterableToolbarButtons = enterable && gugunOk;
|
||||
const showSubmittedInInputPeriodToolbar =
|
||||
isSubmitted && periodEnterable && gugunOk;
|
||||
@@ -937,6 +941,9 @@ const SewageReservoirPumpInp = () => {
|
||||
const [isVerificationFailedByTab, setIsVerificationFailedByTab] = useState<
|
||||
Map<string, boolean>
|
||||
>(new Map());
|
||||
const [footerVerificationByTab, setFooterVerificationByTab] = useState<
|
||||
Map<string, VerificationResultLikeMap | null>
|
||||
>(new Map());
|
||||
const [verificationHistoryOpen, setVerificationHistoryOpen] = useState(false);
|
||||
const [verificationResultDialogOpen, setVerificationResultDialogOpen] =
|
||||
useState(false);
|
||||
@@ -1079,6 +1086,9 @@ const SewageReservoirPumpInp = () => {
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
if (updateLastSearchedValues) {
|
||||
setLastSearchedValues(values);
|
||||
}
|
||||
@@ -1124,6 +1134,9 @@ const SewageReservoirPumpInp = () => {
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
if (updateLastSearchedValues) {
|
||||
setLastSearchedValues(values);
|
||||
}
|
||||
@@ -1191,6 +1204,7 @@ const SewageReservoirPumpInp = () => {
|
||||
setTabStatusInfoMap(new Map());
|
||||
setTabStatsCdMap(new Map());
|
||||
setIsVerificationFailedByTab(new Map());
|
||||
setFooterVerificationByTab(new Map());
|
||||
setToolbarSnapshotByTab(new Map());
|
||||
setLastSearchedValues(null);
|
||||
setSggOptions([]);
|
||||
@@ -1241,6 +1255,7 @@ const SewageReservoirPumpInp = () => {
|
||||
setTabStatusInfoMap(new Map());
|
||||
setTabStatsCdMap(new Map());
|
||||
setIsVerificationFailedByTab(new Map());
|
||||
setFooterVerificationByTab(new Map());
|
||||
setToolbarSnapshotByTab(new Map());
|
||||
loadedTabKeysRef.current.clear();
|
||||
setActiveTab(firstTabKey);
|
||||
@@ -1428,10 +1443,10 @@ const SewageReservoirPumpInp = () => {
|
||||
for (const tab of SewageReservoirPumpInpTabList) {
|
||||
const tabKey = tab.tabKey ?? "";
|
||||
const canEdit =
|
||||
computeTabEnterable(
|
||||
(computeTabEnterable(
|
||||
tabStatusInfoMap.get(tabKey) ?? null,
|
||||
inputPeriodEnterable,
|
||||
) || isAdminInfo;
|
||||
) || isAdminInfo) && inputPeriodEnterable;
|
||||
const isReservoirTab = tabKey === SEWAGE_RESERVOIR_STATS_CD;
|
||||
const isRainfallPumpTab = tabKey === rainfallPumpTabKey;
|
||||
const rawColumns = tab.columns ?? [];
|
||||
@@ -1596,10 +1611,10 @@ const SewageReservoirPumpInp = () => {
|
||||
{SewageReservoirPumpInpTabList.map((tab) => {
|
||||
const tabKey = tab.tabKey ?? "";
|
||||
const tabEnterableForGrid =
|
||||
computeTabEnterable(
|
||||
(computeTabEnterable(
|
||||
tabStatusInfoMap.get(tabKey) ?? null,
|
||||
inputPeriodEnterable,
|
||||
) || isAdminInfo;
|
||||
) || isAdminInfo) && inputPeriodEnterable;
|
||||
const gugunOk = buildGugunOkForToolbar(lastSearchedValues);
|
||||
const tabStatusInfo = tabStatusInfoMap.get(tabKey) ?? null;
|
||||
const isReservoirTab = tabKey === SEWAGE_RESERVOIR_STATS_CD;
|
||||
@@ -1658,6 +1673,9 @@ const SewageReservoirPumpInp = () => {
|
||||
excelImportSewerBzmnCd={(lastSearchedValues ?? searchValues)?.bsnmCd}
|
||||
excelExportSearchContext={toExcelExportSearchContextFromSearchForm(lastSearchedValues ?? searchValues)}
|
||||
cellStyleCallback={verificationCellStyle}
|
||||
footerVerificationResult={
|
||||
footerVerificationByTab.get(tabKey) ?? null
|
||||
}
|
||||
cellTooltipCallback={verificationCellTooltip}
|
||||
/>
|
||||
</TabsContent>
|
||||
|
||||
@@ -63,7 +63,11 @@ import { SewerageUsageFeeInpColumn } from "@/components/util/column/input/sewera
|
||||
import { toGridRows } from "@/components/util/grid/gridFunction";
|
||||
import { fetchColumnGuidesRecord } from "@/components/util/grid/columnGuides";
|
||||
import { useTabStore } from "@/store/tab-store";
|
||||
import { patchVerificationFailedByTab } from "@/components/util/input/verification-failed-flag";
|
||||
import {
|
||||
patchFooterVerificationByTab,
|
||||
patchVerificationFailedByTab,
|
||||
} from "@/components/util/input/verification-failed-flag";
|
||||
import type { VerificationResultLikeMap } from "@/components/util/input/verification-result-display";
|
||||
import { useAdminStore } from "@/store/admin-store";
|
||||
|
||||
const SewerageFinanceInpTabList = [
|
||||
@@ -133,7 +137,7 @@ function computeTabToolbarSnapshot(
|
||||
const gugunOk = buildGugunOkForToolbar(searchContext);
|
||||
const enterable = computeTabEnterable(statusInfo, periodEnterable);
|
||||
const isSubmitted = statusInfo?.laeSbmsnSttsCd === "2";
|
||||
const showSaveInToolbar = (enterable || isAdminInfo) && gugunOk;
|
||||
const showSaveInToolbar = (enterable || isAdminInfo) && periodEnterable && gugunOk;
|
||||
const showEnterableToolbarButtons = enterable && gugunOk;
|
||||
const showSubmittedInInputPeriodToolbar = isSubmitted && periodEnterable && gugunOk;
|
||||
const showActionToolbarCard =
|
||||
@@ -372,6 +376,9 @@ const SewerageFinanceInp = () => {
|
||||
const [isVerificationFailedByTab, setIsVerificationFailedByTab] = useState<
|
||||
Map<string, boolean>
|
||||
>(new Map());
|
||||
const [footerVerificationByTab, setFooterVerificationByTab] = useState<
|
||||
Map<string, VerificationResultLikeMap | null>
|
||||
>(new Map());
|
||||
const [toolbarSnapshotByTab, setToolbarSnapshotByTab] = useState<
|
||||
Map<string, TabToolbarSnapshot>
|
||||
>(new Map());
|
||||
@@ -484,6 +491,9 @@ const SewerageFinanceInp = () => {
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
if (updateLastSearchedValues) setLastSearchedValues(searchContext);
|
||||
commitToolbarSnapshotForLoadedTab(tabKey, statusInfo, gridRows.length > 0, searchContext);
|
||||
return true;
|
||||
@@ -510,6 +520,9 @@ const SewerageFinanceInp = () => {
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
if (updateLastSearchedValues) setLastSearchedValues(searchContext);
|
||||
commitToolbarSnapshotForLoadedTab(tabKey, statusInfo, gridRows.length > 0, searchContext);
|
||||
return true;
|
||||
@@ -536,6 +549,9 @@ const SewerageFinanceInp = () => {
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
if (updateLastSearchedValues) setLastSearchedValues(searchContext);
|
||||
commitToolbarSnapshotForLoadedTab(tabKey, statusInfo, gridRows.length > 0, searchContext);
|
||||
return true;
|
||||
@@ -562,6 +578,9 @@ const SewerageFinanceInp = () => {
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
if (updateLastSearchedValues) setLastSearchedValues(searchContext);
|
||||
commitToolbarSnapshotForLoadedTab(tabKey, statusInfo, gridRows.length > 0, searchContext);
|
||||
return true;
|
||||
@@ -579,6 +598,7 @@ const SewerageFinanceInp = () => {
|
||||
setTabStatusInfoMap(new Map());
|
||||
setTabStatsCdMap(new Map());
|
||||
setIsVerificationFailedByTab(new Map());
|
||||
setFooterVerificationByTab(new Map());
|
||||
setToolbarSnapshotByTab(new Map());
|
||||
setActiveTab(firstTabKey);
|
||||
activeTabRef.current = firstTabKey;
|
||||
@@ -621,6 +641,7 @@ const SewerageFinanceInp = () => {
|
||||
setTabStatusInfoMap(new Map());
|
||||
setTabStatsCdMap(new Map());
|
||||
setIsVerificationFailedByTab(new Map());
|
||||
setFooterVerificationByTab(new Map());
|
||||
setToolbarSnapshotByTab(new Map());
|
||||
activeTabRef.current = firstTabKey;
|
||||
setActiveTab(firstTabKey);
|
||||
@@ -1139,10 +1160,10 @@ const SewerageFinanceInp = () => {
|
||||
for (const tab of SewerageFinanceInpTabList) {
|
||||
const tabKey = tab.tabKey;
|
||||
const canEdit =
|
||||
computeTabEnterable(
|
||||
(computeTabEnterable(
|
||||
tabStatusInfoMap.get(tabKey) ?? null,
|
||||
inputPeriodEnterable,
|
||||
) || isAdminInfo;
|
||||
) || isAdminInfo) && inputPeriodEnterable;
|
||||
const rawColumns = (tab.columns ?? []) as ColumnConfig[];
|
||||
const base = canEdit
|
||||
? rawColumns
|
||||
@@ -1237,8 +1258,8 @@ const SewerageFinanceInp = () => {
|
||||
onValuesChange={setSearchValues}
|
||||
/>
|
||||
{showActionToolbarCard && (
|
||||
<div className="card !py-0">
|
||||
<div className="flex justify-end items-center gap-[0.6rem] m-[0.6rem]">
|
||||
<div className="card !py-0">
|
||||
<div className="flex justify-end items-center gap-[0.6rem] m-[0.6rem]">
|
||||
<VerificationResultButton
|
||||
VerificationResultButtonFunc={openVerificationHistoryDialog}
|
||||
isVerificationFailed={
|
||||
@@ -1250,7 +1271,7 @@ const SewerageFinanceInp = () => {
|
||||
<LastYearDataButton
|
||||
getLastYearDataFunc={() => void lastYearDataFunc()}
|
||||
/>
|
||||
<SubmitButton submitFunc={submitFunc} />
|
||||
<SubmitButton submitFunc={submitFunc} />
|
||||
</>
|
||||
)}
|
||||
{activeTabStatus?.laeSbmsnSttsCd === "2" && (
|
||||
@@ -1285,10 +1306,10 @@ const SewerageFinanceInp = () => {
|
||||
const tabKey = info.tabKey;
|
||||
const rowData = rowDataMap.get(tabKey) ?? [];
|
||||
const tabEnterableForGrid =
|
||||
computeTabEnterable(
|
||||
(computeTabEnterable(
|
||||
tabStatusInfoMap.get(tabKey) ?? null,
|
||||
inputPeriodEnterable,
|
||||
) || isAdminInfo;
|
||||
) || isAdminInfo) && inputPeriodEnterable;
|
||||
const gugunOk = buildGugunOkForToolbar(lastSearchedValues);
|
||||
const tabStatusInfo = tabStatusInfoMap.get(tabKey) ?? null;
|
||||
|
||||
@@ -1327,6 +1348,9 @@ const SewerageFinanceInp = () => {
|
||||
excelExportSearchContext={toExcelExportSearchContextFromSearchForm(lastSearchedValues ?? searchValues)}
|
||||
isExcelExport
|
||||
cellStyleCallback={verificationCellStyle}
|
||||
footerVerificationResult={
|
||||
footerVerificationByTab.get(tabKey) ?? null
|
||||
}
|
||||
cellTooltipCallback={verificationCellTooltip}
|
||||
getGridDataRef={
|
||||
activeTab === tabKey ? getGridDataRef : undefined
|
||||
|
||||
@@ -51,6 +51,7 @@ import { SeweragePenetrationRateInpColumn } from "@/components/util/column/input
|
||||
import { getFooterSummary } from "@/components/util/grid/footerSummary";
|
||||
import { toGridRows } from "@/components/util/grid/gridFunction";
|
||||
import { isVerificationFailedFromCommonInfo } from "@/components/util/input/verification-failed-flag";
|
||||
import type { VerificationResultLikeMap } from "@/components/util/input/verification-result-display";
|
||||
import { useAdminStore } from "@/store/admin-store";
|
||||
import { useStatisticsInputFocusStore } from "@/store/statistics-input-focus-store";
|
||||
import { useTabStore } from "@/store/tab-store";
|
||||
@@ -60,6 +61,28 @@ type GridRowWithVerification = Record<string, string | number> & {
|
||||
verificationResult?: SewerageSupplyRateVerificationResult;
|
||||
};
|
||||
|
||||
/** commonInfo 푸터 필드명 → 그리드 fieldName */
|
||||
const FOOTER_VERIFY_FIELD_ALIASES: Record<string, string> = {
|
||||
sewerBzmnWholPpltnCnt: "pbadmsWholPpltnCnt",
|
||||
sewerBzmnDomplWholPpltnCnt: "domplWholPpltnCnt",
|
||||
sewerBzmnFrgnrWholPpltnCnt: "frgnrWholPpltnCnt",
|
||||
sewerBzmnArea: "refArea",
|
||||
};
|
||||
|
||||
const remapCommonInfoVerificationToGridFields = (
|
||||
result: SewerageSupplyRateVerificationResult | null | undefined,
|
||||
): VerificationResultLikeMap | null => {
|
||||
if (!result) return null;
|
||||
const remapped: VerificationResultLikeMap = {};
|
||||
for (const [key, errors] of Object.entries(result)) {
|
||||
const gridField = FOOTER_VERIFY_FIELD_ALIASES[key] ?? key;
|
||||
remapped[gridField] = errors;
|
||||
// API 키로도 조회 가능하도록 유지
|
||||
if (gridField !== key) remapped[key] = errors;
|
||||
}
|
||||
return remapped;
|
||||
};
|
||||
|
||||
/** 컬럼 가이드 API 조회용 통계코드 (하수도 보급률) */
|
||||
const SEWERAGE_PENETRATION_COLUMN_GUIDE_STATS_CD = "ST00010001";
|
||||
|
||||
@@ -137,6 +160,8 @@ const SeweragePenetrationRateInp = () => {
|
||||
/** `engColNm` → `columnGuide` (헤더 hover) */
|
||||
const [columnGuidesByEngCol, setColumnGuidesByEngCol] = useState<Record<string, string>>({});
|
||||
const [footerFromApi, setFooterFromApi] = useState<{ sewerBzmnWholPpltnCnt?: number; sewerBzmnDomplWholPpltnCnt?: number; sewerBzmnFrgnrWholPpltnCnt?: number; sewerBzmnArea?: number } | null>(null);
|
||||
const [footerVerificationResult, setFooterVerificationResult] =
|
||||
useState<VerificationResultLikeMap | null>(null);
|
||||
const { confirm } = useConfirm();
|
||||
const showGlobalProgress = useGlobalProgressStore((state) => state.show);
|
||||
const setGlobalProgress = useGlobalProgressStore((state) => state.setProgress);
|
||||
@@ -208,11 +233,14 @@ const SeweragePenetrationRateInp = () => {
|
||||
(footerFromApi && footerFromApi[fieldName] != null ? footerFromApi[fieldName] : null) ?? getFooterSummary(grid, column),
|
||||
});
|
||||
|
||||
// 최상위 관리자일땐 모든 상황에서 edit 가능하게 수정 필요.
|
||||
|
||||
// 관리자는 제출/승인 상태에서도 편집 가능. 단, 입력기간 외에는 불가.
|
||||
const columnInfo = useMemo(() => {
|
||||
const { columns, columnLayout } = SeweragePenetrationRateInpColumn;
|
||||
const base = (isEnterable || isAdminInfo) ? columns : columns.map((col) => ({ ...col, editable: false as const }));
|
||||
const canEdit =
|
||||
(isEnterable || isAdminInfo) && isInputPeriodCurrent(periodCheckList);
|
||||
const base = canEdit
|
||||
? columns
|
||||
: columns.map((col) => ({ ...col, editable: false as const }));
|
||||
|
||||
const withHeaderTooltips = base.map((col) => {
|
||||
const guide = columnGuidesByEngCol[col.fieldName]?.trim();
|
||||
@@ -233,7 +261,7 @@ const SeweragePenetrationRateInp = () => {
|
||||
return col;
|
||||
}),
|
||||
};
|
||||
}, [isEnterable, isAdminInfo, footerFromApi, columnGuidesByEngCol]);
|
||||
}, [isEnterable, isAdminInfo, periodCheckList, footerFromApi, columnGuidesByEngCol]);
|
||||
|
||||
const handleReset = () => {
|
||||
setRowData([]);
|
||||
@@ -242,6 +270,7 @@ const SeweragePenetrationRateInp = () => {
|
||||
setLastSearchedYear(null);
|
||||
setLastSearchedValues(null);
|
||||
setFooterFromApi(null);
|
||||
setFooterVerificationResult(null);
|
||||
setVerificationSearchDefaults(null);
|
||||
setIsVerificationFailed(false);
|
||||
setSearchFormRemountKey((k) => k + 1);
|
||||
@@ -278,6 +307,11 @@ const SeweragePenetrationRateInp = () => {
|
||||
}
|
||||
: null
|
||||
);
|
||||
setFooterVerificationResult(
|
||||
remapCommonInfoVerificationToGridFields(
|
||||
commonInfo.verificationResult,
|
||||
),
|
||||
);
|
||||
setStatsCd(commonInfo.statsCd);
|
||||
setIsVerificationFailed(isVerificationFailedFromCommonInfo(commonInfo));
|
||||
if (statusInfo && statusInfo.laeSbmsnSttsCd) {
|
||||
@@ -299,6 +333,7 @@ const SeweragePenetrationRateInp = () => {
|
||||
setRowData([]);
|
||||
setStatusInfo(null);
|
||||
setFooterFromApi(null);
|
||||
setFooterVerificationResult(null);
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
@@ -755,7 +790,8 @@ const SeweragePenetrationRateInp = () => {
|
||||
|
||||
const inputPeriodCurrent = isInputPeriodCurrent(periodCheckList);
|
||||
const isSubmitted = statusInfo?.laeSbmsnSttsCd === '2';
|
||||
const baseShowSaveInToolbar = (isEnterable || isAdminInfo) && gugunOkOrNotDoList;
|
||||
const baseShowSaveInToolbar =
|
||||
(isEnterable || isAdminInfo) && inputPeriodCurrent && gugunOkOrNotDoList;
|
||||
const baseShowEnterableToolbarButtons = isEnterable && gugunOkOrNotDoList;
|
||||
const showSubmittedInInputPeriodToolbar =
|
||||
isSubmitted && inputPeriodCurrent && gugunOkOrNotDoList;
|
||||
@@ -805,7 +841,7 @@ const SeweragePenetrationRateInp = () => {
|
||||
</div>
|
||||
}
|
||||
<DataGrid
|
||||
key={(isEnterable || isAdminInfo) ? 'enterable' : 'readonly'}
|
||||
key={((isEnterable || isAdminInfo) && inputPeriodCurrent) ? 'enterable' : 'readonly'}
|
||||
columnInfo={columnInfo}
|
||||
isExcelImport={(rowData.length > 0) && isEnterable && (doList.includes(lastSearchedValues?.bsnmCd || '') ? Boolean(lastSearchedValues?.gugun && lastSearchedValues.gugun !== 'ALL') : true)}
|
||||
excelImportSewerBzmnCd={(lastSearchedValues ?? searchValues)?.bsnmCd}
|
||||
@@ -826,6 +862,7 @@ const SeweragePenetrationRateInp = () => {
|
||||
return hasImr ? 'rg-cell-verify-error-imr' : 'rg-cell-verify-error';
|
||||
}
|
||||
}}
|
||||
footerVerificationResult={footerVerificationResult}
|
||||
cellTooltipCallback={({ row, fieldName }) => {
|
||||
const verification = (row as GridRowWithVerification).verificationResult;
|
||||
if (!verification) return;
|
||||
|
||||
@@ -26,7 +26,11 @@ import { ResidentFriendlyFactInpColumn } from "@/components/util/column/input/se
|
||||
import { toGridRows } from "@/components/util/grid/gridFunction";
|
||||
import { fetchColumnGuidesRecord } from "@/components/util/grid/columnGuides";
|
||||
import { useTabStore } from "@/store/tab-store";
|
||||
import { patchVerificationFailedByTab } from "@/components/util/input/verification-failed-flag";
|
||||
import {
|
||||
patchFooterVerificationByTab,
|
||||
patchVerificationFailedByTab,
|
||||
} from "@/components/util/input/verification-failed-flag";
|
||||
import type { VerificationResultLikeMap } from "@/components/util/input/verification-result-display";
|
||||
import { statisticsInputSewerageServiceLevelApi } from "@/entities/statistics/api/input/statistics-input-sewerage-service-level-service";
|
||||
import { statisticsInputSewSupplyRateApi } from "@/entities/statistics/api/input/statistics-input-sew-supply-rate-service";
|
||||
import { statisticsApi } from "@/entities/statistics/api/statistics-service";
|
||||
@@ -132,7 +136,7 @@ function computeTabToolbarSnapshot(
|
||||
const gugunOk = buildGugunOkForToolbar(searchContext);
|
||||
const enterable = computeTabEnterable(statusInfo, periodEnterable);
|
||||
const isSubmitted = statusInfo?.laeSbmsnSttsCd === "2";
|
||||
const showSaveInToolbar = (enterable || isAdminInfo) && gugunOk;
|
||||
const showSaveInToolbar = (enterable || isAdminInfo) && periodEnterable && gugunOk;
|
||||
const showEnterableToolbarButtons = enterable && gugunOk;
|
||||
const showSubmittedInInputPeriodToolbar = isSubmitted && periodEnterable && gugunOk;
|
||||
const showActionToolbarCard =
|
||||
@@ -304,6 +308,9 @@ const SewerageServiceLevelInp = () => {
|
||||
const [isVerificationFailedByTab, setIsVerificationFailedByTab] = useState<
|
||||
Map<string, boolean>
|
||||
>(new Map());
|
||||
const [footerVerificationByTab, setFooterVerificationByTab] = useState<
|
||||
Map<string, VerificationResultLikeMap | null>
|
||||
>(new Map());
|
||||
const [toolbarSnapshotByTab, setToolbarSnapshotByTab] = useState<
|
||||
Map<string, TabToolbarSnapshot>
|
||||
>(new Map());
|
||||
@@ -420,6 +427,9 @@ const SewerageServiceLevelInp = () => {
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
if (updateLastSearchedValues) setLastSearchedValues(searchContext);
|
||||
setSearchLoaded(true);
|
||||
commitToolbarSnapshotForLoadedTab(tabKey, statusInfo, gridRows.length > 0, searchContext);
|
||||
@@ -455,6 +465,9 @@ const SewerageServiceLevelInp = () => {
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
if (updateLastSearchedValues) setLastSearchedValues(searchContext);
|
||||
setSearchLoaded(true);
|
||||
commitToolbarSnapshotForLoadedTab(tabKey, statusInfo, gridRows.length > 0, searchContext);
|
||||
@@ -478,6 +491,7 @@ const SewerageServiceLevelInp = () => {
|
||||
setTabStatusInfoMap(new Map());
|
||||
setTabStatsCdMap(new Map());
|
||||
setIsVerificationFailedByTab(new Map());
|
||||
setFooterVerificationByTab(new Map());
|
||||
setToolbarSnapshotByTab(new Map());
|
||||
setActiveTab(firstTabKey);
|
||||
activeTabRef.current = firstTabKey;
|
||||
@@ -523,6 +537,7 @@ const SewerageServiceLevelInp = () => {
|
||||
setTabStatusInfoMap(new Map());
|
||||
setTabStatsCdMap(new Map());
|
||||
setIsVerificationFailedByTab(new Map());
|
||||
setFooterVerificationByTab(new Map());
|
||||
setToolbarSnapshotByTab(new Map());
|
||||
setIsNotApplicable(false);
|
||||
activeTabRef.current = firstTabKey;
|
||||
@@ -1001,10 +1016,10 @@ const SewerageServiceLevelInp = () => {
|
||||
for (const tab of SewerageServiceLevelInpTabList) {
|
||||
const tabKey = tab.tabKey;
|
||||
const canEdit =
|
||||
computeTabEnterable(
|
||||
(computeTabEnterable(
|
||||
tabStatusInfoMap.get(tabKey) ?? null,
|
||||
inputPeriodEnterable,
|
||||
) || isAdminInfo;
|
||||
) || isAdminInfo) && inputPeriodEnterable;
|
||||
const rawColumns = (tab.columns ?? []) as ColumnConfig[];
|
||||
const base = canEdit
|
||||
? rawColumns
|
||||
@@ -1128,8 +1143,8 @@ const SewerageServiceLevelInp = () => {
|
||||
onValuesChange={setSearchValues}
|
||||
/>
|
||||
{showActionToolbarCard && (
|
||||
<div className="card !py-0">
|
||||
<div className="flex justify-end items-center gap-[0.6rem] m-[0.6rem]">
|
||||
<div className="card !py-0">
|
||||
<div className="flex justify-end items-center gap-[0.6rem] m-[0.6rem]">
|
||||
<VerificationResultButton
|
||||
VerificationResultButtonFunc={openVerificationHistoryDialog}
|
||||
isVerificationFailed={
|
||||
@@ -1141,19 +1156,19 @@ const SewerageServiceLevelInp = () => {
|
||||
<LastYearDataButton
|
||||
getLastYearDataFunc={() => void getLastYearDataFunc()}
|
||||
/>
|
||||
<SubmitButton submitFunc={submitFunc} />
|
||||
<SubmitButton submitFunc={submitFunc} />
|
||||
</>
|
||||
)}
|
||||
{activeTabStatus?.laeSbmsnSttsCd === "2" && (
|
||||
<CancelSubmitButton cnacelSubmitFunc={cnacelSubmitFunc} />
|
||||
)}
|
||||
{showSaveInToolbar && <SaveButton saveFunc={saveFunc} />}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{showSecondaryToolbarCard && (
|
||||
<div className="card !py-0">
|
||||
<div className="flex justify-end items-center gap-[0.6rem] m-[0.6rem]">
|
||||
<div className="card !py-0">
|
||||
<div className="flex justify-end items-center gap-[0.6rem] m-[0.6rem]">
|
||||
{showNotApplicableForResidentTab && (
|
||||
<NotApplicableCheckButton
|
||||
isCheck={isNotApplicable}
|
||||
@@ -1188,10 +1203,10 @@ const SewerageServiceLevelInp = () => {
|
||||
const tabKey = info.tabKey;
|
||||
const rowData = rowDataMap.get(tabKey) ?? [];
|
||||
const tabEnterableForGrid =
|
||||
computeTabEnterable(
|
||||
(computeTabEnterable(
|
||||
tabStatusInfoMap.get(tabKey) ?? null,
|
||||
inputPeriodEnterable,
|
||||
) || isAdminInfo;
|
||||
) || isAdminInfo) && inputPeriodEnterable;
|
||||
const gugunOk = buildGugunOkForToolbar(lastSearchedValues);
|
||||
const tabStatusInfo = tabStatusInfoMap.get(tabKey) ?? null;
|
||||
|
||||
@@ -1230,6 +1245,9 @@ const SewerageServiceLevelInp = () => {
|
||||
excelExportSearchContext={toExcelExportSearchContextFromSearchForm(lastSearchedValues ?? searchValues)}
|
||||
isExcelExport
|
||||
cellStyleCallback={verificationCellStyle}
|
||||
footerVerificationResult={
|
||||
footerVerificationByTab.get(tabKey) ?? null
|
||||
}
|
||||
cellTooltipCallback={verificationCellTooltip}
|
||||
getGridDataRef={
|
||||
activeTab === tabKey ? getGridDataRef : undefined
|
||||
|
||||
@@ -42,8 +42,10 @@ import { toGridRows } from "@/components/util/grid/gridFunction";
|
||||
import { fetchColumnGuidesRecord } from "@/components/util/grid/columnGuides";
|
||||
import { useTabStore } from "@/store/tab-store";
|
||||
import {
|
||||
patchFooterVerificationByTab,
|
||||
patchVerificationFailedByTab,
|
||||
} from "@/components/util/input/verification-failed-flag";
|
||||
import type { VerificationResultLikeMap } from "@/components/util/input/verification-result-display";
|
||||
import { formatCompactYmdForGrid, toCompactYmdOrNull } from "@/components/util/grid/ymdFormat";
|
||||
import { statisticsInputWaterReuseApi } from "@/entities/statistics/api/input/statistics-input-water-reuse-service";
|
||||
import { statisticsInputSewSupplyRateApi } from "@/entities/statistics/api/input/statistics-input-sew-supply-rate-service";
|
||||
@@ -86,11 +88,11 @@ import { getUserInfo } from "../../../../../../packages/common/components/src/ap
|
||||
|
||||
import SubmitDailog from "./SubmitDailog";
|
||||
|
||||
const WaterReuseInpTabList = [
|
||||
PublicSewageTreatWaterReuseInpColumn,
|
||||
RecycledWaterStatusInpColumn,
|
||||
RainFallUtilFactStatusInpColumn,
|
||||
TreatWaterReuseDesignConstStatusInpColumn,
|
||||
const WaterReuseInpTabList = [
|
||||
PublicSewageTreatWaterReuseInpColumn,
|
||||
RecycledWaterStatusInpColumn,
|
||||
RainFallUtilFactStatusInpColumn,
|
||||
TreatWaterReuseDesignConstStatusInpColumn,
|
||||
TreatWaterReuseBusinessApprStatusInpColumn,
|
||||
] as const;
|
||||
|
||||
@@ -173,7 +175,7 @@ function computeTabToolbarSnapshot(
|
||||
const gugunOk = buildGugunOkForToolbar(searchContext);
|
||||
const enterable = computeTabEnterable(statusInfo, periodEnterable);
|
||||
const isSubmitted = statusInfo?.laeSbmsnSttsCd === "2";
|
||||
const showSaveInToolbar = (enterable || isAdminInfo) && gugunOk;
|
||||
const showSaveInToolbar = (enterable || isAdminInfo) && periodEnterable && gugunOk;
|
||||
const showEnterableToolbarButtons = enterable && gugunOk;
|
||||
const showSubmittedInInputPeriodToolbar = isSubmitted && periodEnterable && gugunOk;
|
||||
const showActionToolbarCard =
|
||||
@@ -539,6 +541,9 @@ const WaterReuseInp = () => {
|
||||
const [isVerificationFailedByTab, setIsVerificationFailedByTab] = useState<
|
||||
Map<string, boolean>
|
||||
>(new Map());
|
||||
const [footerVerificationByTab, setFooterVerificationByTab] = useState<
|
||||
Map<string, VerificationResultLikeMap | null>
|
||||
>(new Map());
|
||||
const [toolbarSnapshotByTab, setToolbarSnapshotByTab] = useState<
|
||||
Map<string, TabToolbarSnapshot>
|
||||
>(new Map());
|
||||
@@ -713,6 +718,9 @@ const WaterReuseInp = () => {
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
if (updateLastSearchedValues) setLastSearchedValues(searchContext);
|
||||
commitToolbarSnapshotForLoadedTab(tabKey, statusInfo, gridRows.length > 0, searchContext);
|
||||
applyNotApplicableForLoadedTab(gridRows);
|
||||
@@ -741,6 +749,9 @@ const WaterReuseInp = () => {
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
if (updateLastSearchedValues) setLastSearchedValues(searchContext);
|
||||
commitToolbarSnapshotForLoadedTab(tabKey, statusInfo, gridRows.length > 0, searchContext);
|
||||
applyNotApplicableForLoadedTab(gridRows);
|
||||
@@ -769,6 +780,9 @@ const WaterReuseInp = () => {
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
if (updateLastSearchedValues) setLastSearchedValues(searchContext);
|
||||
commitToolbarSnapshotForLoadedTab(tabKey, statusInfo, gridRows.length > 0, searchContext);
|
||||
applyNotApplicableForLoadedTab(gridRows);
|
||||
@@ -799,6 +813,9 @@ const WaterReuseInp = () => {
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
if (updateLastSearchedValues) setLastSearchedValues(searchContext);
|
||||
commitToolbarSnapshotForLoadedTab(tabKey, statusInfo, gridRows.length > 0, searchContext);
|
||||
applyNotApplicableForLoadedTab(gridRows);
|
||||
@@ -830,6 +847,9 @@ const WaterReuseInp = () => {
|
||||
setIsVerificationFailedByTab((prev) =>
|
||||
patchVerificationFailedByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
setFooterVerificationByTab((prev) =>
|
||||
patchFooterVerificationByTab(prev, tabKey, commonInfo),
|
||||
);
|
||||
if (updateLastSearchedValues) setLastSearchedValues(searchContext);
|
||||
commitToolbarSnapshotForLoadedTab(tabKey, statusInfo, gridRows.length > 0, searchContext);
|
||||
applyNotApplicableForLoadedTab(gridRows);
|
||||
@@ -887,6 +907,7 @@ const WaterReuseInp = () => {
|
||||
setTabStatusInfoMap(new Map());
|
||||
setTabStatsCdMap(new Map());
|
||||
setIsVerificationFailedByTab(new Map());
|
||||
setFooterVerificationByTab(new Map());
|
||||
setToolbarSnapshotByTab(new Map());
|
||||
setActiveTab(firstTabKey);
|
||||
activeTabRef.current = firstTabKey;
|
||||
@@ -934,6 +955,7 @@ const WaterReuseInp = () => {
|
||||
setTabStatusInfoMap(new Map());
|
||||
setTabStatsCdMap(new Map());
|
||||
setIsVerificationFailedByTab(new Map());
|
||||
setFooterVerificationByTab(new Map());
|
||||
setToolbarSnapshotByTab(new Map());
|
||||
setDeleteListByTab(new Map());
|
||||
loadedTabKeysRef.current.clear();
|
||||
@@ -1905,10 +1927,10 @@ const WaterReuseInp = () => {
|
||||
for (const tab of WaterReuseInpTabList) {
|
||||
const tabKey = tab.tabKey;
|
||||
const canEdit =
|
||||
computeTabEnterable(
|
||||
(computeTabEnterable(
|
||||
tabStatusInfoMap.get(tabKey) ?? null,
|
||||
inputPeriodEnterable,
|
||||
) || isAdminInfo;
|
||||
) || isAdminInfo) && inputPeriodEnterable;
|
||||
const rawColumns = (tab.columns ?? []) as ColumnConfig[];
|
||||
const base = canEdit
|
||||
? rawColumns
|
||||
@@ -2067,8 +2089,8 @@ const WaterReuseInp = () => {
|
||||
onValuesChange={setSearchValues}
|
||||
/>
|
||||
{showActionToolbarCard && (
|
||||
<div className="card !py-0">
|
||||
<div className="flex justify-end items-center gap-[0.6rem] m-[0.6rem]">
|
||||
<div className="card !py-0">
|
||||
<div className="flex justify-end items-center gap-[0.6rem] m-[0.6rem]">
|
||||
<VerificationResultButton
|
||||
VerificationResultButtonFunc={openVerificationHistoryDialog}
|
||||
isVerificationFailed={
|
||||
@@ -2080,19 +2102,19 @@ const WaterReuseInp = () => {
|
||||
<LastYearDataButton
|
||||
getLastYearDataFunc={() => void getLastYearDataFunc()}
|
||||
/>
|
||||
<SubmitButton submitFunc={submitFunc} />
|
||||
<SubmitButton submitFunc={submitFunc} />
|
||||
</>
|
||||
)}
|
||||
{activeTabStatus?.laeSbmsnSttsCd === "2" && (
|
||||
<CancelSubmitButton cnacelSubmitFunc={cnacelSubmitFunc} />
|
||||
)}
|
||||
{showSaveInToolbar && <SaveButton saveFunc={saveFunc} />}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{showSecondaryToolbarCard && (
|
||||
<div className="card !py-0">
|
||||
<div className="flex justify-end items-center gap-[0.6rem] m-[0.6rem]">
|
||||
<div className="card !py-0">
|
||||
<div className="flex justify-end items-center gap-[0.6rem] m-[0.6rem]">
|
||||
{showNotApplicableForActiveTab && (
|
||||
<NotApplicableCheckButton
|
||||
isCheck={isNotApplicableForActiveTab}
|
||||
@@ -2106,12 +2128,12 @@ const WaterReuseInp = () => {
|
||||
)}
|
||||
{isArticleEditTab && showEnterableToolbarButtons && (
|
||||
<>
|
||||
<AddArticleButton addArticleFunc={addArticleFunc} />
|
||||
<DeleteArticleButton deleteArticleFunc={deleteArticleFunc} />
|
||||
<AddArticleButton addArticleFunc={addArticleFunc} />
|
||||
<DeleteArticleButton deleteArticleFunc={deleteArticleFunc} />
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{isLoading && (
|
||||
<div className="absolute inset-0 z-50 [data-theme='black']:bg-transparent rounded-lg p-10 flex justify-center items-center">
|
||||
@@ -2138,10 +2160,10 @@ const WaterReuseInp = () => {
|
||||
const tabKey = info.tabKey;
|
||||
const rowData = rowDataMap.get(tabKey) ?? [];
|
||||
const tabEnterableForGrid =
|
||||
computeTabEnterable(
|
||||
(computeTabEnterable(
|
||||
tabStatusInfoMap.get(tabKey) ?? null,
|
||||
inputPeriodEnterable,
|
||||
) || isAdminInfo;
|
||||
) || isAdminInfo) && inputPeriodEnterable;
|
||||
const gugunOk = buildGugunOkForToolbar(lastSearchedValues);
|
||||
const tabStatusInfo = tabStatusInfoMap.get(tabKey) ?? null;
|
||||
|
||||
@@ -2183,6 +2205,9 @@ const WaterReuseInp = () => {
|
||||
excelExportSearchContext={toExcelExportSearchContextFromSearchForm(lastSearchedValues ?? searchValues)}
|
||||
isExcelExport
|
||||
cellStyleCallback={verificationCellStyle}
|
||||
footerVerificationResult={
|
||||
footerVerificationByTab.get(tabKey) ?? null
|
||||
}
|
||||
cellTooltipCallback={verificationCellTooltip}
|
||||
getGridDataRef={
|
||||
activeTab === tabKey ? getGridDataRef : undefined
|
||||
|
||||
@@ -29,6 +29,11 @@ export interface ReviewSubmitDialogProps {
|
||||
onOpenChange: (open: boolean) => void;
|
||||
context: ReviewerInfoRequest | null;
|
||||
onSubmitted?: () => void | Promise<void>;
|
||||
/**
|
||||
* true면 검토의견·처리내역 UI를 숨기고
|
||||
* submit body에 statsCd / splmntOpnnCn / wrterOpnnCn을 넣지 않음
|
||||
*/
|
||||
hideOpinionFields?: boolean;
|
||||
}
|
||||
|
||||
export function ReviewSubmitDialog({
|
||||
@@ -36,6 +41,7 @@ export function ReviewSubmitDialog({
|
||||
onOpenChange,
|
||||
context,
|
||||
onSubmitted,
|
||||
hideOpinionFields = false,
|
||||
}: ReviewSubmitDialogProps) {
|
||||
const { setMessage: alert } = useAlertStore((state) => state);
|
||||
const [reviewerInfo, setReviewerInfo] =
|
||||
@@ -98,14 +104,20 @@ export function ReviewSubmitDialog({
|
||||
setIsSubmitting(true);
|
||||
|
||||
const userInfo = await getUserInfo();
|
||||
const submitParam: ReviewSubmitRequest = {
|
||||
statsYr: context.statsYr,
|
||||
sewerBzmnCd: context.sewerBzmnCd,
|
||||
statsCd: context.statsCd,
|
||||
mdfrId: userInfo.userUnqId,
|
||||
splmntOpnnCn: reviewerInfo?.splmntOpnnCn ?? "",
|
||||
wrterOpnnCn: reviewerInfo?.wrterOpnnCn ?? "",
|
||||
};
|
||||
const submitParam: ReviewSubmitRequest = hideOpinionFields
|
||||
? {
|
||||
statsYr: context.statsYr,
|
||||
sewerBzmnCd: [context.sewerBzmnCd],
|
||||
mdfrId: userInfo.userUnqId,
|
||||
}
|
||||
: {
|
||||
statsYr: context.statsYr,
|
||||
sewerBzmnCd: context.sewerBzmnCd,
|
||||
statsCd: context.statsCd,
|
||||
mdfrId: userInfo.userUnqId,
|
||||
splmntOpnnCn: reviewerInfo?.splmntOpnnCn ?? "",
|
||||
wrterOpnnCn: reviewerInfo?.wrterOpnnCn ?? "",
|
||||
};
|
||||
|
||||
const response = await statisticsApi.submitReview(submitParam);
|
||||
if (response.status !== "success") {
|
||||
@@ -153,22 +165,26 @@ export function ReviewSubmitDialog({
|
||||
<Label className="text-label">직책</Label>
|
||||
<Input value={reviewerInfo?.cps ?? "-"} readOnly />
|
||||
</div>
|
||||
<div className="col-span-2 flex flex-col gap-2">
|
||||
<Label className="text-label">검토의견</Label>
|
||||
<Textarea
|
||||
value={reviewerInfo?.splmntOpnnCn ?? "-"}
|
||||
readOnly
|
||||
className="min-h-[10rem] p-2 resize-none !text-xl"
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-2 flex flex-col gap-2">
|
||||
<Label className="text-label">처리내역</Label>
|
||||
<Textarea
|
||||
value={reviewerInfo?.wrterOpnnCn ?? "-"}
|
||||
readOnly
|
||||
className="min-h-[10rem] p-2 resize-none !text-xl"
|
||||
/>
|
||||
</div>
|
||||
{!hideOpinionFields && (
|
||||
<>
|
||||
<div className="col-span-2 flex flex-col gap-2">
|
||||
<Label className="text-label">검토의견</Label>
|
||||
<Textarea
|
||||
value={reviewerInfo?.splmntOpnnCn ?? "-"}
|
||||
readOnly
|
||||
className="min-h-[10rem] p-2 resize-none !text-xl"
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-2 flex flex-col gap-2">
|
||||
<Label className="text-label">처리내역</Label>
|
||||
<Textarea
|
||||
value={reviewerInfo?.wrterOpnnCn ?? "-"}
|
||||
readOnly
|
||||
className="min-h-[10rem] p-2 resize-none !text-xl"
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
<DialogFooter>
|
||||
<Button
|
||||
|
||||
@@ -31,7 +31,7 @@ import type {
|
||||
ColumnLayoutItem,
|
||||
} from "@/components/type/DataGrid.type";
|
||||
import type { SearchFormValues } from "@/components/type/SearchForm.type";
|
||||
import { SewagePipeColumnInfoListRvw } from "@/components/util/column/review/SewagePipeRvwColumn";
|
||||
import { SewagePipeColumnInfoListRvw, getST00020003RvwConfig, getST00020005RvwConfig } from "@/components/util/column/review/SewagePipeRvwColumn";
|
||||
import { buildReviewCellStyleCallbackByTab } from "@/components/util/grid/reviewEmptyCurrCellStyle";
|
||||
import ReviewEmptyCurrLegend from "@/components/statistics/review/ReviewEmptyCurrLegend";
|
||||
import { toGridRows } from "@/components/util/grid/gridFunction";
|
||||
@@ -148,15 +148,25 @@ const SewagePipeRvw = () => {
|
||||
[tabStatsStatusInfoMap, activeTab],
|
||||
);
|
||||
const columnInfo = useMemo<ColumnInfoList[]>(
|
||||
() =>
|
||||
SewagePipeColumnInfoListRvw.map((tab) => ({
|
||||
...tab,
|
||||
columns: (tab.columns ?? []).map((col) => cloneColumnConfig(col)),
|
||||
columnLayout: (tab.columnLayout ?? []).map((item) =>
|
||||
cloneColumnLayoutItem(item),
|
||||
),
|
||||
})),
|
||||
[],
|
||||
() => {
|
||||
const statsYr = lastSearchValues?.year ?? new Date().getFullYear();
|
||||
const st00020003Config = getST00020003RvwConfig(statsYr);
|
||||
const st00020005Config = getST00020005RvwConfig(statsYr);
|
||||
return SewagePipeColumnInfoListRvw.map((tab) => {
|
||||
const source =
|
||||
tab.tabKey === "ST00020003" ? st00020003Config
|
||||
: tab.tabKey === "ST00020005" ? st00020005Config
|
||||
: tab;
|
||||
return {
|
||||
...source,
|
||||
columns: (source.columns ?? []).map((col) => cloneColumnConfig(col as Parameters<typeof cloneColumnConfig>[0])),
|
||||
columnLayout: (source.columnLayout ?? []).map((item) =>
|
||||
cloneColumnLayoutItem(item as ColumnLayoutItem),
|
||||
),
|
||||
};
|
||||
});
|
||||
},
|
||||
[lastSearchValues?.year],
|
||||
);
|
||||
|
||||
const reviewCellStyleCallbackByTab = useMemo(
|
||||
|
||||
@@ -6,6 +6,8 @@ import DataGrid from "@/components/module/DataGrid";
|
||||
import type { DataCellClickCallbackParams } from "@/components/type/DataGrid.type";
|
||||
import SearchForm from "@/components/module/SearchForm";
|
||||
import ApproveButton from "@/components/button/ApproveButton";
|
||||
import SubmitButton from "@/components/button/SumitButton";
|
||||
import { ReviewSubmitDialog } from "@/components/statistics/review/ReviewSubmitDialog";
|
||||
import { doList } from "@/components/util/column/input/DoList";
|
||||
import {
|
||||
Button,
|
||||
@@ -18,9 +20,12 @@ import {
|
||||
DataTable
|
||||
} from "@common/components";
|
||||
|
||||
import { useAlertStore } from "@/shared/lib";
|
||||
import { useAlertStore, useUserStore } from "@/shared/lib";
|
||||
import { statisticsApi } from "@/entities/statistics/api/statistics-service";
|
||||
import type { StatsInputStatusApproveItem } from "@/entities/statistics/model/statistics-interface";
|
||||
import type {
|
||||
ReviewerInfoRequest,
|
||||
StatsInputStatusApproveItem,
|
||||
} from "@/entities/statistics/model/statistics-interface";
|
||||
import { StatsInputStatusInfoList } from "@/components/util/column/review/StatsInputStatusRvwColumn";
|
||||
import { statisticsManagementApi } from "@/entities/statistics/api/statistics-management-service";
|
||||
import type {
|
||||
@@ -55,6 +60,7 @@ const mapSewerageListToGridRows = (rawList: StatsInputStatusReviewItem[]) =>
|
||||
// 하수도 통계 검토 00. 통계 입력 현황
|
||||
const StatsInputStatusRvw = () => {
|
||||
const { setMessage: alert } = useAlertStore((state) => state);
|
||||
const userInfo = useUserStore((state) => state.userInfo);
|
||||
const { confirm } = useConfirm();
|
||||
const [rowData, setRowData] = useState<Record<string, string | number>[]>([]);
|
||||
const [historyRowData, setHistoryRowData] = useState<ReviewHistoryRow[]>([]);
|
||||
@@ -63,6 +69,7 @@ const StatsInputStatusRvw = () => {
|
||||
const [searchedYear, setSearchedYear] = useState<string>("");
|
||||
const [lastSearchedValues, setLastSearchedValues] = useState<SearchFormValues | null>(null);
|
||||
const [hasCompletedSearch, setHasCompletedSearch] = useState(false);
|
||||
const [submitDialogOpen, setSubmitDialogOpen] = useState(false);
|
||||
const [reviewHistoryOpen, setReviewHistoryOpen] = useState<boolean>(false);
|
||||
const [historySearchInfo, setHistorySearchInfo] = useState<{
|
||||
ctpvNm: string;
|
||||
@@ -112,6 +119,7 @@ const StatsInputStatusRvw = () => {
|
||||
setLastSearchedValues(null);
|
||||
setHasCompletedSearch(false);
|
||||
setIsApproveLoading(false);
|
||||
setSubmitDialogOpen(false);
|
||||
};
|
||||
|
||||
const handleSearch = async (values: SearchFormValues) => {
|
||||
@@ -242,13 +250,74 @@ const StatsInputStatusRvw = () => {
|
||||
[rowData],
|
||||
);
|
||||
|
||||
const showActionToolbarCard =
|
||||
/** 진행상태(prvn) 코드가 모두 제출완료(2) */
|
||||
const allPrvnStatusSubmitted = useMemo(
|
||||
() =>
|
||||
rowData.length > 0 &&
|
||||
rowData.every((row) => String(row.prvnStatusCd ?? "") === "2"),
|
||||
[rowData],
|
||||
);
|
||||
|
||||
const showSubmitButton =
|
||||
hasCompletedSearch &&
|
||||
rowData.length > 0 &&
|
||||
gugunOkOrNotDoList &&
|
||||
!allPrvnStatusApproved &&
|
||||
!allPrvnStatusSubmitted;
|
||||
|
||||
const showApproveButton =
|
||||
hasCompletedSearch &&
|
||||
rowData.length > 0 &&
|
||||
gugunOkOrNotDoList &&
|
||||
allSubmitStatusApproved &&
|
||||
!allPrvnStatusApproved;
|
||||
|
||||
const showActionToolbarCard = showSubmitButton || showApproveButton;
|
||||
|
||||
const submitDialogContext = useMemo<ReviewerInfoRequest | null>(() => {
|
||||
if (lastSearchedValues == null) return null;
|
||||
|
||||
const statsYr = lastSearchedValues.year ?? "";
|
||||
const sewerBzmnCd = lastSearchedValues.bsnmCd ?? "";
|
||||
const instSeCd = userInfo?.instSeCd ?? "";
|
||||
|
||||
if (!statsYr || !sewerBzmnCd || !instSeCd) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
statsYr,
|
||||
sewerBzmnCd,
|
||||
instSeCd,
|
||||
};
|
||||
}, [lastSearchedValues, userInfo?.instSeCd]);
|
||||
|
||||
const submitFunc = () => {
|
||||
if (submitDialogContext == null) {
|
||||
alert("조회 후 제출할 수 있습니다.");
|
||||
return;
|
||||
}
|
||||
setSubmitDialogOpen(true);
|
||||
};
|
||||
|
||||
const refreshListAfterSubmit = async () => {
|
||||
if (!lastSearchedValues) return;
|
||||
try {
|
||||
const listResponse = await statisticsManagementApi.getStatsInputStatusList({
|
||||
ctpvNm: lastSearchedValues.sido,
|
||||
sggNm: lastSearchedValues.gugun === "ALL" ? "" : lastSearchedValues.gugun,
|
||||
statsYr: lastSearchedValues.year ?? "",
|
||||
sewerBzmnCd: lastSearchedValues.bsnmCd,
|
||||
});
|
||||
if (listResponse.status === "success" && listResponse.data) {
|
||||
const rawList = listResponse.data.sewerageInputList ?? [];
|
||||
setRowData(toGridRows(mapSewerageListToGridRows(rawList)));
|
||||
}
|
||||
} catch {
|
||||
/* 목록 갱신 실패는 별도 안내 없이 생략 */
|
||||
}
|
||||
};
|
||||
|
||||
const openReviewHistoryForRow = useCallback(
|
||||
async (row: Record<string, string | number>) => {
|
||||
if (!searchedYear) {
|
||||
@@ -297,7 +366,10 @@ const StatsInputStatusRvw = () => {
|
||||
{showActionToolbarCard && (
|
||||
<div className="card !py-0">
|
||||
<div className="flex justify-end items-center gap-[0.6rem] m-[0.6rem]">
|
||||
<ApproveButton approveFunc={approveFunc} />
|
||||
{showSubmitButton && (
|
||||
<SubmitButton submitFunc={submitFunc} text="일괄 제출" />
|
||||
)}
|
||||
{showApproveButton && <ApproveButton approveFunc={approveFunc} />}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
@@ -357,6 +429,13 @@ const StatsInputStatusRvw = () => {
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<ReviewSubmitDialog
|
||||
open={submitDialogOpen}
|
||||
onOpenChange={setSubmitDialogOpen}
|
||||
context={submitDialogContext}
|
||||
hideOpinionFields
|
||||
onSubmitted={() => void refreshListAfterSubmit()}
|
||||
/>
|
||||
<Dialog open={reviewHistoryOpen} onOpenChange={setReviewHistoryOpen}>
|
||||
<DialogContent
|
||||
className="flex max-h-[85vh] max-w-[48rem] flex-col gap-4"
|
||||
|
||||
@@ -84,7 +84,7 @@ const ExcretaTreatmentFacilityTot = () => {
|
||||
|
||||
return (
|
||||
<div className="relative">
|
||||
<SearchForm isDetail={true} isSummary={true} onSubmit={handleSearch} onReset={handleReset} sidoSelectText="전체" />
|
||||
<SearchForm isDetail={true} isSummary={true} onSubmit={handleSearch} onReset={handleReset} sidoSelectText="전체" defaultRegionAll />
|
||||
|
||||
{isLoading && (
|
||||
<div className="absolute inset-0 z-50 [data-theme='black']:bg-transparent rounded-lg p-10 flex justify-center items-center">
|
||||
@@ -105,6 +105,7 @@ const ExcretaTreatmentFacilityTot = () => {
|
||||
setRowData={setRowData} // 필수 프로퍼티 에러 해결
|
||||
isExcelImport={false}
|
||||
isExcelExport={true}
|
||||
excelExportApplyStyles
|
||||
showHeaderCheckbox={false}
|
||||
fixedColumns={config.fixedColumns}
|
||||
enableSort={false}
|
||||
|
||||
@@ -132,7 +132,7 @@ const PrivateSewageFacilityTot = () => {
|
||||
|
||||
return (
|
||||
<div className="relative">
|
||||
<SearchForm isDetail={true} isSummary={true} onSubmit={handleSearch} onReset={handleReset} sidoSelectText="전체" />
|
||||
<SearchForm isDetail={true} isSummary={true} onSubmit={handleSearch} onReset={handleReset} sidoSelectText="전체" defaultRegionAll />
|
||||
|
||||
{/* 하수관로 규칙과 100% 싱크 맞춘 중앙 정렬 소형 팝업 로딩 바 고정 */}
|
||||
{isLoading && (
|
||||
@@ -184,6 +184,7 @@ const PrivateSewageFacilityTot = () => {
|
||||
}}
|
||||
isExcelImport={false}
|
||||
isExcelExport={true}
|
||||
excelExportApplyStyles
|
||||
showHeaderCheckbox={false}
|
||||
fixedColumns={info.fixedColumns}
|
||||
enableSort={false}
|
||||
|
||||
@@ -52,7 +52,7 @@ const PublicSewageFacilityTot = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<SearchForm isDetail={true} capacityGbn={true} isSummary={true} onSubmit={handleSearch} sidoSelectText="전체" />
|
||||
<SearchForm isDetail={true} capacityGbn={true} isSummary={true} onSubmit={handleSearch} sidoSelectText="전체" defaultRegionAll />
|
||||
{isLoading && (
|
||||
<div className="absolute inset-0 z-50 [data-theme='black']:bg-transparent rounded-lg p-10 flex justify-center items-center">
|
||||
<div className="relative size-[5rem]">
|
||||
@@ -65,6 +65,7 @@ const PublicSewageFacilityTot = () => {
|
||||
columnInfo={PublicSewageFacilityColumn}
|
||||
rowStartNum={2}
|
||||
isExcelImport={false}
|
||||
excelExportApplyStyles
|
||||
fixedColumns={2}
|
||||
rowData={rowData}
|
||||
setRowData={setRowData}
|
||||
|
||||
@@ -84,7 +84,7 @@ const PumpingStationTot = () => {
|
||||
|
||||
return (
|
||||
<div className="relative">
|
||||
<SearchForm isDetail={true} isSummary={true} onSubmit={handleSearch} onReset={handleReset} sidoSelectText="전체" />
|
||||
<SearchForm isDetail={true} isSummary={true} onSubmit={handleSearch} onReset={handleReset} sidoSelectText="전체" defaultRegionAll />
|
||||
|
||||
{isLoading && (
|
||||
<div className="absolute inset-0 z-50 [data-theme='black']:bg-transparent rounded-lg p-10 flex justify-center items-center">
|
||||
@@ -105,6 +105,7 @@ const PumpingStationTot = () => {
|
||||
setRowData={setRowData}
|
||||
isExcelImport={false}
|
||||
isExcelExport={true}
|
||||
excelExportApplyStyles
|
||||
showHeaderCheckbox={false}
|
||||
fixedColumns={config.fixedColumns}
|
||||
enableSort={false}
|
||||
|
||||
@@ -102,7 +102,7 @@ const SewageExcretaRelatedTot = () => {
|
||||
|
||||
return (
|
||||
<div className="relative">
|
||||
<SearchForm isDetail={true} isSummary={true} onSubmit={handleSearch} onReset={handleReset} sidoSelectText="전체" />
|
||||
<SearchForm isDetail={true} isSummary={true} onSubmit={handleSearch} onReset={handleReset} sidoSelectText="전체" defaultRegionAll />
|
||||
|
||||
{isLoading && (
|
||||
<div className="absolute inset-0 z-50 [data-theme='black']:bg-transparent rounded-lg p-10 flex justify-center items-center">
|
||||
@@ -140,6 +140,7 @@ const SewageExcretaRelatedTot = () => {
|
||||
}}
|
||||
isExcelImport={false}
|
||||
isExcelExport={true}
|
||||
excelExportApplyStyles
|
||||
showHeaderCheckbox={false}
|
||||
fixedColumns={info.fixedColumns}
|
||||
enableSort={false}
|
||||
|
||||
@@ -146,7 +146,7 @@ const loadGridData = async (tabKey: string, values: SearchFormValues): Promise<b
|
||||
|
||||
return (
|
||||
<div className="relative">
|
||||
<SearchForm isDetail={true} isSummary={true} onSubmit={handleSearch} onReset={handleReset} sidoSelectText="전체" />
|
||||
<SearchForm isDetail={true} isSummary={true} onSubmit={handleSearch} onReset={handleReset} sidoSelectText="전체" defaultRegionAll />
|
||||
|
||||
{isLoading && (
|
||||
<div className="absolute inset-0 z-50 [data-theme='black']:bg-transparent rounded-lg p-10 flex justify-center items-center">
|
||||
@@ -188,6 +188,7 @@ const loadGridData = async (tabKey: string, values: SearchFormValues): Promise<b
|
||||
}}
|
||||
isExcelImport={false}
|
||||
isExcelExport={true}
|
||||
excelExportApplyStyles
|
||||
showHeaderCheckbox={false}
|
||||
fixedColumns={info.fixedColumns}
|
||||
enableSort={false}
|
||||
|
||||
@@ -133,7 +133,7 @@ const SewagePipeMaintainTot = () => {
|
||||
|
||||
return (
|
||||
<div className="relative">
|
||||
<SearchForm isDetail={true} isSummary={true} onSubmit={handleSearch} onReset={handleReset} sidoSelectText="전체" />
|
||||
<SearchForm isDetail={true} isSummary={true} onSubmit={handleSearch} onReset={handleReset} sidoSelectText="전체" defaultRegionAll />
|
||||
{isLoading && (
|
||||
<div className="absolute inset-0 z-50 [data-theme='black']:bg-transparent rounded-lg p-10 flex justify-center items-center">
|
||||
<div className="relative size-[5rem]">
|
||||
@@ -186,6 +186,7 @@ const SewagePipeMaintainTot = () => {
|
||||
}}
|
||||
isExcelImport={false}
|
||||
isExcelExport
|
||||
excelExportApplyStyles
|
||||
showHeaderCheckbox={false}
|
||||
fixedColumns={info.fixedColumns}
|
||||
enableSort={false}
|
||||
|
||||
@@ -8,7 +8,7 @@ import SearchForm from "@/components/module/SearchForm";
|
||||
import DataGrid from "@/components/module/DataGrid";
|
||||
import type { ColumnInfo } from "@/components/type/DataGrid.type";
|
||||
import type { SearchFormValues } from "@/components/type/SearchForm.type";
|
||||
import { SewagePipeColumnInfoListTot, getST00020003Config } from "@/components/util/column/total/SewagePipeTotColumn";
|
||||
import { SewagePipeColumnInfoListTot, getST00020003Config, getST00020005Config } from "@/components/util/column/total/SewagePipeTotColumn";
|
||||
import { toGridRows } from "@/components/util/grid/gridFunction";
|
||||
import type { SewagePipeTotalRequest } from "@/entities/statistics/model/statistics-total/statistics-sewage-pipe-total-interface";
|
||||
import CellColorInfo from "./CellColorInfo";
|
||||
@@ -178,7 +178,7 @@ const SewagePipeTot = () => {
|
||||
|
||||
return (
|
||||
<div className="relative">
|
||||
<SearchForm isDetail={true} isSummary={true} onSubmit={handleSearch} onReset={handleReset} sidoSelectText="전체" />
|
||||
<SearchForm isDetail={true} isSummary={true} onSubmit={handleSearch} onReset={handleReset} sidoSelectText="전체" defaultRegionAll />
|
||||
{isLoading && (
|
||||
<div className="absolute inset-0 z-50 [data-theme='black']:bg-transparent rounded-lg p-10 flex justify-center items-center">
|
||||
<div className="relative size-[5rem]">
|
||||
@@ -204,11 +204,12 @@ const SewagePipeTot = () => {
|
||||
{columnInfo.map((info) => {
|
||||
const tabKey = info.tabKey;
|
||||
|
||||
// ★ [동적 처리] ST00020003인 경우 함수를 통해 컬럼 정보를 실시간으로 생성
|
||||
// ★ [동적 처리] ST00020003·ST00020005는 함수를 통해 컬럼 정보를 실시간으로 생성
|
||||
const currentYear = lastSearchedValuesRef.current?.year || new Date().getFullYear();
|
||||
const finalTabConfig = tabKey === "ST00020003"
|
||||
? getST00020003Config(currentYear)
|
||||
: info;
|
||||
const finalTabConfig =
|
||||
tabKey === "ST00020003" ? getST00020003Config(currentYear) :
|
||||
tabKey === "ST00020005" ? getST00020005Config(currentYear) :
|
||||
info;
|
||||
|
||||
if (!finalTabConfig.columns || !finalTabConfig.columnLayout) {
|
||||
return null;
|
||||
@@ -239,6 +240,7 @@ const SewagePipeTot = () => {
|
||||
}}
|
||||
isExcelImport={false}
|
||||
isExcelExport
|
||||
excelExportApplyStyles
|
||||
showHeaderCheckbox={false}
|
||||
fixedColumns={finalTabConfig.fixedColumns}
|
||||
enableSort={false}
|
||||
|
||||
@@ -118,7 +118,7 @@ const SewageReservoirPumpTot = () => {
|
||||
|
||||
return (
|
||||
<div className="relative">
|
||||
<SearchForm isDetail={true} isSummary={true} onSubmit={handleSearch} onReset={handleReset} sidoSelectText="전체" />
|
||||
<SearchForm isDetail={true} isSummary={true} onSubmit={handleSearch} onReset={handleReset} sidoSelectText="전체" defaultRegionAll />
|
||||
|
||||
{isLoading && (
|
||||
<div className="absolute inset-0 z-50 [data-theme='black']:bg-transparent rounded-lg p-10 flex justify-center items-center">
|
||||
@@ -168,6 +168,7 @@ const SewageReservoirPumpTot = () => {
|
||||
}}
|
||||
isExcelImport={false}
|
||||
isExcelExport={true}
|
||||
excelExportApplyStyles
|
||||
showHeaderCheckbox={false}
|
||||
fixedColumns={info.fixedColumns}
|
||||
enableSort={false}
|
||||
|
||||
@@ -199,6 +199,7 @@ const SewerageAggregateSummary = () => {
|
||||
<SearchForm
|
||||
isSummary={true}
|
||||
sidoSelectText="전체"
|
||||
defaultRegionAll
|
||||
searchButtonText="내려받기"
|
||||
onSubmit={(values) => void handleDownload(values)}
|
||||
isReset={false}
|
||||
|
||||
@@ -144,7 +144,7 @@ const SewerageFinanceTot = () => {
|
||||
|
||||
return (
|
||||
<div className="relative">
|
||||
<SearchForm isDetail={true} isSummary={true} onSubmit={handleSearch} onReset={handleReset} sidoSelectText="전체" />
|
||||
<SearchForm isDetail={true} isSummary={true} onSubmit={handleSearch} onReset={handleReset} sidoSelectText="전체" defaultRegionAll />
|
||||
|
||||
{isLoading && (
|
||||
<div className="absolute inset-0 z-50 [data-theme='black']:bg-transparent rounded-lg p-10 flex justify-center items-center">
|
||||
@@ -195,6 +195,7 @@ const SewerageFinanceTot = () => {
|
||||
}}
|
||||
isExcelImport={false}
|
||||
isExcelExport={true}
|
||||
excelExportApplyStyles
|
||||
showHeaderCheckbox={false}
|
||||
fixedColumns={info.fixedColumns}
|
||||
enableSort={false}
|
||||
|
||||
@@ -51,7 +51,7 @@ const SeweragePenetrationRateTot = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<SearchForm isDetail={true} isSummary={true} onSubmit={handleSearch} sidoSelectText="전체" />
|
||||
<SearchForm isDetail={true} isSummary={true} onSubmit={handleSearch} sidoSelectText="전체" defaultRegionAll />
|
||||
{isLoading && <div className="absolute inset-0 z-50 [data-theme='black']:bg-transparent rounded-lg p-10 flex justify-center items-center">
|
||||
<div className="relative size-[5rem]">
|
||||
<LoadingWithAnimation color="primary" />
|
||||
@@ -62,6 +62,7 @@ const SeweragePenetrationRateTot = () => {
|
||||
columnInfo={SeweragePentrationRateTotColumn}
|
||||
rowStartNum={2}
|
||||
isExcelImport={false}
|
||||
excelExportApplyStyles
|
||||
fixedColumns={1}
|
||||
rowData={rowData}
|
||||
setRowData={setRowData}
|
||||
|
||||
@@ -91,7 +91,7 @@ const SewerageServiceLevelTot = () => {
|
||||
|
||||
return (
|
||||
<div className="relative">
|
||||
<SearchForm isDetail={true} isSummary={true} onSubmit={handleSearch} onReset={handleReset} sidoSelectText="전체" />
|
||||
<SearchForm isDetail={true} isSummary={true} onSubmit={handleSearch} onReset={handleReset} sidoSelectText="전체" defaultRegionAll />
|
||||
|
||||
{isLoading && (
|
||||
<div className="absolute inset-0 z-50 [data-theme='black']:bg-transparent rounded-lg p-10 flex justify-center items-center">
|
||||
@@ -129,6 +129,7 @@ const SewerageServiceLevelTot = () => {
|
||||
}}
|
||||
isExcelImport={false}
|
||||
isExcelExport={true}
|
||||
excelExportApplyStyles
|
||||
showHeaderCheckbox={false}
|
||||
fixedColumns={info.fixedColumns}
|
||||
enableSort={false}
|
||||
|
||||
@@ -157,7 +157,7 @@ const WaterReuseTot = () => {
|
||||
|
||||
return (
|
||||
<div className="relative">
|
||||
<SearchForm isDetail={true} isSummary={true} onSubmit={handleSearch} onReset={handleReset} sidoSelectText="전체" />
|
||||
<SearchForm isDetail={true} isSummary={true} onSubmit={handleSearch} onReset={handleReset} sidoSelectText="전체" defaultRegionAll />
|
||||
|
||||
{/* 정중앙 5rem 크기 고정 격리형 로딩 애니메이션 */}
|
||||
{isLoading && (
|
||||
@@ -207,6 +207,7 @@ const WaterReuseTot = () => {
|
||||
}}
|
||||
isExcelImport={false}
|
||||
isExcelExport={true}
|
||||
excelExportApplyStyles
|
||||
showHeaderCheckbox={false}
|
||||
fixedColumns={info.fixedColumns}
|
||||
enableSort={false}
|
||||
|
||||
+792
-303
File diff suppressed because it is too large
Load Diff
+110
-15
@@ -11,6 +11,7 @@ import {
|
||||
Textarea,
|
||||
Skeleton,
|
||||
Input,
|
||||
Checkbox,
|
||||
} from "@common/components";
|
||||
import { CodeSelect } from "@/entities/code";
|
||||
|
||||
@@ -32,11 +33,13 @@ interface FomulaDialogProps {
|
||||
data?: VerifyDetailResponseDto | null;
|
||||
trgtStatsCd?: string;
|
||||
trgtStatsNm?: string;
|
||||
/** 바로 앞 수식 연산자가 like / !like 일 때 '사용자 직접 입력' 체크박스 표시 */
|
||||
allowLikeDirectInput?: boolean;
|
||||
/** 확인 클릭 시 검사 통과 후 호출. 해당 행에 반영 후 다이얼로그 닫기는 부모에서 처리 */
|
||||
onConfirm?: (payload: FomulaDialogConfirmPayload) => void;
|
||||
}
|
||||
|
||||
const FomulaDialog = ({ open, onOpenChange, data, trgtStatsCd, trgtStatsNm, onConfirm }: FomulaDialogProps) => {
|
||||
const FomulaDialog = ({ open, onOpenChange, data, trgtStatsCd, trgtStatsNm, allowLikeDirectInput = false, onConfirm }: FomulaDialogProps) => {
|
||||
const [columnInfo, setColumnInfo] = useState<VerifyColumnListResponseData | null>(null);
|
||||
const [selectedColumnInfo, setSelectedColumnInfo] = useState<SelectedVerifyColumnListResponseData | null>(null);
|
||||
const [showCommonColumns, setShowCommonColumns] = useState<boolean>(true);
|
||||
@@ -50,6 +53,8 @@ const FomulaDialog = ({ open, onOpenChange, data, trgtStatsCd, trgtStatsNm, onCo
|
||||
/** 수식 = 토큰 배열. 한글명 중복 시 출처(공통/대상/참조)별 engColNm 보존 */
|
||||
const [formulaDisplaySegments, setFormulaDisplaySegments] = useState<string[]>([]);
|
||||
const [formulaValueSegments, setFormulaValueSegments] = useState<string[]>([]);
|
||||
/** like / !like 수식에서 '사용자 직접 입력' 체크 여부 */
|
||||
const [userDirectInput, setUserDirectInput] = useState(false);
|
||||
/** 확인 클릭 시 검사 실패 메시지 (Textarea 아래 빨간 글씨) */
|
||||
const [formulaSaveError, setFormulaSaveError] = useState<string | null>(null);
|
||||
/** 참조 통계 변경 시 안내 메시지 */
|
||||
@@ -57,6 +62,8 @@ const FomulaDialog = ({ open, onOpenChange, data, trgtStatsCd, trgtStatsNm, onCo
|
||||
|
||||
const formulaTextareaRef = useRef<HTMLTextAreaElement | null>(null);
|
||||
|
||||
const isUserDirectInputMode = allowLikeDirectInput && userDirectInput;
|
||||
|
||||
const { setMessage: alert } = useAlertStore((state) => state);
|
||||
|
||||
/** 다이얼로그에서 쓰는 기호 → 제출용 value. 백엔드 규격에 맞게 수정 가능 */
|
||||
@@ -112,6 +119,36 @@ const FomulaDialog = ({ open, onOpenChange, data, trgtStatsCd, trgtStatsNm, onCo
|
||||
return { display, value };
|
||||
};
|
||||
|
||||
/** 직접 입력 저장값의 양쪽 백틱 제거 (편집용) */
|
||||
const stripBacktickWrap = (value: string) => {
|
||||
if (value.length >= 2 && value.startsWith("`") && value.endsWith("`")) {
|
||||
return value.slice(1, -1);
|
||||
}
|
||||
return value;
|
||||
};
|
||||
|
||||
/** 직접 입력 저장 시 백틱으로 감싸기 (이미 감싸진 경우 유지) */
|
||||
const wrapWithBacktick = (value: string) => {
|
||||
if (!value) return value;
|
||||
if (value.startsWith("`") && value.endsWith("`")) return value;
|
||||
return `\`${value}\``;
|
||||
};
|
||||
|
||||
const handleUserDirectInputChange = (checked: boolean) => {
|
||||
setFormulaSaveError(null);
|
||||
setUserDirectInput(checked);
|
||||
const current = formulaDisplaySegments.join("");
|
||||
if (checked) {
|
||||
const editable = stripBacktickWrap(current);
|
||||
setFormulaDisplaySegments(editable ? [editable] : []);
|
||||
setFormulaValueSegments(editable ? [editable] : []);
|
||||
return;
|
||||
}
|
||||
const { display, value } = parseDisplayToSegments(current);
|
||||
setFormulaDisplaySegments(display);
|
||||
setFormulaValueSegments(value);
|
||||
};
|
||||
|
||||
const handleFormulaKey = (val: string) => {
|
||||
setFormulaSaveError(null);
|
||||
if (val === 'backspace') {
|
||||
@@ -257,6 +294,7 @@ const FomulaDialog = ({ open, onOpenChange, data, trgtStatsCd, trgtStatsNm, onCo
|
||||
setRefStatsCdLocal('');
|
||||
setFormulaDisplaySegments([]);
|
||||
setFormulaValueSegments([]);
|
||||
setUserDirectInput(false);
|
||||
setFormulaSaveError(null);
|
||||
setRefStatsChangeNotice(null);
|
||||
}
|
||||
@@ -264,12 +302,22 @@ const FomulaDialog = ({ open, onOpenChange, data, trgtStatsCd, trgtStatsNm, onCo
|
||||
|
||||
useEffect(() => {
|
||||
if (open) {
|
||||
const str = data?.kornArtopnEqtnCn ?? '';
|
||||
const { display, value } = parseDisplayToSegments(str);
|
||||
setFormulaDisplaySegments(display);
|
||||
setFormulaValueSegments(value);
|
||||
const raw = data?.kornArtopnEqtnCn ?? '';
|
||||
const wasBacktickWrapped =
|
||||
raw.length >= 2 && raw.startsWith("`") && raw.endsWith("`");
|
||||
const str = stripBacktickWrap(raw);
|
||||
if (wasBacktickWrapped && allowLikeDirectInput) {
|
||||
setFormulaDisplaySegments(str ? [str] : []);
|
||||
setFormulaValueSegments(str ? [str] : []);
|
||||
setUserDirectInput(true);
|
||||
} else {
|
||||
const { display, value } = parseDisplayToSegments(str);
|
||||
setFormulaDisplaySegments(display);
|
||||
setFormulaValueSegments(value);
|
||||
setUserDirectInput(false);
|
||||
}
|
||||
}
|
||||
}, [open, data?.kornArtopnEqtnCn, data?.vrfcDtlSn]);
|
||||
}, [open, data?.kornArtopnEqtnCn, data?.vrfcDtlSn, allowLikeDirectInput]);
|
||||
|
||||
/**
|
||||
* 재오픈 직후에는 columnInfo가 아직 없어서 parseDisplayToSegments가 컬럼명을 매칭 못하고
|
||||
@@ -278,8 +326,8 @@ const FomulaDialog = ({ open, onOpenChange, data, trgtStatsCd, trgtStatsNm, onCo
|
||||
* engColNm 치환이 반영되도록 보정한다.
|
||||
*/
|
||||
useEffect(() => {
|
||||
if (!open) return;
|
||||
const src = data?.kornArtopnEqtnCn ?? '';
|
||||
if (!open || isUserDirectInputMode) return;
|
||||
const src = stripBacktickWrap(data?.kornArtopnEqtnCn ?? '');
|
||||
if (!src) return;
|
||||
|
||||
const displayJoined = formulaDisplaySegments.join('');
|
||||
@@ -318,12 +366,14 @@ const FomulaDialog = ({ open, onOpenChange, data, trgtStatsCd, trgtStatsNm, onCo
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!open || columnInfo?.kornArtopnEqtnCn == null) return;
|
||||
if (data?.kornArtopnEqtnCn !== columnInfo.kornArtopnEqtnCn) return;
|
||||
const { display, value } = parseDisplayToSegments(columnInfo.kornArtopnEqtnCn);
|
||||
if (!open || isUserDirectInputMode || columnInfo?.kornArtopnEqtnCn == null) return;
|
||||
const strippedColumn = stripBacktickWrap(columnInfo.kornArtopnEqtnCn);
|
||||
const strippedData = stripBacktickWrap(data?.kornArtopnEqtnCn ?? "");
|
||||
if (strippedData !== strippedColumn) return;
|
||||
const { display, value } = parseDisplayToSegments(strippedColumn);
|
||||
setFormulaDisplaySegments(display);
|
||||
setFormulaValueSegments(value);
|
||||
}, [open, data?.kornArtopnEqtnCn, columnInfo?.kornArtopnEqtnCn]);
|
||||
}, [open, data?.kornArtopnEqtnCn, columnInfo?.kornArtopnEqtnCn, isUserDirectInputMode]);
|
||||
|
||||
const handleChangeRefStatsCd = (next: string) => {
|
||||
if (!open) return;
|
||||
@@ -360,6 +410,7 @@ const FomulaDialog = ({ open, onOpenChange, data, trgtStatsCd, trgtStatsNm, onCo
|
||||
if (!nextOpen) {
|
||||
setFormulaDisplaySegments([]);
|
||||
setFormulaValueSegments([]);
|
||||
setUserDirectInput(false);
|
||||
setFormulaSaveError(null);
|
||||
setSelectedColumnInfo(null);
|
||||
setRefStatsCdLocal('');
|
||||
@@ -463,20 +514,44 @@ const FomulaDialog = ({ open, onOpenChange, data, trgtStatsCd, trgtStatsNm, onCo
|
||||
</div>
|
||||
</div>
|
||||
<div className="w-full flex flex-col gap-2">
|
||||
<h3 className="font-bold text-title text-[14px]">수식 미리보기</h3>
|
||||
<div className="flex items-center gap-3">
|
||||
<h3 className="font-bold text-title text-[14px]">수식 미리보기</h3>
|
||||
{allowLikeDirectInput && (
|
||||
<label className="flex items-center gap-2 text-[13px] text-gray-700 cursor-pointer select-none">
|
||||
<Checkbox
|
||||
id="userDirectInput"
|
||||
checked={userDirectInput}
|
||||
onCheckedChange={(checked) =>
|
||||
handleUserDirectInputChange(checked === true)
|
||||
}
|
||||
/>
|
||||
사용자 직접 입력
|
||||
</label>
|
||||
)}
|
||||
</div>
|
||||
<Textarea
|
||||
className="w-full flex-1 bg-gray-100 resize-none !text-3xl p-4 !leading-loose text-gray-600 font-bold"
|
||||
className={`w-full flex-1 resize-none !text-3xl p-4 !leading-loose font-bold ${
|
||||
isUserDirectInputMode
|
||||
? "bg-white text-gray-900"
|
||||
: "bg-gray-100 text-gray-600"
|
||||
}`}
|
||||
id="formulaDisplayInput"
|
||||
ref={formulaTextareaRef}
|
||||
value={formulaDisplaySegments.join('')}
|
||||
onChange={(e) => {
|
||||
setFormulaSaveError(null);
|
||||
if (isUserDirectInputMode) {
|
||||
const raw = e.target.value;
|
||||
setFormulaDisplaySegments(raw ? [raw] : []);
|
||||
setFormulaValueSegments(raw ? [raw] : []);
|
||||
return;
|
||||
}
|
||||
const { display, value } = parseDisplayToSegments(e.target.value);
|
||||
setFormulaDisplaySegments(display);
|
||||
setFormulaValueSegments(value);
|
||||
}}
|
||||
rows={4}
|
||||
readOnly
|
||||
readOnly={!isUserDirectInputMode}
|
||||
/>
|
||||
{formulaSaveError && (
|
||||
<p className="text-sm text-red-600 mt-1" role="alert">
|
||||
@@ -516,6 +591,7 @@ const FomulaDialog = ({ open, onOpenChange, data, trgtStatsCd, trgtStatsNm, onCo
|
||||
value={c.engColNm}
|
||||
size="sm"
|
||||
color="lightGray"
|
||||
disabled={isUserDirectInputMode}
|
||||
onClick={() => handleFormulaColumn(c.kornColNm, c.engColNm)}
|
||||
>
|
||||
{c.kornColNm}
|
||||
@@ -558,6 +634,7 @@ const FomulaDialog = ({ open, onOpenChange, data, trgtStatsCd, trgtStatsNm, onCo
|
||||
type="button"
|
||||
value={t.engColNm}
|
||||
size="sm"
|
||||
disabled={isUserDirectInputMode}
|
||||
onClick={() => handleFormulaColumn(t.kornColNm, t.engColNm)}
|
||||
>
|
||||
{t.kornColNm}
|
||||
@@ -619,6 +696,7 @@ const FomulaDialog = ({ open, onOpenChange, data, trgtStatsCd, trgtStatsNm, onCo
|
||||
value={r.engColNm}
|
||||
size="sm"
|
||||
color="sky"
|
||||
disabled={isUserDirectInputMode}
|
||||
onClick={() => handleFormulaColumn(r.kornColNm, r.engColNm)}
|
||||
>
|
||||
{r.kornColNm}
|
||||
@@ -636,6 +714,23 @@ const FomulaDialog = ({ open, onOpenChange, data, trgtStatsCd, trgtStatsNm, onCo
|
||||
size="lg"
|
||||
type="button"
|
||||
onClick={() => {
|
||||
if (isUserDirectInputMode) {
|
||||
setFormulaSaveError(null);
|
||||
const raw = formulaDisplaySegments.join("");
|
||||
const wrapped = wrapWithBacktick(raw);
|
||||
const isEmptyFormula = raw.trim().length === 0;
|
||||
onConfirm?.({
|
||||
kornArtopnEqtnCn: isEmptyFormula ? raw : wrapped,
|
||||
engArtopnEqtnCn: isEmptyFormula ? raw : wrapped,
|
||||
refStatsCd: isEmptyFormula
|
||||
? null
|
||||
: refStatsCdLocal
|
||||
? refStatsCdLocal
|
||||
: null,
|
||||
});
|
||||
onOpenChange?.(false);
|
||||
return;
|
||||
}
|
||||
const err = validateFormulaForSave(formulaValueSegments);
|
||||
if (err) {
|
||||
setFormulaSaveError(err);
|
||||
|
||||
+13
-2
@@ -27,6 +27,14 @@ const zoneClassName: Record<ClauseZone, string> = {
|
||||
"zone-result": "bg-[#fff4ea]",
|
||||
};
|
||||
|
||||
/** 저장용 백틱 래핑은 숨기고 사용자에게만 표시 */
|
||||
const stripBacktickWrap = (value: string) => {
|
||||
if (value.length >= 2 && value.startsWith("`") && value.endsWith("`")) {
|
||||
return value.slice(1, -1);
|
||||
}
|
||||
return value;
|
||||
};
|
||||
|
||||
const FormulaComponents = ({
|
||||
data,
|
||||
index,
|
||||
@@ -38,6 +46,9 @@ const FormulaComponents = ({
|
||||
handleFomulaDialog,
|
||||
}: FormulaComponentsProps) => {
|
||||
const cmprOpert = data?.cmprOpert;
|
||||
const displayFormula = data
|
||||
? stripBacktickWrap(data.kornArtopnEqtnCn ?? "")
|
||||
: "";
|
||||
|
||||
return (
|
||||
<div
|
||||
@@ -56,8 +67,8 @@ const FormulaComponents = ({
|
||||
className="h-[3.6rem] flex-1 !cursor-pointer rounded-md border-[#d8dce3] text-[13px]"
|
||||
placeholder="클릭하여 수식을 등록해주세요."
|
||||
id={`formulaInput-${index ?? 0}`}
|
||||
value={data ? data.kornArtopnEqtnCn : ""}
|
||||
title={data ? data.kornArtopnEqtnCn : ""}
|
||||
value={displayFormula}
|
||||
title={displayFormula}
|
||||
onClick={() => handleFomulaDialog?.(true, data, index)}
|
||||
readOnly
|
||||
/>
|
||||
|
||||
+34
-9
@@ -16,16 +16,24 @@ type OperatorItem = {
|
||||
opertKornNm: string;
|
||||
};
|
||||
|
||||
// opertSeCd 별 operators 목록을 전역 캐싱해서, 수식 블록이 여러 개여도 중복 요청이 발생하지 않게 한다.
|
||||
const operatorsCache: Map<
|
||||
string,
|
||||
OperatorItem[] | Promise<OperatorItem[]>
|
||||
> = new Map();
|
||||
|
||||
interface OperatorsComponentsProps {
|
||||
cmprOpert?: string | null;
|
||||
onValueChange?: (value: string) => void;
|
||||
placeholder?: string;
|
||||
opertSeCd?: string;
|
||||
}
|
||||
|
||||
const OperatorsComponents = ({
|
||||
cmprOpert,
|
||||
onValueChange,
|
||||
placeholder = "연산자 없음",
|
||||
opertSeCd = "opertSeCd=CMPR"
|
||||
}: OperatorsComponentsProps) => {
|
||||
const [operators, setOperators] = useState<OperatorItem[]>([]);
|
||||
const [localValue, setLocalValue] = useState<string>(cmprOpert ?? "");
|
||||
@@ -35,14 +43,31 @@ const OperatorsComponents = ({
|
||||
}, [cmprOpert]);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchOperators = async () => {
|
||||
const response = await generalverificationApiService.getVrfcOperators();
|
||||
if (response.status === 'success' && response.data) {
|
||||
setOperators(response.data);
|
||||
}
|
||||
};
|
||||
fetchOperators();
|
||||
}, []);
|
||||
const cached = operatorsCache.get(opertSeCd);
|
||||
if (Array.isArray(cached)) {
|
||||
setOperators(cached);
|
||||
return;
|
||||
}
|
||||
|
||||
const promise =
|
||||
cached ??
|
||||
(async (): Promise<OperatorItem[]> => {
|
||||
const response =
|
||||
await generalverificationApiService.getVrfcOperators(
|
||||
opertSeCd,
|
||||
);
|
||||
if (response.status === "success" && response.data) {
|
||||
return response.data as OperatorItem[];
|
||||
}
|
||||
return [];
|
||||
})();
|
||||
|
||||
operatorsCache.set(opertSeCd, promise);
|
||||
void promise.then((items) => {
|
||||
operatorsCache.set(opertSeCd, items);
|
||||
setOperators(items);
|
||||
});
|
||||
}, [opertSeCd]);
|
||||
|
||||
// onValueChange가 있으면 부모가 제어(controlled), 없으면 내부 state로 표시
|
||||
const isControlled = onValueChange !== undefined;
|
||||
@@ -73,4 +98,4 @@ const OperatorsComponents = ({
|
||||
);
|
||||
};
|
||||
|
||||
export default OperatorsComponents;
|
||||
export default OperatorsComponents;
|
||||
|
||||
Reference in New Issue
Block a user