서버페이징 변경
This commit is contained in:
@@ -6,7 +6,7 @@ import {
|
||||
postRawJson,
|
||||
putData,
|
||||
} from "@/components/lib/api";
|
||||
import { fetchAllPages } from "@/shared/lib/fetch-all-pages";
|
||||
import { requestGridExcel } from "@/shared/api/grid-export";
|
||||
import { isDredgingBackendEnabled } from "./backend-mode";
|
||||
import { toDredgingApiError } from "./dredging-error";
|
||||
import {
|
||||
@@ -28,6 +28,41 @@ import type {
|
||||
} from "../model/registration-request";
|
||||
export type { AttachmentReference } from "../model/registration-request";
|
||||
|
||||
/** 그리드는 0 기반 서버 페이지 하나만 요청한다. 지도·전체 다운로드는 별도 계약이다. */
|
||||
export type DredgingGridQuery = {
|
||||
viewType: string;
|
||||
fromDate: string;
|
||||
toDate: string;
|
||||
ctpv?: string;
|
||||
sgg?: string;
|
||||
page: number;
|
||||
size: number;
|
||||
sort?: string;
|
||||
};
|
||||
|
||||
export const fetchDredgingGridPage = async (query: DredgingGridQuery): Promise<{
|
||||
content: Array<Record<string, unknown> & { recordIds: string[] }>;
|
||||
totalElements: number;
|
||||
number: number;
|
||||
size: number;
|
||||
}> => {
|
||||
const params = new URLSearchParams();
|
||||
Object.entries(query).forEach(([key, value]) => {
|
||||
if (value !== undefined && value !== "") params.set(key, String(value));
|
||||
});
|
||||
const body = await getRawJson(`v1/dredging/grid?${params}`);
|
||||
return body?.data ?? body;
|
||||
};
|
||||
|
||||
/** 적용 조건 전체의 서버 XLSX를 받는다. page/size는 다운로드에 전달하지 않는다. */
|
||||
export const downloadDredgingGridExcel = (query: Omit<DredgingGridQuery, "page" | "size">): Promise<void> => {
|
||||
const params = new URLSearchParams();
|
||||
Object.entries(query).forEach(([key, value]) => {
|
||||
if (value !== undefined && value !== "") params.set(key, String(value));
|
||||
});
|
||||
return requestGridExcel(`v1/dredging/grid/exportJobs?${params}`, {}, `준설관리_${query.viewType}_${query.fromDate}_${query.toDate}.xlsx`);
|
||||
};
|
||||
|
||||
type LocationRequest = GeoPoint & {
|
||||
locationKey: string;
|
||||
};
|
||||
@@ -64,18 +99,6 @@ export const fetchDredgingRecords = async (params: {
|
||||
}
|
||||
};
|
||||
|
||||
/** 조회조건에 맞는 준설기록 전체 페이지를 순회해 목록·Excel 건수를 일치시킨다. */
|
||||
export const fetchAllDredgingRecords = async (params: {
|
||||
fromDate: string;
|
||||
toDate: string;
|
||||
ctpv?: string;
|
||||
sgg?: string;
|
||||
}) =>
|
||||
fetchAllPages({
|
||||
fetchPage: (page, size) => fetchDredgingRecords({ ...params, page, size }),
|
||||
getItems: (response) => response.items ?? [],
|
||||
getTotal: (response) => Number(response.total ?? 0),
|
||||
});
|
||||
|
||||
/** 등록된 준설사진의 공통 첨부파일 참조를 조회한다. */
|
||||
export const fetchDredgingPhotos = async (
|
||||
|
||||
@@ -12,9 +12,6 @@ import type {
|
||||
ExmnPipeReportAvailability,
|
||||
ExmnSectionSummaryRow,
|
||||
ExmnTemplateResult,
|
||||
PplFacility,
|
||||
PplFacilitySearchParams,
|
||||
PplSummaryRow,
|
||||
} from "../model/exmn-business-types";
|
||||
import {
|
||||
type ExmnDefectGroup,
|
||||
@@ -216,7 +213,34 @@ interface ExmnPplUnitDetailPayload {
|
||||
remark: string | null;
|
||||
}
|
||||
|
||||
const PPL_STATUS_LABELS: Record<string, string> = {
|
||||
/** 조사 상세 표의 0 기반 서버 페이지와 조건 전체 합계를 반환한다. */
|
||||
export const getExmnFacilityPage = async (params: {
|
||||
exmnBizId: string; jobType: ExmnJobType; trtdstId: string;
|
||||
gisManagementNo?: string; defectType: string; defectCodes: string;
|
||||
page: number; size: number; sort?: string;
|
||||
}): Promise<{ content: ExmnSurveyDetailRow[]; totalElements: number; summary: ExmnSurveyDetailRow }> => {
|
||||
const query = new URLSearchParams();
|
||||
Object.entries(params).forEach(([key, value]) => {
|
||||
if (value !== undefined && value !== "") query.set(key, String(value));
|
||||
});
|
||||
return unwrapData(await getData(`v1/exmnFacilities/page?${query}`));
|
||||
};
|
||||
|
||||
/** 관로·단위구간 병합을 보존한 서버 그룹 페이지를 화면 표시명으로 변환한다. */
|
||||
export const getExmnPplUnitPage = async (params: {
|
||||
exmnBizId: string; trtdstId: string; gisManagementNo?: string; page: number; size: number;
|
||||
}): Promise<{ content: ExmnPplUnitDetailRow[]; totalElements: number }> => {
|
||||
const query = new URLSearchParams();
|
||||
Object.entries(params).forEach(([key, value]) => {
|
||||
if (value !== undefined && value !== "") query.set(key, String(value));
|
||||
});
|
||||
const result = unwrapData<{ content: ExmnPplUnitDetailPayload[]; totalElements: number }>(
|
||||
await getData(`v1/exmnFacilities/pplUnitSections/page?${query}`),
|
||||
);
|
||||
return { ...result, content: result.content.map((row) => ({ ...row, defectName: getPplUnitDetailName(row) })) };
|
||||
};
|
||||
|
||||
export const PPL_STATUS_LABELS: Record<string, string> = {
|
||||
IS: "조사시작(순주행)",
|
||||
ISR: "조사시작(역주행)",
|
||||
IE: "조사완료(순주행)",
|
||||
@@ -366,47 +390,3 @@ export const commitExmnImport = async (
|
||||
`${EXMN_BUSINESS_API_PATH}/${encodeURIComponent(exmnBizId)}/imports/commit`,
|
||||
formData,
|
||||
) as Promise<ExmnImportCommitResult>;
|
||||
|
||||
/** 선택 사업의 처리분구별 PPL 집계를 조회한다. */
|
||||
export const getPplSummaries = async (
|
||||
exmnBizId: string,
|
||||
params: { trtdstId?: string; page: number; size: number; sort?: string },
|
||||
): Promise<ExmnPage<PplSummaryRow>> => {
|
||||
const summaries = await getExmnSectionSummaries(exmnBizId, "PPL");
|
||||
const filtered = params.trtdstId
|
||||
? summaries.filter((row) => row.trtdstId === params.trtdstId)
|
||||
: summaries;
|
||||
const start = Math.max(params.page, 0) * Math.max(params.size, 1);
|
||||
const size = Math.max(params.size, 1);
|
||||
return {
|
||||
content: filtered.slice(start, start + size),
|
||||
totalElements: filtered.length,
|
||||
number: Math.max(params.page, 0),
|
||||
size,
|
||||
totalPages: Math.ceil(filtered.length / size),
|
||||
};
|
||||
};
|
||||
|
||||
/** 선택 사업의 PPL 시설을 처리분구·구간·GIS번호·등급으로 조회한다. */
|
||||
export const getPplFacilities = async (
|
||||
params: PplFacilitySearchParams,
|
||||
): Promise<ExmnPage<PplFacility>> => {
|
||||
const query = new URLSearchParams({
|
||||
exmnBizId: params.exmnBizId,
|
||||
jobType: "PPL",
|
||||
page: String(params.page),
|
||||
size: String(params.size),
|
||||
});
|
||||
if (params.trtdstId) query.set("trtdstId", params.trtdstId);
|
||||
if (params.sectionType) query.set("sectionType", params.sectionType);
|
||||
if (params.gisManagementNo?.trim())
|
||||
query.set("gisManagementNo", params.gisManagementNo.trim());
|
||||
if (params.structuralGrade)
|
||||
query.set("structuralGrade", params.structuralGrade);
|
||||
if (params.operationalGrade)
|
||||
query.set("operationalGrade", params.operationalGrade);
|
||||
if (params.defectType && params.defectType !== "ALL")
|
||||
query.set("defectType", params.defectType);
|
||||
if (params.sort) query.set("sort", params.sort);
|
||||
return toPage<PplFacility>(await getData(`v1/exmnFacilities?${query}`));
|
||||
};
|
||||
|
||||
@@ -10,6 +10,17 @@ import type {
|
||||
/** 조사사업 공통 선행 처리분구 API의 기준 경로다. */
|
||||
const TRTDST_API_PATH = "v1/trtdstSettings";
|
||||
|
||||
/** 관리 그리드는 활성 처리분구 한 페이지만 조회한다. 등록 화면의 전체 선택지와 구분한다. */
|
||||
export const getTrtdstPage = async (params: {
|
||||
ctpvNm?: string; sggNm?: string; page: number; size: number; sort?: string;
|
||||
}): Promise<{ content: TrtdstSettingDto[]; totalElements: number }> => {
|
||||
const query = new URLSearchParams();
|
||||
Object.entries(params).forEach(([key, value]) => {
|
||||
if (value !== undefined && value !== "") query.set(key, String(value));
|
||||
});
|
||||
return getData(`${TRTDST_API_PATH}/page?${query}`);
|
||||
};
|
||||
|
||||
/** 선택된 행정구역 조건으로 활성 처리분구 목록을 조회한다. */
|
||||
export const getTrtdstSettings = async (
|
||||
params: TrtdstSearchParams,
|
||||
|
||||
@@ -1,291 +0,0 @@
|
||||
import { downloadExcelWithKoreanHeaders } from "@/shared/lib/download-excel";
|
||||
import {
|
||||
EXMN_DETAIL_SEVERITIES,
|
||||
type ExmnDetailSeverity,
|
||||
type ExmnDetailDefectColumn,
|
||||
type ExmnPplUnitDetailRow,
|
||||
type ExmnSurveyDetailRow,
|
||||
type ExmnSeverityCounts,
|
||||
} from "../model/exmn-detail-table";
|
||||
import { getVisibleAnomalyTotals } from "./exmn-detail-totals";
|
||||
|
||||
type ExmnDetailDownloadOptions = {
|
||||
selectedTrtdstNm: string;
|
||||
defectGroupTitle: string;
|
||||
isUnitMode: boolean;
|
||||
defectTypeLabel: string;
|
||||
unitRows: ExmnPplUnitDetailRow[];
|
||||
rows: ExmnSurveyDetailRow[];
|
||||
recordTypeLabels: Record<string, string>;
|
||||
pipeItemLabels: Record<string, string>;
|
||||
severityLabels: Record<ExmnDetailSeverity, string>;
|
||||
visibleDefectColumns: ExmnDetailDefectColumn[];
|
||||
totals: {
|
||||
extensionM: number;
|
||||
drivingDistanceM: number;
|
||||
structuralGrade: number;
|
||||
operationalGrade: number;
|
||||
};
|
||||
defectSummary: {
|
||||
anomalySubtotals: ExmnSeverityCounts;
|
||||
anomalyTotal: number;
|
||||
defectSubtotals: Record<string, ExmnSeverityCounts>;
|
||||
defectTotals: Record<string, number>;
|
||||
};
|
||||
summaryLabelColumnCount: number;
|
||||
fixedColumnCount: number;
|
||||
setNotice: (notice: { type: "info"; text: string } | null) => void;
|
||||
};
|
||||
|
||||
/** 가변 결함 열 수에 맞춰 엑셀의 마지막 열 이름(A, Z, AA 등)을 계산한다. */
|
||||
const getExcelColumnName = (columnCount: number) => {
|
||||
let remaining = columnCount;
|
||||
let result = "";
|
||||
while (remaining > 0) {
|
||||
remaining -= 1;
|
||||
result = String.fromCharCode(65 + (remaining % 26)) + result;
|
||||
remaining = Math.floor(remaining / 26);
|
||||
}
|
||||
return result || "A";
|
||||
};
|
||||
|
||||
/** 현재 조회·필터·표 순서의 조사 결과로 Excel 열·상세·소계·합계·병합을 구성한다. */
|
||||
export const downloadExmnSurveyDetails = async ({
|
||||
selectedTrtdstNm,
|
||||
defectGroupTitle,
|
||||
isUnitMode,
|
||||
defectTypeLabel,
|
||||
unitRows,
|
||||
rows,
|
||||
recordTypeLabels,
|
||||
pipeItemLabels,
|
||||
severityLabels,
|
||||
visibleDefectColumns,
|
||||
totals,
|
||||
defectSummary,
|
||||
summaryLabelColumnCount,
|
||||
fixedColumnCount,
|
||||
setNotice,
|
||||
}: ExmnDetailDownloadOptions) => {
|
||||
const downloadDate = new Date().toISOString().slice(0, 10);
|
||||
const safeFilePrefix = `${selectedTrtdstNm}_${defectGroupTitle}조사_${
|
||||
isUnitMode ? "본단위등급표" : defectTypeLabel
|
||||
}`.replace(/[\\/:*?"<>|]/g, "_");
|
||||
|
||||
try {
|
||||
if (isUnitMode) {
|
||||
if (unitRows.length === 0) {
|
||||
setNotice({
|
||||
type: "info",
|
||||
text: "다운로드할 본단위구간 데이터가 없습니다.",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const unitHeaderMapping: Record<string, string> = {
|
||||
pipeNo: "관로번호",
|
||||
unitSeq: "단위구간",
|
||||
unitLengthM: "단위길이(m)",
|
||||
defectPositionM: "결함위치(m)",
|
||||
defectName: "결함 종류",
|
||||
code: "결함 코드",
|
||||
severity: "결함 등급",
|
||||
occurrencePosition: "발생위치",
|
||||
infiltrationBonus: "침입수 가점",
|
||||
continuous: "연속결함",
|
||||
structuralScore: "구조적 등급점수",
|
||||
operationalScore: "운영적 등급점수",
|
||||
surveyStopReason: "조사중단사유",
|
||||
remark: "비고",
|
||||
};
|
||||
const unitDownloadRows = unitRows.map((row) => ({
|
||||
pipeNo: row.pipeNo,
|
||||
unitSeq: row.unitSeq,
|
||||
unitLengthM: row.unitLengthM,
|
||||
defectPositionM: row.defectPositionM,
|
||||
defectName: row.recordType
|
||||
? `(${recordTypeLabels[row.recordType] || row.recordType})${pipeItemLabels[row.code] || row.defectName.replace(/^\([^)]*\)/, "")}`
|
||||
: row.defectName,
|
||||
code: row.code,
|
||||
severity: row.severity ? severityLabels[row.severity] : "-",
|
||||
occurrencePosition: row.occurrencePosition,
|
||||
infiltrationBonus: row.infiltrationBonus,
|
||||
continuous: row.continuous == null ? "-" : row.continuous ? "Y" : "N",
|
||||
structuralScore: row.structuralScore ?? "-",
|
||||
operationalScore: row.operationalScore ?? "-",
|
||||
surveyStopReason: row.surveyStopReason ?? "-",
|
||||
remark: row.remark ?? "-",
|
||||
}));
|
||||
|
||||
await downloadExcelWithKoreanHeaders({
|
||||
data: unitDownloadRows as unknown as JSON[],
|
||||
fileName: `${safeFilePrefix}_${downloadDate}.xlsx`,
|
||||
sheetNameArray: ["본단위등급표"],
|
||||
headerRange: "A1:N1",
|
||||
headerMapping: unitHeaderMapping,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (rows.length === 0) {
|
||||
setNotice({
|
||||
type: "info",
|
||||
text: "다운로드할 상세현황 데이터가 없습니다.",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const detailHeaderMapping: Record<string, string> = {
|
||||
reportNo: "보고서번호",
|
||||
pipeNo: "관로번호",
|
||||
upstreamManhole: "상류맨홀",
|
||||
downstreamManhole: "하류맨홀",
|
||||
drainageType: "배수방식",
|
||||
pipeType: "관종",
|
||||
specification: "규격",
|
||||
extensionM: "연장(m)",
|
||||
drivingDistanceM: "주행거리(m)",
|
||||
};
|
||||
Object.assign(detailHeaderMapping, {
|
||||
structuralGrade: "구조적 내부결함",
|
||||
operationalGrade: "운영적 내부결함",
|
||||
});
|
||||
Object.assign(detailHeaderMapping, {
|
||||
anomalyL: "이상항목 합계-대",
|
||||
anomalyM: "이상항목 합계-중",
|
||||
anomalyS: "이상항목 합계-소",
|
||||
});
|
||||
visibleDefectColumns.forEach((column) => {
|
||||
EXMN_DETAIL_SEVERITIES.forEach((severity) => {
|
||||
detailHeaderMapping[`${column.code}_${severity}`] =
|
||||
`${column.label} (${column.code})-${severityLabels[severity]}`;
|
||||
});
|
||||
});
|
||||
|
||||
const detailDownloadRows: Record<string, string | number>[] = rows.map(
|
||||
(row) => {
|
||||
const anomalyTotals = getVisibleAnomalyTotals(
|
||||
row,
|
||||
visibleDefectColumns,
|
||||
);
|
||||
const result: Record<string, string | number> = {
|
||||
reportNo: row.reportNo,
|
||||
pipeNo: row.pipeNo,
|
||||
upstreamManhole: row.upstreamManhole,
|
||||
downstreamManhole: row.downstreamManhole,
|
||||
drainageType: row.drainageTypeName?.trim() || row.drainageType,
|
||||
pipeType: row.pipeTypeName?.trim() || row.pipeType,
|
||||
specification: row.specification,
|
||||
extensionM: row.extensionM,
|
||||
drivingDistanceM: row.drivingDistanceM,
|
||||
};
|
||||
Object.assign(result, {
|
||||
structuralGrade: row.structuralGrade,
|
||||
operationalGrade: row.operationalGrade,
|
||||
});
|
||||
Object.assign(result, {
|
||||
anomalyL: anomalyTotals.L,
|
||||
anomalyM: anomalyTotals.M,
|
||||
anomalyS: anomalyTotals.S,
|
||||
});
|
||||
visibleDefectColumns.forEach((column) => {
|
||||
EXMN_DETAIL_SEVERITIES.forEach((severity) => {
|
||||
result[`${column.code}_${severity}`] =
|
||||
row.defectCounts[column.code]?.[severity] ?? 0;
|
||||
});
|
||||
});
|
||||
return result;
|
||||
},
|
||||
);
|
||||
const subtotalRow: Record<string, string | number> = {
|
||||
reportNo: "소계",
|
||||
pipeNo: "",
|
||||
upstreamManhole: "",
|
||||
downstreamManhole: "",
|
||||
drainageType: "",
|
||||
pipeType: "",
|
||||
specification: "",
|
||||
extensionM: totals.extensionM,
|
||||
drivingDistanceM: totals.drivingDistanceM,
|
||||
};
|
||||
const totalRow: Record<string, string | number> = {
|
||||
reportNo: "합계",
|
||||
pipeNo: "",
|
||||
upstreamManhole: "",
|
||||
downstreamManhole: "",
|
||||
drainageType: "",
|
||||
pipeType: "",
|
||||
specification: "",
|
||||
extensionM: totals.extensionM,
|
||||
drivingDistanceM: totals.drivingDistanceM,
|
||||
};
|
||||
Object.assign(subtotalRow, {
|
||||
structuralGrade: totals.structuralGrade,
|
||||
operationalGrade: totals.operationalGrade,
|
||||
});
|
||||
Object.assign(totalRow, {
|
||||
structuralGrade: totals.structuralGrade,
|
||||
operationalGrade: totals.operationalGrade,
|
||||
});
|
||||
Object.assign(subtotalRow, {
|
||||
anomalyL: defectSummary.anomalySubtotals.L,
|
||||
anomalyM: defectSummary.anomalySubtotals.M,
|
||||
anomalyS: defectSummary.anomalySubtotals.S,
|
||||
});
|
||||
Object.assign(totalRow, {
|
||||
anomalyL: defectSummary.anomalyTotal,
|
||||
anomalyM: "",
|
||||
anomalyS: "",
|
||||
});
|
||||
visibleDefectColumns.forEach((column) => {
|
||||
EXMN_DETAIL_SEVERITIES.forEach((severity) => {
|
||||
subtotalRow[`${column.code}_${severity}`] =
|
||||
defectSummary.defectSubtotals[column.code]?.[severity] ?? 0;
|
||||
});
|
||||
totalRow[`${column.code}_L`] =
|
||||
defectSummary.defectTotals[column.code] ?? 0;
|
||||
totalRow[`${column.code}_M`] = "";
|
||||
totalRow[`${column.code}_S`] = "";
|
||||
});
|
||||
detailDownloadRows.push(subtotalRow, totalRow);
|
||||
|
||||
const subtotalExcelRow = rows.length + 2;
|
||||
const totalExcelRow = rows.length + 3;
|
||||
const summaryLabelLastColumn = getExcelColumnName(summaryLabelColumnCount);
|
||||
const mergeRanges = [
|
||||
`A${subtotalExcelRow}:${summaryLabelLastColumn}${subtotalExcelRow}`,
|
||||
`A${totalExcelRow}:${summaryLabelLastColumn}${totalExcelRow}`,
|
||||
];
|
||||
for (
|
||||
let groupStartColumn = fixedColumnCount + 1;
|
||||
groupStartColumn < Object.keys(detailHeaderMapping).length;
|
||||
groupStartColumn += EXMN_DETAIL_SEVERITIES.length
|
||||
) {
|
||||
mergeRanges.push(
|
||||
`${getExcelColumnName(groupStartColumn)}${totalExcelRow}:${getExcelColumnName(
|
||||
groupStartColumn + EXMN_DETAIL_SEVERITIES.length - 1,
|
||||
)}${totalExcelRow}`,
|
||||
);
|
||||
}
|
||||
|
||||
await downloadExcelWithKoreanHeaders({
|
||||
data: detailDownloadRows as unknown as JSON[],
|
||||
fileName: `${safeFilePrefix}_${downloadDate}.xlsx`,
|
||||
sheetNameArray: [
|
||||
`${defectGroupTitle}조사 ${defectTypeLabel}`.slice(0, 31),
|
||||
],
|
||||
headerRange: `A1:${getExcelColumnName(Object.keys(detailHeaderMapping).length)}1`,
|
||||
headerMapping: detailHeaderMapping,
|
||||
mergeRanges,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("조사 상세현황 엑셀 다운로드 오류:", error);
|
||||
setNotice({
|
||||
type: "info",
|
||||
text:
|
||||
error instanceof Error
|
||||
? error.message
|
||||
: "엑셀 다운로드 중 오류가 발생했습니다.",
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -6,7 +6,6 @@ import { useEffect, useMemo, useState } from "react";
|
||||
import {
|
||||
StandardPopupLayout,
|
||||
StandardTableSortHeader,
|
||||
sortStandardTableRows,
|
||||
type UiTableSort,
|
||||
} from "@common/business_components";
|
||||
import {
|
||||
@@ -20,15 +19,16 @@ import {
|
||||
SelectValue,
|
||||
Table,
|
||||
} from "@common/components";
|
||||
import { downloadExmnSurveyDetails } from "../lib/download-exmn-details";
|
||||
import { requestGridExcel } from "@/shared/api/grid-export";
|
||||
import { getVisibleAnomalyTotals } from "../lib/exmn-detail-totals";
|
||||
import PopupSearchPanel, {
|
||||
PopupSearchActions,
|
||||
} from "@/features/windowPopup/ui/PopupSearchPanel";
|
||||
|
||||
import {
|
||||
getExmnFacilityDetails,
|
||||
getExmnPplUnitDetails,
|
||||
PPL_STATUS_LABELS,
|
||||
getExmnFacilityPage,
|
||||
getExmnPplUnitPage,
|
||||
getExmnSectionSummaries,
|
||||
} from "../api/exmn-business-api";
|
||||
import type {
|
||||
@@ -161,10 +161,16 @@ export function ExmnSurveyDetailPopupPage({
|
||||
const [notice, setNotice] = useState<Notice>(null);
|
||||
/** 실제 DB 상세조회 결과와 요청 상태다. */
|
||||
const [actualRows, setActualRows] = useState<ExmnSurveyDetailRow[]>([]);
|
||||
// 표 행은 현재 페이지만 보관하고 합계는 서버의 전체 조건 합계를 별도로 사용한다.
|
||||
const [page, setPage] = useState(1);
|
||||
const [total, setTotal] = useState(0);
|
||||
const [serverSummary, setServerSummary] = useState<ExmnSurveyDetailRow | null>(null);
|
||||
const summaryRows = useMemo(() => serverSummary ? [serverSummary] : [], [serverSummary]);
|
||||
const [actualUnitRows, setActualUnitRows] = useState<ExmnPplUnitDetailRow[]>(
|
||||
[],
|
||||
);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [isDownloading, setIsDownloading] = useState(false);
|
||||
const [loadError, setLoadError] = useState<string | null>(null);
|
||||
const severityLabels: Record<ExmnDetailSeverity, string> = {
|
||||
...DEFAULT_SEVERITY_LABELS,
|
||||
@@ -257,13 +263,10 @@ export function ExmnSurveyDetailPopupPage({
|
||||
row.pipeNo.toLocaleLowerCase("ko-KR").includes(normalizedKeyword),
|
||||
);
|
||||
}, [actualUnitRows, appliedDetailNumberKeyword, isUnitMode]);
|
||||
const rows = useMemo(
|
||||
() =>
|
||||
sortStandardTableRows(filteredRows, sort, (row, key) =>
|
||||
getFixedCellValue(row, key as ExmnDetailFixedColumnId),
|
||||
),
|
||||
[filteredRows, sort],
|
||||
);
|
||||
// 현재 페이지를 다시 정렬하지 않는다. 정렬 조건을 서버에 보내 전체 결과 순서를 적용한다.
|
||||
const rows = filteredRows;
|
||||
|
||||
useEffect(() => { setPage(1); }, [selectedTrtdstId, appliedDetailNumberKeyword, defectType, detailMode, jobType]);
|
||||
|
||||
/** 관로·맨홀 조사유형 또는 결함 범위가 바뀌면 이전 검색 조건과 안내를 초기화한다. */
|
||||
useEffect(() => {
|
||||
@@ -300,7 +303,7 @@ export function ExmnSurveyDetailPopupPage({
|
||||
|
||||
/** 전체 또는 결함 분류별 모드에서 선택 처리분구의 활성 시설과 JSONB 결함 집계를 조회한다. */
|
||||
useEffect(() => {
|
||||
if (isUnitMode) {
|
||||
if (isUnitMode || !selectedTrtdstId) {
|
||||
setActualRows([]);
|
||||
setIsLoading(false);
|
||||
setLoadError(null);
|
||||
@@ -310,19 +313,29 @@ export function ExmnSurveyDetailPopupPage({
|
||||
setActualRows([]);
|
||||
setIsLoading(true);
|
||||
setLoadError(null);
|
||||
void getExmnFacilityDetails({
|
||||
void getExmnFacilityPage({
|
||||
exmnBizId: business.exmnBizId,
|
||||
jobType,
|
||||
trtdstId: selectedTrtdstId,
|
||||
gisManagementNo: appliedDetailNumberKeyword,
|
||||
defectType,
|
||||
defectCodes: visibleDefectColumns.map((column) => column.code).join(","),
|
||||
page: page - 1,
|
||||
size: 10,
|
||||
sort: sort ? `${sort.key},${sort.direction}` : undefined,
|
||||
})
|
||||
.then((result) => {
|
||||
if (active) setActualRows(result);
|
||||
if (active) {
|
||||
setActualRows(result.content);
|
||||
setTotal(result.totalElements);
|
||||
setServerSummary(result.summary);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
if (!active) return;
|
||||
setActualRows([]);
|
||||
setTotal(0);
|
||||
setServerSummary(null);
|
||||
setLoadError(
|
||||
error instanceof Error
|
||||
? error.message
|
||||
@@ -343,11 +356,13 @@ export function ExmnSurveyDetailPopupPage({
|
||||
jobType,
|
||||
searchRequestSeq,
|
||||
selectedTrtdstId,
|
||||
page,
|
||||
sort,
|
||||
]);
|
||||
|
||||
/** 본단위구간 모드에서 선택 처리분구의 PPL_UNIT_V1을 실제 상세행으로 조회한다. */
|
||||
useEffect(() => {
|
||||
if (!isUnitMode || isDefectTypeView) {
|
||||
if (!isUnitMode || isDefectTypeView || !selectedTrtdstId) {
|
||||
setActualUnitRows([]);
|
||||
return;
|
||||
}
|
||||
@@ -355,17 +370,23 @@ export function ExmnSurveyDetailPopupPage({
|
||||
setActualUnitRows([]);
|
||||
setIsLoading(true);
|
||||
setLoadError(null);
|
||||
void getExmnPplUnitDetails({
|
||||
void getExmnPplUnitPage({
|
||||
exmnBizId: business.exmnBizId,
|
||||
trtdstId: selectedTrtdstId,
|
||||
gisManagementNo: appliedDetailNumberKeyword,
|
||||
page: page - 1,
|
||||
size: 10,
|
||||
})
|
||||
.then((result) => {
|
||||
if (active) setActualUnitRows(result);
|
||||
if (active) {
|
||||
setActualUnitRows(result.content);
|
||||
setTotal(result.totalElements);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
if (!active) return;
|
||||
setActualUnitRows([]);
|
||||
setTotal(0);
|
||||
setLoadError(
|
||||
error instanceof Error
|
||||
? error.message
|
||||
@@ -385,10 +406,12 @@ export function ExmnSurveyDetailPopupPage({
|
||||
isUnitMode,
|
||||
searchRequestSeq,
|
||||
selectedTrtdstId,
|
||||
page,
|
||||
]);
|
||||
|
||||
/** 화면 조회 버튼으로 입력 번호를 확정해 상세 조회를 다시 실행한다. */
|
||||
const handleSearch = () => {
|
||||
setPage(1);
|
||||
setAppliedDetailNumberKeyword(detailNumberKeyword.trim());
|
||||
setSearchRequestSeq((current) => current + 1);
|
||||
setNotice(null);
|
||||
@@ -420,7 +443,7 @@ export function ExmnSurveyDetailPopupPage({
|
||||
|
||||
const totals = useMemo(
|
||||
() =>
|
||||
rows.reduce(
|
||||
summaryRows.reduce(
|
||||
(sum, row) => ({
|
||||
extensionM: sum.extensionM + row.extensionM,
|
||||
drivingDistanceM: sum.drivingDistanceM + row.drivingDistanceM,
|
||||
@@ -436,7 +459,7 @@ export function ExmnSurveyDetailPopupPage({
|
||||
operationalGrade: 0,
|
||||
},
|
||||
),
|
||||
[rows],
|
||||
[summaryRows],
|
||||
);
|
||||
|
||||
/** 고정 열의 합산값이며 관로·맨홀 모두 구조·운영 등급 합계를 표시한다. */
|
||||
@@ -454,7 +477,7 @@ export function ExmnSurveyDetailPopupPage({
|
||||
visibleDefectColumns.map((column) => [column.code, { L: 0, M: 0, S: 0 }]),
|
||||
) as Record<string, Record<ExmnDetailSeverity, number>>;
|
||||
|
||||
rows.forEach((row) => {
|
||||
summaryRows.forEach((row) => {
|
||||
visibleDefectColumns.forEach((column) => {
|
||||
const columnCounts = defectSubtotals[column.code];
|
||||
if (!columnCounts) return;
|
||||
@@ -483,19 +506,37 @@ export function ExmnSurveyDetailPopupPage({
|
||||
]),
|
||||
) as Record<string, number>,
|
||||
};
|
||||
}, [rows, visibleDefectColumns]);
|
||||
}, [summaryRows, visibleDefectColumns]);
|
||||
|
||||
/** 현재 화면에 표시된 관로·맨홀 상세 결과를 한글 헤더 엑셀로 내려받는다. */
|
||||
/** 화면은 확정 조회/표 상태만 전달하고 Excel 조립·저장은 기능 모듈이 담당한다. */
|
||||
const handleDownload = () => downloadExmnSurveyDetails({
|
||||
selectedTrtdstNm,
|
||||
defectGroupTitle: definition.defectGroupTitle,
|
||||
isUnitMode, defectTypeLabel, unitRows, rows,
|
||||
recordTypeLabels, pipeItemLabels, severityLabels, visibleDefectColumns,
|
||||
totals, defectSummary, summaryLabelColumnCount,
|
||||
fixedColumnCount: fixedColumns.length,
|
||||
setNotice,
|
||||
});
|
||||
const handleDownload = async () => {
|
||||
// 현재 페이지의 행은 전송하지 않고 적용조건·CMS 표시명으로 서버 전체 Excel을 생성한다.
|
||||
if (isDownloading) return;
|
||||
if (total === 0) {
|
||||
setNotice({ type: "info", text: "다운로드할 조사 상세현황 데이터가 없습니다." });
|
||||
return;
|
||||
}
|
||||
setIsDownloading(true);
|
||||
setNotice({ type: "info", text: "검색조건 전체의 Excel 자료를 준비하고 있습니다." });
|
||||
try {
|
||||
const filePrefix = `${selectedTrtdstNm}_${definition.defectGroupTitle}조사_${isUnitMode ? "본단위등급표" : defectTypeLabel}`
|
||||
.replace(/[\\/:*?"<>|]/g, "_");
|
||||
await requestGridExcel("v1/exmnFacilities/exportJobs", {
|
||||
exmnBizId: business.exmnBizId, jobType, trtdstId: selectedTrtdstId,
|
||||
gisManagementNo: appliedDetailNumberKeyword, defectType,
|
||||
mode: isUnitMode ? "UNIT" : "PIPE",
|
||||
sort: sort ? `${sort.key},${sort.direction}` : undefined,
|
||||
defectColumns: visibleDefectColumns.map((column) => ({ code: column.code, label: column.label })),
|
||||
recordTypeLabels, pipeItemLabels: { ...PPL_STATUS_LABELS, ...pipeItemLabels }, severityLabels,
|
||||
}, `${filePrefix}.xlsx`);
|
||||
setNotice({ type: "info", text: "검색조건 전체의 Excel 파일 다운로드를 시작했습니다." });
|
||||
} catch (error) {
|
||||
setNotice({ type: "info", text: error instanceof Error ? error.message : "전체 Excel 자료를 불러오지 못했습니다." });
|
||||
} finally {
|
||||
setIsDownloading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const tableWidth = useMemo(
|
||||
() =>
|
||||
@@ -507,8 +548,8 @@ export function ExmnSurveyDetailPopupPage({
|
||||
);
|
||||
/** 본단위구간 요약은 조회된 한 관로의 단위 수와 상태·결함 기록 수를 사용한다. */
|
||||
const unitSectionCount = useMemo(
|
||||
() => new Set(unitRows.map((row) => `${row.pipeNo}::${row.unitSeq}`)).size,
|
||||
[unitRows],
|
||||
() => total,
|
||||
[total],
|
||||
);
|
||||
/** 관로 집계와 본단위구간 행을 같은 StandardDataTable 데이터 유무 계약으로 전달한다. */
|
||||
const standardTableRows: Array<ExmnSurveyDetailRow | ExmnPplUnitDetailRow> =
|
||||
@@ -532,6 +573,7 @@ export function ExmnSurveyDetailPopupPage({
|
||||
<Button
|
||||
type="button"
|
||||
color="primary"
|
||||
disabled={isLoading || isDownloading}
|
||||
onClick={() => void handleDownload()}
|
||||
>
|
||||
엑셀다운로드
|
||||
@@ -670,6 +712,7 @@ export function ExmnSurveyDetailPopupPage({
|
||||
)}
|
||||
|
||||
<ExmnSurveyStandardDataTable
|
||||
pagination={{ page, size: 10, total, onPageChange: setPage }}
|
||||
rows={standardTableRows}
|
||||
title={tableTitle}
|
||||
loading={isLoading}
|
||||
@@ -792,7 +835,7 @@ export function ExmnSurveyDetailPopupPage({
|
||||
}
|
||||
sortKey={column.id}
|
||||
sort={sort}
|
||||
onSortChange={setSort}
|
||||
onSortChange={(nextSort) => { setSort(nextSort); setPage(1); }}
|
||||
/>
|
||||
) : (
|
||||
<span className="whitespace-pre-line">
|
||||
|
||||
@@ -18,6 +18,8 @@ interface ExmnSurveyStandardDataTableProps<T extends object> {
|
||||
minTableWidth?: string;
|
||||
onScroll?: UIEventHandler<HTMLDivElement>;
|
||||
renderTable: () => ReactNode;
|
||||
/** 목록은 서버 페이지를 사용하며 본단위 표는 물리 행이 아닌 구간 수를 전달한다. */
|
||||
pagination?: { page: number; size: number; total: number; onPageChange: (page: number) => void };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -33,6 +35,7 @@ export function ExmnSurveyStandardDataTable<T extends object>({
|
||||
minTableWidth = "100%",
|
||||
onScroll,
|
||||
renderTable,
|
||||
pagination,
|
||||
}: ExmnSurveyStandardDataTableProps<T>) {
|
||||
/** 공통 표가 데이터 유무와 로딩 상태를 판단할 수 있도록 복합 행을 최소 열로 연결한다. */
|
||||
const columns = useMemo<ColumnDef<T>[]>(
|
||||
@@ -48,6 +51,15 @@ export function ExmnSurveyStandardDataTable<T extends object>({
|
||||
data: rows,
|
||||
columns,
|
||||
getCoreRowModel: getCoreRowModel(),
|
||||
manualPagination: Boolean(pagination),
|
||||
rowCount: pagination?.total,
|
||||
state: pagination ? { pagination: { pageIndex: pagination.page - 1, pageSize: pagination.size } } : {},
|
||||
onPaginationChange: (updater) => {
|
||||
if (!pagination) return;
|
||||
const previous = { pageIndex: pagination.page - 1, pageSize: pagination.size };
|
||||
const next = typeof updater === "function" ? updater(previous) : updater;
|
||||
pagination.onPageChange(next.pageIndex + 1);
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
@@ -60,7 +72,7 @@ export function ExmnSurveyStandardDataTable<T extends object>({
|
||||
className="!w-full !max-w-full"
|
||||
scrollMode="horizontal"
|
||||
minTableWidth={minTableWidth}
|
||||
viewPagination={false}
|
||||
viewPagination={Boolean(pagination)}
|
||||
flushOuterMargin
|
||||
onScroll={onScroll}
|
||||
renderTable={renderTable}
|
||||
|
||||
@@ -7,7 +7,6 @@ import {
|
||||
STANDARD_ROW_NUMBER_HEADER,
|
||||
StandardDataTable,
|
||||
StandardTableSortHeader,
|
||||
sortStandardTableRows,
|
||||
type UiTableSort,
|
||||
} from "@common/business_components";
|
||||
import {
|
||||
@@ -22,7 +21,6 @@ import {
|
||||
} from "@common/components";
|
||||
import {
|
||||
getCoreRowModel,
|
||||
getPaginationRowModel,
|
||||
useReactTable,
|
||||
type ColumnDef,
|
||||
type PaginationState,
|
||||
@@ -31,7 +29,7 @@ import { useConfirm } from "@frontend-opensource/use-react-hooks";
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import {
|
||||
getTrtdstReferences,
|
||||
getTrtdstSettings,
|
||||
getTrtdstPage,
|
||||
saveTrtdstSettings,
|
||||
} from "../api/trtdst-api";
|
||||
import {
|
||||
@@ -142,6 +140,7 @@ export function TrtdstManagementPage() {
|
||||
const [sggCd, setSggCd] = useState("0");
|
||||
// 서버 조회 결과와 사용자의 미저장 변경을 함께 보관한다.
|
||||
const [rows, setRows] = useState<TrtdstTableRow[]>([]);
|
||||
const [total, setTotal] = useState(0);
|
||||
const [pagination, setPagination] = useState<PaginationState>({
|
||||
pageIndex: 0,
|
||||
pageSize: 10,
|
||||
@@ -190,21 +189,33 @@ export function TrtdstManagementPage() {
|
||||
() => rows.some((row) => row.rowStatus !== "clean"),
|
||||
[rows],
|
||||
);
|
||||
// 타이핑마다 열 정의를 재생성해 입력 포커스를 잃지 않도록 정렬 가드는 최신 상태를 ref로 읽는다.
|
||||
const editGuardRef = useRef({ hasChanges, editingRowKey, isLoading, appliedRegion });
|
||||
editGuardRef.current = { hasChanges, editingRowKey, isLoading, appliedRegion };
|
||||
|
||||
/** 확정된 조회조건으로 서버 목록을 읽고 화면 변경 상태를 초기화한다. */
|
||||
const fetchRows = useCallback(async (region: AppliedRegion) => {
|
||||
const fetchRows = useCallback(async (region: AppliedRegion, pageIndex = 0, nextSort?: UiTableSort) => {
|
||||
setIsLoading(true);
|
||||
setNotice(null);
|
||||
try {
|
||||
const items = await getTrtdstSettings({
|
||||
let result = await getTrtdstPage({
|
||||
ctpvNm: region.ctpvNm,
|
||||
sggNm: region.sggNm,
|
||||
useYn: "Y",
|
||||
page: pageIndex, size: 10,
|
||||
sort: nextSort ? `${nextSort.key},${nextSort.direction}` : undefined,
|
||||
});
|
||||
setRows(toTableRows(items));
|
||||
// 마지막 페이지의 행이 삭제된 경우 남은 마지막 페이지를 다시 조회한다.
|
||||
if (pageIndex > 0 && result.content.length === 0) {
|
||||
pageIndex = Math.max(0, Math.ceil(result.totalElements / 10) - 1);
|
||||
result = await getTrtdstPage({ ...region, page: pageIndex, size: 10,
|
||||
sort: nextSort ? `${nextSort.key},${nextSort.direction}` : undefined });
|
||||
}
|
||||
setRows(toTableRows(result.content));
|
||||
setTotal(result.totalElements);
|
||||
setSort(nextSort);
|
||||
setSelectedRowKey(null);
|
||||
setEditingRowKey(null);
|
||||
setPagination((current) => ({ ...current, pageIndex: 0 }));
|
||||
setPagination((current) => ({ ...current, pageIndex }));
|
||||
return true;
|
||||
} catch (error) {
|
||||
setSelectedRowKey(null);
|
||||
@@ -281,8 +292,6 @@ export function TrtdstManagementPage() {
|
||||
return;
|
||||
}
|
||||
setEditingRowKey(selectedRow.localKey);
|
||||
setSort(undefined);
|
||||
setPagination((current) => ({ ...current, pageIndex: 0 }));
|
||||
};
|
||||
|
||||
/** 선택한 행정구역으로 빈 신규 행을 만들고 처리분구명은 그리드에서 직접 입력받는다. */
|
||||
@@ -297,8 +306,6 @@ export function TrtdstManagementPage() {
|
||||
}
|
||||
|
||||
const localKey = createLocalKey();
|
||||
setSort(undefined);
|
||||
setPagination((current) => ({ ...current, pageIndex: 0 }));
|
||||
setRows((current) =>
|
||||
withAscendingRowNumbers([
|
||||
...current,
|
||||
@@ -446,13 +453,8 @@ export function TrtdstManagementPage() {
|
||||
setSelectedRowKey(null);
|
||||
setEditingRowKey(null);
|
||||
try {
|
||||
const refreshed = await getTrtdstSettings({
|
||||
ctpvNm: appliedRegion.ctpvNm,
|
||||
sggNm: appliedRegion.sggNm,
|
||||
useYn: "Y",
|
||||
});
|
||||
if (refreshed.length > 0 || savedRows.length === 0) {
|
||||
setRows(toTableRows(refreshed));
|
||||
if (!(await fetchRows(appliedRegion, pagination.pageIndex, sort))) {
|
||||
throw new Error("서버 페이지를 다시 불러오지 못했습니다.");
|
||||
}
|
||||
setNotice({ type: "success", text: summary });
|
||||
} catch (refreshError) {
|
||||
@@ -475,8 +477,8 @@ export function TrtdstManagementPage() {
|
||||
};
|
||||
|
||||
const sortedRows = useMemo(
|
||||
() => sortStandardTableRows(rows, sort),
|
||||
[rows, sort],
|
||||
() => rows.map((row, index) => ({ ...row, rowNumber: pagination.pageIndex * pagination.pageSize + index + 1 })),
|
||||
[rows, pagination.pageIndex, pagination.pageSize],
|
||||
);
|
||||
|
||||
/** 인라인 편집과 변경 상태 표시를 유지한 채 공통 DataTable 열로 변환한다. */
|
||||
@@ -491,10 +493,13 @@ export function TrtdstManagementPage() {
|
||||
sortKey={head.id}
|
||||
sort={sort}
|
||||
onSortChange={(nextSort) => {
|
||||
setSort(nextSort);
|
||||
setPagination((current) => ({ ...current, pageIndex: 0 }));
|
||||
setSelectedRowKey(null);
|
||||
setEditingRowKey(null);
|
||||
const guard = editGuardRef.current;
|
||||
if (guard.isLoading) return;
|
||||
if (guard.hasChanges || guard.editingRowKey) {
|
||||
setNotice({ type: "error", text: "변경사항을 저장하거나 취소한 뒤 정렬해주세요." });
|
||||
return;
|
||||
}
|
||||
void fetchRows(guard.appliedRegion, 0, nextSort);
|
||||
}}
|
||||
/>
|
||||
),
|
||||
@@ -532,7 +537,7 @@ export function TrtdstManagementPage() {
|
||||
},
|
||||
meta: { width: head.width, align: "center" as const },
|
||||
})),
|
||||
[editingRowKey, sort],
|
||||
[editingRowKey, sort, fetchRows],
|
||||
);
|
||||
|
||||
const table = useReactTable({
|
||||
@@ -543,9 +548,18 @@ export function TrtdstManagementPage() {
|
||||
rowSelection: selectedRowKey ? { [selectedRowKey]: true } : {},
|
||||
},
|
||||
getRowId: (row) => row.localKey,
|
||||
onPaginationChange: setPagination,
|
||||
manualPagination: true,
|
||||
rowCount: total + rows.filter((row) => row.rowStatus === "added").length,
|
||||
onPaginationChange: (updater) => {
|
||||
if (isLoading) return;
|
||||
if (hasChanges || editingRowKey) {
|
||||
setNotice({ type: "error", text: "변경사항을 저장하거나 취소한 뒤 페이지를 이동해주세요." });
|
||||
return;
|
||||
}
|
||||
const next = typeof updater === "function" ? updater(pagination) : updater;
|
||||
void fetchRows(appliedRegion, next.pageIndex, sort);
|
||||
},
|
||||
getCoreRowModel: getCoreRowModel(),
|
||||
getPaginationRowModel: getPaginationRowModel(),
|
||||
});
|
||||
|
||||
return (
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
import { deleteData, getData, postRawJson } from "@/components/lib/api";
|
||||
|
||||
/** 대량 Excel은 서버 작업으로 생성한다. 목록의 현재 page/size를 전달하지 않는다. */
|
||||
export async function requestGridExcel(url: string, body: object = {}, fileName = "grid.xlsx"): Promise<void> {
|
||||
const submitted = await postRawJson(url, body);
|
||||
const job = submitted?.data ?? submitted;
|
||||
if (!job?.jobId) throw new Error("Excel 생성 작업을 접수하지 못했습니다.");
|
||||
const jobPath = `v1/gridExportJobs/${encodeURIComponent(job.jobId)}`;
|
||||
const started = Date.now();
|
||||
while (Date.now() - started < 30 * 60 * 1000) {
|
||||
const status = await getData(jobPath);
|
||||
if (status?.status === "READY") {
|
||||
// 브라우저 JS 메모리에 완성 파일까지 적재하지 않도록 동일 출처 스트리밍 경로를 사용한다.
|
||||
const anchor = document.createElement("a");
|
||||
anchor.href = `/api/gridDownload/${encodeURIComponent(job.jobId)}?fileName=${encodeURIComponent(fileName)}`;
|
||||
anchor.download = fileName;
|
||||
document.body.appendChild(anchor);
|
||||
anchor.click();
|
||||
anchor.remove();
|
||||
return;
|
||||
}
|
||||
if (status?.status === "FAILED") {
|
||||
await deleteData(jobPath).catch(() => undefined);
|
||||
throw new Error(status.message || "Excel 생성에 실패했습니다.");
|
||||
}
|
||||
await new Promise((resolve) => window.setTimeout(resolve, 1000));
|
||||
}
|
||||
throw new Error("Excel 생성 대기시간이 초과되었습니다. 검색조건을 좁혀 다시 시도해주세요.");
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { requestGridExcel } from "@/shared/api/grid-export";
|
||||
|
||||
/** I/I 일반 화면과 지도 팝업에서 선택 분석의 전체 결과를 동일한 서버 작업으로 내려받는다. */
|
||||
export const downloadAnalysisExcel = async (kind: "inftwt" | "rdii", id: string | number, fileName: string) => {
|
||||
await requestGridExcel(`v1/analysisExports/${kind}/${encodeURIComponent(id)}`, {}, `${fileName}.xlsx`);
|
||||
};
|
||||
Reference in New Issue
Block a user