Merge remote-tracking branch 'origin/iipbs/st/dev'
Deploy Frontend / deploy (push) Successful in 4m46s
Deploy Frontend / deploy (push) Successful in 4m46s
This commit is contained in:
@@ -175,7 +175,7 @@ const PublicSewageFacilityInp = () => {
|
||||
const searchDoneRef = useRef(false);
|
||||
/** ST00060001만: RealGrid 편집값이 state에 없을 수 있어 저장/제출 시 그리드에서 직접 읽음 */
|
||||
const st60001GridGetRowsRef = useRef<(() => Record<string, string | number>[]) | null>(null);
|
||||
|
||||
|
||||
const submitFunc = () => {
|
||||
void (async () => {
|
||||
if (activeTab !== 'ST00060001') {
|
||||
@@ -891,7 +891,11 @@ const PublicSewageFacilityInp = () => {
|
||||
alert(response.message || '매핑 대상 조회 중 오류가 발생했습니다.');
|
||||
return;
|
||||
}
|
||||
const mappedTargetRows = (response.data ?? []).map((item) => ({
|
||||
const rawList = response.data ?? [];
|
||||
if (rawList.length === 0) {
|
||||
alert('해당 시설은 중심처리시설의 위탁시설로 연결되어있습니다.');
|
||||
}
|
||||
const mappedTargetRows = rawList.map((item) => ({
|
||||
...item,
|
||||
__checked: item.mappedYn === 'Y' ? 'Y' : '',
|
||||
}));
|
||||
@@ -961,7 +965,7 @@ const PublicSewageFacilityInp = () => {
|
||||
onValuesChange={setSearchValues}
|
||||
/>
|
||||
{showActionToolbarCard && (
|
||||
<div className="card !py-0">
|
||||
<div className="card !py-0">
|
||||
<div className="flex justify-end items-center gap-[0.6rem] mx-[0.6rem]">
|
||||
<VerificationResultButton
|
||||
VerificationResultButtonFunc={openVerificationHistoryDialog}
|
||||
@@ -969,8 +973,8 @@ const PublicSewageFacilityInp = () => {
|
||||
{showEnterableToolbarButtons && !isMainFacilityTab && (
|
||||
<>
|
||||
{showIsNotApplicable && <NotApplicableCheckButton isCheck={isNotApplicable} setIsCheck={setIsNotApplicable} />}
|
||||
<UpdateOperateDataButton updateOperateDataButtonFunc={updateOperateDataButtonFunc} />
|
||||
<SubmitButton submitFunc={submitFunc} />
|
||||
<UpdateOperateDataButton updateOperateDataButtonFunc={updateOperateDataButtonFunc} />
|
||||
<SubmitButton submitFunc={submitFunc} />
|
||||
</>
|
||||
)}
|
||||
{!isMainFacilityTab && activeTabStatus?.laeSbmsnSttsCd === '2' && (
|
||||
@@ -985,7 +989,7 @@ const PublicSewageFacilityInp = () => {
|
||||
<div className="relative size-[5rem]">
|
||||
<LoadingWithAnimation color="primary" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<Tabs value={activeTab} onValueChange={(v) => void handleActiveTabChange(v)}>
|
||||
<TabsList>
|
||||
|
||||
@@ -196,10 +196,10 @@ const SEWAGE_PIPE_COLUMN_GUIDE_TAB_KEYS = Array.from(
|
||||
new Set(SewagePipeInpColumnInfoList.map((tab) => tab.tabKey).filter(Boolean)),
|
||||
);
|
||||
|
||||
function hasRegionalFactVerificationErrors(verification?: SeweragePipeInputVerificationResult | null): boolean {
|
||||
if (!verification) return false;
|
||||
return Object.values(verification).some((errors) => Array.isArray(errors) && errors.length > 0);
|
||||
}
|
||||
// function hasRegionalFactVerificationErrors(verification?: SeweragePipeInputVerificationResult | null): boolean {
|
||||
// if (!verification) return false;
|
||||
// return Object.values(verification).some((errors) => Array.isArray(errors) && errors.length > 0);
|
||||
// }
|
||||
|
||||
const sleep = (ms: number) => new Promise<void>((resolve) => setTimeout(resolve, ms));
|
||||
|
||||
@@ -841,27 +841,27 @@ const SewagePipeInp = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const getTabGridRowsForVerification = (tabKey: string): Record<string, string | number>[] => {
|
||||
switch (tabKey) {
|
||||
case "ST00020001":
|
||||
return getGridDataRef.current?.() ?? [];
|
||||
case "ST00020002":
|
||||
return getFactInstallGridDataRef.current?.() ?? [];
|
||||
case "ST00020003":
|
||||
return getPipeTypeGridDataRef.current?.() ?? [];
|
||||
case "ST00020004":
|
||||
return getPipeDiameterGridDataRef.current?.() ?? [];
|
||||
case "ST00020005":
|
||||
return getManholeGridDataRef.current?.() ?? [];
|
||||
case "ST00020006":
|
||||
return [
|
||||
...(rowDataMap.get("treatmentPlantConnectionInp") ?? []),
|
||||
...(rowDataMap.get("adminAreaConnectionInp") ?? []),
|
||||
];
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
};
|
||||
// const getTabGridRowsForVerification = (tabKey: string): Record<string, string | number>[] => {
|
||||
// switch (tabKey) {
|
||||
// case "ST00020001":
|
||||
// return getGridDataRef.current?.() ?? [];
|
||||
// case "ST00020002":
|
||||
// return getFactInstallGridDataRef.current?.() ?? [];
|
||||
// case "ST00020003":
|
||||
// return getPipeTypeGridDataRef.current?.() ?? [];
|
||||
// case "ST00020004":
|
||||
// return getPipeDiameterGridDataRef.current?.() ?? [];
|
||||
// case "ST00020005":
|
||||
// return getManholeGridDataRef.current?.() ?? [];
|
||||
// case "ST00020006":
|
||||
// return [
|
||||
// ...(rowDataMap.get("treatmentPlantConnectionInp") ?? []),
|
||||
// ...(rowDataMap.get("adminAreaConnectionInp") ?? []),
|
||||
// ];
|
||||
// default:
|
||||
// return [];
|
||||
// }
|
||||
// };
|
||||
|
||||
const SubmitExceptionFunc = async (submitInfo: StatisticsInputSubmitInfoFormData) => {
|
||||
const tabKey = activeTabRef.current;
|
||||
@@ -903,7 +903,7 @@ const SewagePipeInp = () => {
|
||||
};
|
||||
|
||||
const submitFunc = async (isException: boolean) => {
|
||||
const tabKey = activeTabRef.current;
|
||||
// const tabKey = activeTabRef.current;
|
||||
const verificationBlocked = getVerificationPeriodActionBlockedMessage(periodCheckList);
|
||||
if (verificationBlocked) {
|
||||
alert(verificationBlocked);
|
||||
|
||||
@@ -211,7 +211,7 @@ const SewagePipeMaintainInp = () => {
|
||||
if (!job) return;
|
||||
postVerificationSearchRef.current = null;
|
||||
void handleSearch(job.values, { forcedTabKey: job.tabKey });
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps -- 검색폼 remount 직후 1회 자동 조회
|
||||
|
||||
}, [searchFormRemountKey]);
|
||||
|
||||
const handleActiveTabChange = async (tabKey: string) => {
|
||||
|
||||
@@ -60,10 +60,10 @@ type GridRowWithVerification = Record<string, string | number> & {
|
||||
/** 컬럼 가이드 API 조회용 통계코드 (하수도 보급률) */
|
||||
const SEWERAGE_PENETRATION_COLUMN_GUIDE_STATS_CD = "ST00010001";
|
||||
|
||||
const hasVerificationErrors = (verification?: SewerageSupplyRateVerificationResult | null): boolean => {
|
||||
if (!verification) return false;
|
||||
return Object.values(verification).some((errors) => Array.isArray(errors) && errors.length > 0);
|
||||
};
|
||||
// const hasVerificationErrors = (verification?: SewerageSupplyRateVerificationResult | null): boolean => {
|
||||
// if (!verification) return false;
|
||||
// return Object.values(verification).some((errors) => Array.isArray(errors) && errors.length > 0);
|
||||
// };
|
||||
|
||||
const sleep = (ms: number) => new Promise<void>((resolve) => setTimeout(resolve, ms));
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
|
||||
import { RealGridReact } from "realgrid-react";
|
||||
import useSWR, { useSWRConfig } from "swr";
|
||||
@@ -6,16 +6,26 @@ import useSWR, { useSWRConfig } from "swr";
|
||||
import { useAlertStore } from "@/shared/lib";
|
||||
import { statisticsInputSewSupplyRateApi } from "@/entities/statistics/api/input/statistics-input-sew-supply-rate-service";
|
||||
import { StatisticsInputStatusApi } from "@/entities/statistics/api/input/statistics-input-status-service";
|
||||
import { statisticsApi } from "@/entities/statistics/api/statistics-service";
|
||||
import {
|
||||
isInputPeriodCurrent,
|
||||
type CheckInputPeriodItem,
|
||||
} from "@/entities/statistics/model/input/statistics-sewage-supply-rate-input-interface";
|
||||
import type { StatsInputStatusListRequestParams } from "@/entities/statistics/model/input/statistics-input-status-interface";
|
||||
import type { StatsInputStatusListApiResponse } from "@/entities/statistics/model/input/statistics-input-status-interface";
|
||||
import type { StatsInputStatusApproveItem } from "@/entities/statistics/model/statistics-interface";
|
||||
import type {
|
||||
StatsInputStatusListApiResponse,
|
||||
StatsInputStatusListRequestParams,
|
||||
} from "@/entities/statistics/model/input/statistics-input-status-interface";
|
||||
import { getUserInfo } from "../../../../../../packages/common/components/src/api";
|
||||
import { LoadingWithAnimation } from "@common/components";
|
||||
|
||||
import ApproveButton from "@/components/button/ApproveButton";
|
||||
import DataGrid from "@/components/module/DataGrid";
|
||||
import type { DataCellClickCallbackParams } from "@/components/type/DataGrid.type";
|
||||
import {
|
||||
ExceptionProcessingHistoryDialog,
|
||||
type ExceptionProcessingHistoryQueryContext,
|
||||
} from "@/components/module/ExceptionProcessingHistoryDialog";
|
||||
import SearchForm from "@/components/module/SearchForm";
|
||||
import type { SearchFormValues } from "@/components/type/SearchForm.type";
|
||||
import { doList } from "@/components/util/column/input/DoList";
|
||||
@@ -44,6 +54,10 @@ const StatsInputStatusInp = () => {
|
||||
const periodCheckListRef = useRef<CheckInputPeriodItem[]>([]);
|
||||
const inputPeriodCurrentRef = useRef(false);
|
||||
const gridRef = useRef<RealGridReact | null>(null);
|
||||
const [exceptionHistoryOpen, setExceptionHistoryOpen] = useState(false);
|
||||
const [exceptionHistoryContext, setExceptionHistoryContext] = useState<
|
||||
ExceptionProcessingHistoryQueryContext | null
|
||||
>(null);
|
||||
|
||||
const swrKey = searchParams
|
||||
? (["stats-input-status", searchParams] as const)
|
||||
@@ -56,7 +70,12 @@ const StatsInputStatusInp = () => {
|
||||
revalidateOnFocus: true,
|
||||
onSuccess: (data) => {
|
||||
if (data.status === "success" && data.data) {
|
||||
setRowData(toGridRows(data.data));
|
||||
setRowData(
|
||||
toGridRows(data.data).map((r) => ({
|
||||
...r,
|
||||
exceptionSubmitHistory: "예외제출내역",
|
||||
})),
|
||||
);
|
||||
setHasCompletedSearch(true);
|
||||
} else {
|
||||
setHasCompletedSearch(false);
|
||||
@@ -119,29 +138,104 @@ const StatsInputStatusInp = () => {
|
||||
setHasCompletedSearch(false);
|
||||
periodCheckListRef.current = [];
|
||||
inputPeriodCurrentRef.current = false;
|
||||
setExceptionHistoryOpen(false);
|
||||
setExceptionHistoryContext(null);
|
||||
};
|
||||
|
||||
const approveFunc = () => {
|
||||
const checkedRows =
|
||||
gridRef.current?.gridView?.getCheckedRows?.(true, false, true) ?? [];
|
||||
|
||||
if (rowData.length === 0 || checkedRows.length !== rowData.length) {
|
||||
alert('모든 통계 항목을 체크해주세요.');
|
||||
const approveFunc = async () => {
|
||||
if (rowData.length === 0) {
|
||||
alert("조회된 통계 항목이 없습니다.");
|
||||
return;
|
||||
}
|
||||
if (!lastSearchedValues?.year?.trim() || !lastSearchedValues?.bsnmCd?.trim()) {
|
||||
alert("먼저 조회를 진행해주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
const hasInvalidStatus = rowData.some((row) =>
|
||||
["0", "1", "4"].includes(String(row.laeSbmsnSttsCd ?? "")),
|
||||
);
|
||||
// const hasInvalidStatus = rowData.some((row) =>
|
||||
// ["0", "1", "4"].includes(String(row.laeSbmsnSttsCd ?? "")),
|
||||
// );
|
||||
|
||||
if (hasInvalidStatus) {
|
||||
alert("미작성이나 미제출, 혹은 보완요청(반려) 상태인 항목이 있습니다.");
|
||||
return;
|
||||
// if (hasInvalidStatus) {
|
||||
// alert("미작성이나 미제출, 혹은 보완요청(반려) 상태인 항목이 있습니다.");
|
||||
// return;
|
||||
// }
|
||||
|
||||
try {
|
||||
const userInfo = await getUserInfo();
|
||||
const mdfrId = (userInfo.userUnqId ?? "").trim();
|
||||
if (!mdfrId) {
|
||||
alert("수정자 ID를 확인할 수 없습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
const statsYr = lastSearchedValues.year.trim();
|
||||
const sewerBzmnCdDefault = lastSearchedValues.bsnmCd.trim();
|
||||
|
||||
const approveItems: StatsInputStatusApproveItem[] = rowData
|
||||
.map((row) => {
|
||||
const statsCd = String(row.statsCd ?? "").trim();
|
||||
const sewerBzmnCd = String(row.sewerBzmnCd ?? sewerBzmnCdDefault).trim();
|
||||
return { statsYr, sewerBzmnCd, statsCd, mdfrId };
|
||||
})
|
||||
.filter((item) => item.statsCd.length > 0);
|
||||
|
||||
if (approveItems.length === 0) {
|
||||
alert("통계 코드(statsCd)가 있는 행이 없습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
const response = await statisticsApi.approveStatsInputStatus({ list: approveItems }, "INPUT");
|
||||
if (response.status === "success") {
|
||||
if (searchParams) {
|
||||
await mutate(["stats-input-status", searchParams]);
|
||||
}
|
||||
alert(response.message ?? "승인되었습니다.");
|
||||
} else {
|
||||
alert(response.message ?? "승인에 실패했습니다.");
|
||||
}
|
||||
} catch {
|
||||
alert("승인 처리 중 오류가 발생했습니다.");
|
||||
}
|
||||
|
||||
// 승인 요청 로직
|
||||
};
|
||||
|
||||
const openExceptionHistoryForRow = useCallback(
|
||||
(row: Record<string, string | number>) => {
|
||||
const ctx = lastSearchedValues;
|
||||
if (!ctx?.year || !ctx?.sido || !ctx?.bsnmCd) {
|
||||
alert("먼저 조회를 진행해주세요.");
|
||||
return;
|
||||
}
|
||||
const statsCd = String(row.statsCd ?? "").trim();
|
||||
if (!statsCd) {
|
||||
alert("통계 코드가 없어 예외처리 내역을 조회할 수 없습니다.");
|
||||
return;
|
||||
}
|
||||
setExceptionHistoryContext({
|
||||
statsYr: ctx.year ?? "",
|
||||
sewerBzmnCd: ctx.bsnmCd ?? "",
|
||||
ctpvNm: ctx.sido ?? "",
|
||||
sggNm: ctx.gugun === "ALL" ? "" : (ctx.gugun ?? ""),
|
||||
statsCd,
|
||||
});
|
||||
setExceptionHistoryOpen(true);
|
||||
},
|
||||
[alert, lastSearchedValues],
|
||||
);
|
||||
|
||||
const handleExceptionSubmitHistoryCellClick = useCallback(
|
||||
({ fieldName, row }: DataCellClickCallbackParams) => {
|
||||
if (fieldName !== "exceptionSubmitHistory") return;
|
||||
openExceptionHistoryForRow(row);
|
||||
},
|
||||
[openExceptionHistoryForRow],
|
||||
);
|
||||
|
||||
const handleExceptionHistoryRejectSuccess = useCallback(async () => {
|
||||
if (!searchParams) return;
|
||||
await mutate(["stats-input-status", searchParams]);
|
||||
}, [mutate, searchParams]);
|
||||
|
||||
const gugunOkOrNotDoList = doList.includes(lastSearchedValues?.bsnmCd || "")
|
||||
? Boolean(lastSearchedValues?.gugun && lastSearchedValues.gugun !== "ALL")
|
||||
: true;
|
||||
@@ -173,8 +267,9 @@ const StatsInputStatusInp = () => {
|
||||
rowData={rowData}
|
||||
setRowData={setRowData}
|
||||
isExcelImport={false}
|
||||
showHeaderCheckbox={true}
|
||||
showHeaderCheckbox={false}
|
||||
getGridRef={gridRef}
|
||||
onDataCellClick={handleExceptionSubmitHistoryCellClick}
|
||||
cellStyleCallback={({ row, fieldName }) => {
|
||||
if (fieldName !== "laeSbmsnSttsNm") {
|
||||
return undefined;
|
||||
@@ -197,6 +292,12 @@ const StatsInputStatusInp = () => {
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<ExceptionProcessingHistoryDialog
|
||||
open={exceptionHistoryOpen}
|
||||
onOpenChange={setExceptionHistoryOpen}
|
||||
queryContext={exceptionHistoryContext}
|
||||
onRejectSuccess={handleExceptionHistoryRejectSuccess}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -8,7 +8,7 @@ import useSWR from "swr";
|
||||
import { useAlertStore } from "@/shared/lib";
|
||||
import { CodeSelectWithAll } from "@/entities/code";
|
||||
import { statisticsApi } from "@/entities/statistics/api/statistics-service";
|
||||
import type { StatisticsLogResponse } from "@/entities/statistics/model/statistics-interface";
|
||||
// import type { StatisticsLogResponse } from "@/entities/statistics/model/statistics-interface";
|
||||
import type {
|
||||
ApiResponse,
|
||||
SearchCondition,
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { useState, useMemo } from "react";
|
||||
import { useCallback, useMemo, useState } from "react";
|
||||
import { createColumnHelper, getCoreRowModel, useReactTable } from "@tanstack/react-table";
|
||||
|
||||
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 { doList } from "@/components/util/column/input/DoList";
|
||||
@@ -17,11 +18,17 @@ import {
|
||||
} from "@common/components";
|
||||
|
||||
import { useAlertStore } from "@/shared/lib";
|
||||
import { statisticsApi } from "@/entities/statistics/api/statistics-service";
|
||||
import type { 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 { ReviewHistoryResponse } from "@/entities/statistics/model/statistics-input-review-interface";
|
||||
import type {
|
||||
ReviewHistoryResponse,
|
||||
StatsInputStatusReviewItem,
|
||||
} from "@/entities/statistics/model/statistics-input-review-interface";
|
||||
import { toGridRows } from "@/components/util/grid/gridFunction";
|
||||
import type { SearchFormValues } from "@/components/type/SearchForm.type";
|
||||
import { getUserInfo } from "../../../../../../packages/common/components/src/api";
|
||||
|
||||
type ReviewHistoryRow = ReviewHistoryResponse["data"][number];
|
||||
|
||||
@@ -33,6 +40,17 @@ const checkSubmitStatusCd = (code: string) => {
|
||||
return code === '0' ? '미작성' : (code === '1' ? '작성중' : (code === '2' ? '제출완료' : (code === '3' ? '승인완료' : '보완요청')));
|
||||
};
|
||||
|
||||
const isStatsInputStatusRowApprovable = (row: Record<string, string | number>) =>
|
||||
String(row.submitStatusCd ?? "") === "3" && String(row.prvnStatusCd ?? "") === "2";
|
||||
|
||||
const mapSewerageListToGridRows = (rawList: StatsInputStatusReviewItem[]) =>
|
||||
rawList.map((r) => ({
|
||||
...r,
|
||||
prvnStatusNm: checkPrvnStatusCd(r.prvnStatusCd || "0"),
|
||||
submitStatusNm: checkSubmitStatusCd(r.submitStatusCd || "0"),
|
||||
reviewHistory: "검토이력",
|
||||
}));
|
||||
|
||||
// 하수도 통계 검토 00. 통계 입력 현황
|
||||
const StatsInputStatusRvw = () => {
|
||||
const { setMessage: alert } = useAlertStore((state) => state);
|
||||
@@ -113,13 +131,7 @@ const StatsInputStatusRvw = () => {
|
||||
|
||||
if (response.status === 'success' && response.data) {
|
||||
const rawList = response.data.sewerageInputList ?? [];
|
||||
const convertedData = rawList.map((r) => ({
|
||||
...r,
|
||||
prvnStatusNm: checkPrvnStatusCd(r.prvnStatusCd || '0'),
|
||||
submitStatusNm: checkSubmitStatusCd(r.submitStatusCd || '0')
|
||||
}));
|
||||
|
||||
setRowData(toGridRows(convertedData));
|
||||
setRowData(toGridRows(mapSewerageListToGridRows(rawList)));
|
||||
} else {
|
||||
setRowData([]);
|
||||
setHasCompletedSearch(false);
|
||||
@@ -136,39 +148,127 @@ const StatsInputStatusRvw = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const approveFunc = () => console.log('approveFunc');
|
||||
const approveFunc = async () => {
|
||||
if (rowData.length === 0) {
|
||||
alert("조회된 통계 항목이 없습니다.");
|
||||
return;
|
||||
}
|
||||
if (!lastSearchedValues?.year?.trim() || !lastSearchedValues?.bsnmCd?.trim()) {
|
||||
alert("먼저 조회를 진행해주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
// if (!rowData.every(isStatsInputStatusRowApprovable)) {
|
||||
// alert("지자체 진행상태가 승인완료이고 진행상태가 제출완료인 항목만 승인할 수 있습니다.");
|
||||
// return;
|
||||
// }
|
||||
|
||||
try {
|
||||
const userInfo = await getUserInfo();
|
||||
const mdfrId = (userInfo.userUnqId ?? "").trim();
|
||||
if (!mdfrId) {
|
||||
alert("수정자 ID를 확인할 수 없습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
const statsYr = lastSearchedValues.year.trim();
|
||||
const sewerBzmnCdDefault = lastSearchedValues.bsnmCd.trim();
|
||||
|
||||
const approveItems: StatsInputStatusApproveItem[] = rowData
|
||||
.map((row) => {
|
||||
const statsCd = String(row.statsCd ?? "").trim();
|
||||
const sewerBzmnCd = String(row.sewerBzmnCd ?? sewerBzmnCdDefault).trim();
|
||||
return { statsYr, sewerBzmnCd, statsCd, mdfrId };
|
||||
})
|
||||
.filter((item) => item.statsCd.length > 0);
|
||||
|
||||
if (approveItems.length === 0) {
|
||||
alert("통계 코드(statsCd)가 있는 행이 없습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
const response = await statisticsApi.approveStatsInputStatus({ list: approveItems }, "REVIEW");
|
||||
if (response.status === "success") {
|
||||
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 {
|
||||
/* 목록 갱신 실패는 별도 안내 없이 생략 */
|
||||
}
|
||||
alert(response.message ?? "승인되었습니다.");
|
||||
} else {
|
||||
alert(response.message ?? "승인에 실패했습니다.");
|
||||
}
|
||||
} catch {
|
||||
alert("승인 처리 중 오류가 발생했습니다.");
|
||||
}
|
||||
};
|
||||
|
||||
const gugunOkOrNotDoList = doList.includes(lastSearchedValues?.bsnmCd || "")
|
||||
? Boolean(lastSearchedValues?.gugun && lastSearchedValues.gugun !== "ALL")
|
||||
: true;
|
||||
|
||||
const allSubmitStatusApproved = useMemo(
|
||||
() =>
|
||||
rowData.length > 0 &&
|
||||
rowData.every((row) => String(row.submitStatusCd ?? "") === "3"),
|
||||
[rowData],
|
||||
);
|
||||
|
||||
const showActionToolbarCard =
|
||||
hasCompletedSearch && rowData.length > 0 && gugunOkOrNotDoList;
|
||||
hasCompletedSearch &&
|
||||
rowData.length > 0 &&
|
||||
gugunOkOrNotDoList &&
|
||||
!allSubmitStatusApproved;
|
||||
|
||||
const handleRowClick = async (row: Record<string, string | number>) => {
|
||||
setHistorySearchInfo({
|
||||
ctpvNm: String(row.ctpvNm ?? ""),
|
||||
sggNm: String(row.sggNm ?? ""),
|
||||
tabNm: String(row.tabNm ?? ""),
|
||||
});
|
||||
const params = {
|
||||
statsYr: searchedYear,
|
||||
sewerBzmnCd: String(row.sewerBzmnCd ?? ""),
|
||||
statsCd: String(row.statsCd ?? ""),
|
||||
};
|
||||
|
||||
try {
|
||||
const response = await statisticsManagementApi.getReviewHistory(params);
|
||||
|
||||
if (response.status === 'success') {
|
||||
setHistoryRowData(response.data);
|
||||
setReviewHistoryOpen(true);
|
||||
} else {
|
||||
alert(response.message || '검토 이력 조회 중 오류가 발생했습니다.');
|
||||
const openReviewHistoryForRow = useCallback(
|
||||
async (row: Record<string, string | number>) => {
|
||||
if (!searchedYear) {
|
||||
alert("먼저 조회를 진행해주세요.");
|
||||
return;
|
||||
}
|
||||
} catch {
|
||||
alert('검토 이력 조회 중 오류가 발생했습니다.');
|
||||
}
|
||||
};
|
||||
setHistorySearchInfo({
|
||||
ctpvNm: String(row.ctpvNm ?? ""),
|
||||
sggNm: String(row.sggNm ?? ""),
|
||||
tabNm: String(row.tabNm ?? ""),
|
||||
});
|
||||
const params = {
|
||||
statsYr: searchedYear,
|
||||
sewerBzmnCd: String(row.sewerBzmnCd ?? ""),
|
||||
statsCd: String(row.statsCd ?? ""),
|
||||
};
|
||||
|
||||
try {
|
||||
const response = await statisticsManagementApi.getReviewHistory(params);
|
||||
|
||||
if (response.status === "success") {
|
||||
setHistoryRowData(response.data);
|
||||
setReviewHistoryOpen(true);
|
||||
} else {
|
||||
alert(response.message || "검토 이력 조회 중 오류가 발생했습니다.");
|
||||
}
|
||||
} catch {
|
||||
alert("검토 이력 조회 중 오류가 발생했습니다.");
|
||||
}
|
||||
},
|
||||
[alert, searchedYear],
|
||||
);
|
||||
|
||||
const handleReviewHistoryCellClick = useCallback(
|
||||
({ fieldName, row }: DataCellClickCallbackParams) => {
|
||||
if (fieldName !== "reviewHistory") return;
|
||||
void openReviewHistoryForRow(row);
|
||||
},
|
||||
[openReviewHistoryForRow],
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="relative">
|
||||
@@ -193,12 +293,12 @@ const StatsInputStatusRvw = () => {
|
||||
<DataGrid
|
||||
columnInfo={columnInfo}
|
||||
isExcelImport={false}
|
||||
showHeaderCheckbox={true}
|
||||
showHeaderCheckbox={false}
|
||||
rowStartNum={2}
|
||||
fixedColumns={3}
|
||||
rowData={rowData}
|
||||
setRowData={setRowData}
|
||||
onRowClick={handleRowClick}
|
||||
onDataCellClick={handleReviewHistoryCellClick}
|
||||
cellStyleCallback={({ row, fieldName }) => {
|
||||
if (fieldName === "submitStatusNm") {
|
||||
const statusCd = String(row.submitStatusCd ?? "");
|
||||
|
||||
@@ -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 } from "@/components/util/column/total/SewagePipeTotColumn";
|
||||
import { SewagePipeColumnInfoListTot, getST00020003Config } 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";
|
||||
@@ -46,7 +46,6 @@ const SewagePipeTot = () => {
|
||||
lastSearchedValuesRef.current = null;
|
||||
};
|
||||
|
||||
/** SewagePipeInp의 `loadSewagePipeActiveTabData`와 동일 역할: 탭키별 API 호출 후 `rowDataMap` 반영 */
|
||||
const loadSewagePipeTotTabData = async (
|
||||
tabKey: string,
|
||||
values: SearchFormValues,
|
||||
@@ -107,7 +106,8 @@ const SewagePipeTot = () => {
|
||||
alert(response.message || "데이터 조회 중 오류가 발생했습니다.");
|
||||
return false;
|
||||
}
|
||||
if (tabKey === "ST00020005") {
|
||||
|
||||
if (tabKey === "ST00020005") {
|
||||
const response = await statisticsTotalStatusApi.getSewagePipePipeMnhleStatus(param);
|
||||
if (response.status === "success" && response.data) {
|
||||
applyRows(toGridRows(response.data as object[]));
|
||||
@@ -124,7 +124,6 @@ const SewagePipeTot = () => {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
|
||||
// SewagePipeInp과 동일: 검색 시 활성 탭 데이터만 조회·맵 병합
|
||||
let ok = false;
|
||||
if (
|
||||
activeTab === "ST00020001" ||
|
||||
@@ -175,8 +174,6 @@ const SewagePipeTot = () => {
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("[SewagePipeTot] tabKey (API 미연결):", tabKey);
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -206,22 +203,29 @@ const SewagePipeTot = () => {
|
||||
</TabsList>
|
||||
{columnInfo.map((info) => {
|
||||
const tabKey = info.tabKey;
|
||||
if (!info.columns || !info.columnLayout) {
|
||||
|
||||
// ★ [동적 처리] ST00020003인 경우 함수를 통해 컬럼 정보를 실시간으로 생성
|
||||
const currentYear = lastSearchedValuesRef.current?.year || new Date().getFullYear();
|
||||
const finalTabConfig = tabKey === "ST00020003"
|
||||
? getST00020003Config(currentYear)
|
||||
: info;
|
||||
|
||||
if (!finalTabConfig.columns || !finalTabConfig.columnLayout) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const rowData = rowDataMap.get(tabKey) ?? [];
|
||||
const gridColumnInfo: ColumnInfo = {
|
||||
columns: info.columns,
|
||||
columnLayout: info.columnLayout,
|
||||
columns: finalTabConfig.columns,
|
||||
columnLayout: finalTabConfig.columnLayout,
|
||||
};
|
||||
|
||||
return (
|
||||
<TabsContent key={tabKey} value={tabKey}>
|
||||
<DataGrid
|
||||
columnInfo={gridColumnInfo}
|
||||
rowStartNum={info.rowStartNum}
|
||||
excelExportFileSuffix={info.tabLabel || tabKey}
|
||||
rowStartNum={finalTabConfig.rowStartNum}
|
||||
excelExportFileSuffix={finalTabConfig.tabLabel || tabKey}
|
||||
rowData={rowData}
|
||||
setRowData={(updater) => {
|
||||
setRowDataMap((prev) => {
|
||||
@@ -236,7 +240,7 @@ const SewagePipeTot = () => {
|
||||
isExcelImport={false}
|
||||
isExcelExport
|
||||
showHeaderCheckbox={false}
|
||||
fixedColumns={info.fixedColumns}
|
||||
fixedColumns={finalTabConfig.fixedColumns}
|
||||
enableSort={false}
|
||||
cellStyleCallback={({ row }) => {
|
||||
const rowType = String(row.rowType ?? '');
|
||||
@@ -255,4 +259,4 @@ const SewagePipeTot = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default SewagePipeTot;
|
||||
export default SewagePipeTot;
|
||||
Reference in New Issue
Block a user