Compare commits
17
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
20aa1b37d0 | ||
|
|
87b5a5739a | ||
|
|
de4c2d6dbd | ||
|
|
49e31134b6 | ||
|
|
9c5c533db8 | ||
|
|
25320d43c4 | ||
|
|
f75fd342a3 | ||
|
|
1cde3b0998 | ||
|
|
c1cab1455f | ||
|
|
c04e754345 | ||
|
|
cec0701087 | ||
|
|
c121698713 | ||
|
|
9604e4591b | ||
|
|
31b885a497 | ||
|
|
cc24a16c77 | ||
|
|
0b441494ba | ||
|
|
446bd83210 |
@@ -3,13 +3,12 @@
|
||||
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||
import { useSearchParams } from "next/navigation";
|
||||
import { Button, Input } from "@common/components";
|
||||
import { UiTable, downloadExcelWithKoreanHeaders } from "@common/business_components/ui";
|
||||
import { UiTable } from "@common/business_components/ui";
|
||||
import { getData } from "@/components/lib/api";
|
||||
import useStore from "@/store/useStore";
|
||||
import LoadingOverlay from "@/components/ui/LoadingBar";
|
||||
import {
|
||||
AGED_PIPE_DEFAULT_FILTERS,
|
||||
AGED_PIPE_EXCEL_HEADER,
|
||||
AGED_PIPE_LAYER_TYPE,
|
||||
AGED_PIPE_LIST_HEADLIST,
|
||||
AGED_PIPE_PAGE_SIZE,
|
||||
@@ -20,6 +19,7 @@ import {
|
||||
type AgedPipeFilters,
|
||||
type AgedPipeRow,
|
||||
} from "./agedPipeUtils";
|
||||
import { downloadAgedPipeCsv } from "./agedPipeExport";
|
||||
|
||||
const POPUP_ROW_SELECT_MESSAGE = "SN_AGED_PIPE_ROW_SELECT";
|
||||
const POPUP_MINIMIZE_MESSAGE = "SN_AGED_PIPE_POPUP_MINIMIZE";
|
||||
@@ -40,6 +40,7 @@ export default function AgedPipePopupPage() {
|
||||
const [currentPage, setCurrentPage] = useState(1);
|
||||
const [selectedIndex, setSelectedIndex] = useState(-1);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [downloadProgressText, setDownloadProgressText] = useState("");
|
||||
|
||||
const sggOptions = useMemo(
|
||||
() =>
|
||||
@@ -122,7 +123,7 @@ export default function AgedPipePopupPage() {
|
||||
return () => window.removeEventListener("message", handleFilterSyncMessage);
|
||||
}, [loadRows]);
|
||||
|
||||
const handleSearch = (page = 1) => {
|
||||
const handleSearch = async (page = 1) => {
|
||||
if (!validateElapsedYears(Number(filters.elapsedYears))) {
|
||||
alert("경과년도는 1년~100년 범위 내에서 입력해주세요.");
|
||||
return;
|
||||
@@ -130,7 +131,7 @@ export default function AgedPipePopupPage() {
|
||||
|
||||
const normalized = normalizeAgedPipeFilters(filters);
|
||||
setFilters(normalized);
|
||||
loadRows(page, normalized);
|
||||
await loadRows(page, normalized);
|
||||
};
|
||||
|
||||
const handleRowClick = (index?: number) => {
|
||||
@@ -156,17 +157,28 @@ export default function AgedPipePopupPage() {
|
||||
|
||||
try {
|
||||
setIsLoading(true);
|
||||
const response = await fetchRows(1, filters, 10000);
|
||||
await downloadExcelWithKoreanHeaders({
|
||||
data: response.rows as JSON[],
|
||||
fileName: `노후관로_현황_${new Date().toISOString().slice(0, 10)}`,
|
||||
sheetNameArray: ["노후관로 현황"],
|
||||
headerRange: "A1:J1",
|
||||
headerMapping: AGED_PIPE_EXCEL_HEADER,
|
||||
setDownloadProgressText("CSV export 작업을 준비하고 있습니다.");
|
||||
await downloadAgedPipeCsv(filters, (job) => {
|
||||
if (job.status === "QUEUED") {
|
||||
setDownloadProgressText("CSV export 작업이 대기 중입니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (job.status === "RUNNING") {
|
||||
setDownloadProgressText(
|
||||
`CSV export 생성 중입니다. (${job.progressPercent ?? 0}%)`,
|
||||
);
|
||||
}
|
||||
});
|
||||
setDownloadProgressText("");
|
||||
} catch (error) {
|
||||
console.error("노후관로 목록 다운로드 중 오류:", error);
|
||||
alert("노후관로 목록 다운로드 중 오류가 발생했습니다.");
|
||||
setDownloadProgressText("");
|
||||
alert(
|
||||
error instanceof Error
|
||||
? error.message
|
||||
: "노후관로 CSV 다운로드 중 오류가 발생했습니다.",
|
||||
);
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
@@ -202,6 +214,12 @@ export default function AgedPipePopupPage() {
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{downloadProgressText ? (
|
||||
<div className="border-b border-slate-200 bg-emerald-50 px-5 py-2 text-[1rem] text-emerald-700">
|
||||
{downloadProgressText}
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<section className="overflow-y-auto p-4">
|
||||
<div className="grid grid-cols-1 gap-3 border-b border-slate-200 bg-slate-50 pb-4 md:grid-cols-[160px_320px_320px_auto] md:items-end md:justify-between">
|
||||
<label className="block md:max-w-[160px]">
|
||||
@@ -221,7 +239,7 @@ export default function AgedPipePopupPage() {
|
||||
});
|
||||
}}
|
||||
onKeyDown={(event) => {
|
||||
if (event.key === "Enter") handleSearch(1);
|
||||
if (event.key === "Enter") void handleSearch(1);
|
||||
}}
|
||||
/>
|
||||
</label>
|
||||
@@ -270,7 +288,7 @@ export default function AgedPipePopupPage() {
|
||||
size="sm"
|
||||
color="primary"
|
||||
className="h-10 px-5 !text-[1.1rem]"
|
||||
onClick={() => handleSearch(1)}
|
||||
onClick={() => void handleSearch(1)}
|
||||
>
|
||||
조회
|
||||
</Button>
|
||||
@@ -293,7 +311,7 @@ export default function AgedPipePopupPage() {
|
||||
pageSize={10}
|
||||
total={total}
|
||||
cellClick={(index) => handleRowClick(index)}
|
||||
onPageChange={(page) => handleSearch(page)}
|
||||
onPageChange={(page) => void handleSearch(page)}
|
||||
curPage={currentPage}
|
||||
index={selectedIndex}
|
||||
widthFixed={true}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
"use client";
|
||||
|
||||
import { postBlobData } from "@/components/lib/api";
|
||||
import { fileDownload } from "@/components/lib/utils/fileDownload";
|
||||
import {
|
||||
AGED_PIPE_EXCEL_FIELDS,
|
||||
normalizeAgedPipeFilters,
|
||||
type AgedPipeFilters,
|
||||
} from "./agedPipeUtils";
|
||||
|
||||
type AgedPipeExportProgress = {
|
||||
fileName?: string;
|
||||
progressPercent?: number;
|
||||
status: "QUEUED" | "RUNNING" | "COMPLETED";
|
||||
};
|
||||
|
||||
/** 노후관로 CSV 다운로드를 요청한다. */
|
||||
export const downloadAgedPipeCsv = async (
|
||||
filters: AgedPipeFilters,
|
||||
onProgress?: (progress: AgedPipeExportProgress) => void,
|
||||
) => {
|
||||
const normalizedFilters = normalizeAgedPipeFilters(filters);
|
||||
|
||||
onProgress?.({ status: "RUNNING", progressPercent: 0 });
|
||||
|
||||
const { blob, fileName } = await postBlobData("v1/fclts/agedPipes/exportJobs/download", {
|
||||
elapsedYears: normalizedFilters.elapsedYears,
|
||||
ctpvCd: normalizedFilters.ctpvCd,
|
||||
sggCd: normalizedFilters.sggCd,
|
||||
format: "csv",
|
||||
columns: [...AGED_PIPE_EXCEL_FIELDS],
|
||||
});
|
||||
|
||||
const resolvedFileName = fileName || "노후관로_현황.csv";
|
||||
fileDownload(blob, resolvedFileName);
|
||||
onProgress?.({ status: "COMPLETED", fileName: resolvedFileName, progressPercent: 100 });
|
||||
|
||||
return {
|
||||
status: "COMPLETED" as const,
|
||||
fileName: resolvedFileName,
|
||||
};
|
||||
};
|
||||
@@ -10,8 +10,9 @@ import {
|
||||
export const AGED_PIPE_LAYER_TYPE = "tb_ms_swage_ppl";
|
||||
export const AGED_PIPE_DEFAULT_ELAPSED_YEARS = 30;
|
||||
export const AGED_PIPE_PAGE_SIZE = 10;
|
||||
export const AGED_PIPE_MIN_ZOOM = 14;
|
||||
export const AGED_PIPE_INVALID_INSTALL_YMD_PREFIXES = ["19000101", "19990101"];
|
||||
export const AGED_PIPE_MIN_ZOOM = 13;
|
||||
export const AGED_PIPE_GUIDE_MIN_ZOOM = 13.1;
|
||||
export const AGED_PIPE_INVALID_INSTALL_YMD_PREFIXES = ["19000101"];
|
||||
|
||||
export type AgedPipeFilters = {
|
||||
elapsedYears: number;
|
||||
@@ -46,6 +47,12 @@ export const AGED_PIPE_DEFAULT_FILTERS: AgedPipeFilters = {
|
||||
sggCd: "0",
|
||||
};
|
||||
|
||||
const normalizeRegionFilterCode = (value: unknown, prefixLength: number) => {
|
||||
const digits = String(value ?? "").replace(/[^0-9]/g, "");
|
||||
if (digits === "" || digits === "0") return "0";
|
||||
return digits.length > prefixLength ? digits.slice(0, prefixLength) : digits;
|
||||
};
|
||||
|
||||
export const AGED_PIPE_LIST_HEADLIST = [
|
||||
{ id: "rowNumber", title: "NO", widthPercent: 6 },
|
||||
{ id: "fcltMngNo", title: "시설관리번호", widthPercent: 18 },
|
||||
@@ -57,8 +64,61 @@ export const AGED_PIPE_LIST_HEADLIST = [
|
||||
{ id: "elapsedYears", title: "경과년도", widthPercent: 12, align: "right" },
|
||||
];
|
||||
|
||||
export const AGED_PIPE_EXCEL_FIELDS = [
|
||||
"ftreSmbolCd",
|
||||
"fcltMngNo",
|
||||
"pbadmsEmdCd",
|
||||
"mapshtNo",
|
||||
"mngInstCd",
|
||||
"instlYmd",
|
||||
"usgCd",
|
||||
"mqltCd",
|
||||
"fcltyShpCd",
|
||||
"pdmtVl",
|
||||
"wdthLen",
|
||||
"vrtcLen",
|
||||
"prlgVl",
|
||||
"tmptDpth",
|
||||
"scendDpth",
|
||||
"avgGrdn",
|
||||
"trflnCnt",
|
||||
"exclnMltvArea",
|
||||
"drtwMltvArea",
|
||||
"rnyssnFvlcVl",
|
||||
"clarFvlcVl",
|
||||
"tmptMhlMngNo",
|
||||
"scendMhlMngNo",
|
||||
"instMngNo",
|
||||
"fid",
|
||||
"lyrTypeNm",
|
||||
"swtrmtFcltCd",
|
||||
"elapsedYears",
|
||||
"ctpvNm",
|
||||
"sggNm",
|
||||
] as const;
|
||||
|
||||
export const AGED_PIPE_EXCEL_HEADER = {
|
||||
rowNumber: "NO",
|
||||
ftreSmbolCd: "지형지물부호코드",
|
||||
pbadmsEmdCd: "행정읍면동코드",
|
||||
mapshtNo: "도엽번호",
|
||||
mngInstCd: "관리기관코드",
|
||||
wdthLen: "가로길이",
|
||||
vrtcLen: "세로길이",
|
||||
tmptDpth: "시점깊이",
|
||||
scendDpth: "종점깊이",
|
||||
avgGrdn: "평균구배",
|
||||
trflnCnt: "차선수",
|
||||
exclnMltvArea: "우수배수면적",
|
||||
drtwMltvArea: "오수배수면적",
|
||||
rnyssnFvlcVl: "우기유속값",
|
||||
clarFvlcVl: "맑음유속값",
|
||||
tmptMhlMngNo: "시점맨홀관리번호",
|
||||
scendMhlMngNo: "종점맨홀관리번호",
|
||||
instMngNo: "기관관리번호",
|
||||
fid: "FID",
|
||||
lyrTypeNm: "레이어타입명",
|
||||
swtrmtFcltCd: "시설코드",
|
||||
fcltyShpCd: "시설물형태코드",
|
||||
fcltMngNo: "시설관리번호",
|
||||
instlYmd: "설치일자",
|
||||
pdmtVl: "관경(mm)",
|
||||
@@ -70,6 +130,21 @@ export const AGED_PIPE_EXCEL_HEADER = {
|
||||
sggNm: "시군구",
|
||||
};
|
||||
|
||||
const getExcelColumnLetter = (columnIndex: number) => {
|
||||
let current = columnIndex;
|
||||
let result = "";
|
||||
|
||||
while (current > 0) {
|
||||
const remainder = (current - 1) % 26;
|
||||
result = String.fromCharCode(65 + remainder) + result;
|
||||
current = Math.floor((current - 1) / 26);
|
||||
}
|
||||
|
||||
return result || "A";
|
||||
};
|
||||
|
||||
export const AGED_PIPE_EXCEL_HEADER_RANGE = `A1:${getExcelColumnLetter(AGED_PIPE_EXCEL_FIELDS.length)}1`;
|
||||
|
||||
const pad2 = (value: number) => String(value).padStart(2, "0");
|
||||
|
||||
const normalizeYmd = (value: unknown) =>
|
||||
@@ -82,6 +157,8 @@ export const normalizeAgedPipeFilters = (filters: AgedPipeFilters): AgedPipeFilt
|
||||
|
||||
return {
|
||||
...filters,
|
||||
ctpvCd: normalizeRegionFilterCode(filters.ctpvCd, 2),
|
||||
sggCd: normalizeRegionFilterCode(filters.sggCd, 5),
|
||||
elapsedYears:
|
||||
Number.isFinite(elapsedYears) && elapsedYears >= 1 && elapsedYears <= 100
|
||||
? elapsedYears
|
||||
@@ -224,6 +301,16 @@ export const toDisplayPipeRow = (
|
||||
};
|
||||
};
|
||||
|
||||
export const toAgedPipeExcelRow = (row: AgedPipeRow) => {
|
||||
const exportRow: Record<string, unknown> = {};
|
||||
|
||||
AGED_PIPE_EXCEL_FIELDS.forEach((field) => {
|
||||
exportRow[field] = row[field] ?? "-";
|
||||
});
|
||||
|
||||
return exportRow;
|
||||
};
|
||||
|
||||
export const isAgedPipeLayerNode = (node: any) => {
|
||||
const data = node?.data ?? node;
|
||||
const layerName = String(data?.lyrNm ?? node?.text ?? "");
|
||||
|
||||
@@ -1,50 +1,101 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import {
|
||||
ChartColumnBig,
|
||||
ChevronLeft,
|
||||
ChevronRight,
|
||||
History,
|
||||
PanelsTopLeft,
|
||||
PencilRuler,
|
||||
Search,
|
||||
Settings2,
|
||||
TriangleAlert,
|
||||
Waves,
|
||||
} from "lucide-react";
|
||||
import type { WindowPopupKey } from "@/features/windowPopup/model/popupDefinitions";
|
||||
|
||||
type Props = {
|
||||
onOpenPopup: (popupKey: WindowPopupKey) => void;
|
||||
onOpenInfoSearch: () => void;
|
||||
};
|
||||
|
||||
const ANALYSIS_POPUP_ITEMS: Array<{ key: WindowPopupKey; label: string }> = [
|
||||
{ key: "pipeAnalysisPopup", label: "관로분석" },
|
||||
{ key: "floodPredictionMapPopup", label: "침수예측지도" },
|
||||
{ key: "floodHistoryPopup", label: "침수발생이력" },
|
||||
{ key: "gisEditPopup", label: "GIS 편집" },
|
||||
{ key: "gisManagementPopup", label: "GIS 관리" },
|
||||
{ key: "flowRiskPopup", label: "통수 위험" },
|
||||
const ANALYSIS_POPUP_ITEMS: Array<{
|
||||
key: WindowPopupKey | "infoSearch";
|
||||
label: string;
|
||||
icon: typeof ChartColumnBig;
|
||||
}> = [
|
||||
{ key: "infoSearch", label: "정보검색", icon: Search },
|
||||
{ key: "pipeAnalysisPopup", label: "관로분석", icon: ChartColumnBig },
|
||||
{ key: "floodPredictionMapPopup", label: "침수예측지도", icon: Waves },
|
||||
{ key: "floodHistoryPopup", label: "침수발생이력", icon: History },
|
||||
{ key: "gisEditPopup", label: "GIS 편집", icon: PencilRuler },
|
||||
{ key: "gisManagementPopup", label: "GIS 관리", icon: Settings2 },
|
||||
{ key: "flowRiskPopup", label: "통수 위험", icon: TriangleAlert },
|
||||
];
|
||||
|
||||
export default function AnalysisPopupMenu({ onOpenPopup }: Props) {
|
||||
export default function AnalysisPopupMenu({ onOpenPopup, onOpenInfoSearch }: Props) {
|
||||
const [isOpen, setIsOpen] = useState(true);
|
||||
const [activeKey, setActiveKey] = useState<WindowPopupKey | "infoSearch" | null>(null);
|
||||
|
||||
return (
|
||||
<div className="absolute right-[0.35rem] top-[53%] z-[70]">
|
||||
<div className="absolute right-[0.55rem] top-[20px] z-[45]">
|
||||
<div className="relative">
|
||||
{isOpen ? (
|
||||
<div className="absolute right-[21px] top-1/2 flex w-[86px] -translate-y-1/2 flex-col gap-[3px]">
|
||||
{ANALYSIS_POPUP_ITEMS.map((item) => (
|
||||
<button
|
||||
key={item.key}
|
||||
type="button"
|
||||
className="min-h-[40px] rounded-md border border-primary bg-primary px-2 py-1 text-center text-[1rem] font-semibold leading-[1.2] text-white shadow transition hover:brightness-95"
|
||||
onClick={() => onOpenPopup(item.key)}
|
||||
>
|
||||
<span className="break-keep whitespace-normal">{item.label}</span>
|
||||
</button>
|
||||
))}
|
||||
<div className="absolute right-[28px] w-[132px] overflow-hidden rounded-[6px] border border-[#d8dee8] bg-[rgba(255,255,255,0.96)] shadow-[0_8px_18px_rgba(15,23,42,0.14)]">
|
||||
<div className="flex h-[36px] items-center gap-2 border-b border-[#e5eaf1] bg-[#f8fafc] px-[10px] text-[13px] font-bold text-[#1f2937]">
|
||||
<div className="flex items-center gap-2">
|
||||
<PanelsTopLeft className="h-4 w-4 text-[#1e88e5]" />
|
||||
<span>분석도구</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col gap-1 p-[6px]">
|
||||
{ANALYSIS_POPUP_ITEMS.map((item) => {
|
||||
const Icon = item.icon;
|
||||
const isActive = activeKey === item.key;
|
||||
|
||||
return (
|
||||
<button
|
||||
key={item.key}
|
||||
type="button"
|
||||
className={`relative flex h-[34px] items-center gap-[7px] rounded-[5px] border px-[8px] pl-[10px] text-left text-[12px] font-semibold transition ${
|
||||
isActive
|
||||
? "border-[#b9dcff] bg-[#eaf4ff] font-bold text-[#0f5fa8] before:absolute before:left-0 before:top-[7px] before:bottom-[7px] before:w-[3px] before:rounded-r-[2px] before:bg-[#1e88e5]"
|
||||
: "border-transparent bg-white text-[#374151] hover:border-[#cfe5ff] hover:bg-[#eef6ff] hover:text-[#1e3a5f]"
|
||||
}`}
|
||||
onClick={() => {
|
||||
setActiveKey(item.key);
|
||||
|
||||
if (item.key === "infoSearch") {
|
||||
onOpenInfoSearch();
|
||||
return;
|
||||
}
|
||||
|
||||
onOpenPopup(item.key);
|
||||
}}
|
||||
>
|
||||
<Icon
|
||||
className={`h-[15px] w-[15px] shrink-0 ${
|
||||
isActive ? "text-[#1e88e5]" : "text-[#64748b]"
|
||||
}`}
|
||||
/>
|
||||
<span className="break-keep whitespace-normal">{item.label}</span>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<button
|
||||
type="button"
|
||||
className="flex h-[36px] w-[18px] items-center justify-center rounded-sm border border-[#2f5c9b] bg-white text-[0.9rem] font-bold text-[#2f5c9b] shadow transition hover:bg-slate-50"
|
||||
className="absolute right-0 top-0 flex h-[36px] w-[20px] items-center justify-center rounded-[4px] border border-[#d8dee8] bg-[rgba(255,255,255,0.96)] text-[#64748b] shadow-[0_8px_18px_rgba(15,23,42,0.14)] transition hover:bg-[#eaf4ff] hover:text-[#1e88e5]"
|
||||
onClick={() => setIsOpen((value) => !value)}
|
||||
title={isOpen ? "분석 메뉴 접기" : "분석 메뉴 펼치기"}
|
||||
aria-label={isOpen ? "분석 메뉴 접기" : "분석 메뉴 펼치기"}
|
||||
>
|
||||
{isOpen ? ">" : "<"}
|
||||
{isOpen ? <ChevronRight className="h-4 w-4" /> : <ChevronLeft className="h-4 w-4" />}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+30
-2
@@ -18,6 +18,7 @@ import {
|
||||
buildPipeAnalysisScope,
|
||||
normalizeNumberInput,
|
||||
resolveElapsedYearBucketLabel,
|
||||
resolveMaterialKoreanName,
|
||||
resolveMaterialName,
|
||||
resolvePipeAnalysisTypeLabel,
|
||||
resolveRegionName,
|
||||
@@ -27,6 +28,19 @@ import {
|
||||
} from "./pipeAnalysisUtils";
|
||||
|
||||
type DetailViewRow = ReturnType<typeof toPipeAnalysisDetailViewRows>[number];
|
||||
const PIPE_ANALYSIS_DETAIL_EXPORT_KEYS = [
|
||||
"rowNo",
|
||||
"ctpvNm",
|
||||
"sggNm",
|
||||
"fcltMngNo",
|
||||
"instMngNo",
|
||||
"swtrmtZoneNm",
|
||||
"instlYmd",
|
||||
"useNm",
|
||||
"pdmtVl",
|
||||
"prlgVl",
|
||||
"materialName",
|
||||
] as const;
|
||||
|
||||
export default function PipeAnalysisDetailPopupPage() {
|
||||
const searchParams = useSearchParams();
|
||||
@@ -151,11 +165,25 @@ export default function PipeAnalysisDetailPopupPage() {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
const response = await fetchRows(1, filters, Math.max(total, 1000));
|
||||
const exportRows = response.rows.map((row) => ({
|
||||
rowNo: row.rowNo,
|
||||
ctpvNm: row.ctpvNm,
|
||||
sggNm: row.sggNm,
|
||||
fcltMngNo: row.fcltMngNo,
|
||||
instMngNo: row.instMngNo,
|
||||
swtrmtZoneNm: row.swtrmtZoneNm,
|
||||
instlYmd: row.instlYmd,
|
||||
useNm: row.useNm,
|
||||
pdmtVl: row.pdmtVl,
|
||||
prlgVl: row.prlgVl,
|
||||
materialName: resolveMaterialKoreanName(row.materialCode) || row.materialName,
|
||||
}));
|
||||
const detailHeaderRange = `A1:${String.fromCharCode(64 + PIPE_ANALYSIS_DETAIL_EXPORT_KEYS.length)}1`;
|
||||
await downloadExcelWithKoreanHeaders({
|
||||
data: response.rows as unknown as JSON[],
|
||||
data: exportRows as unknown as JSON[],
|
||||
fileName: `관로분석_관로현황_${buildPipeAnalysisFileDate()}`,
|
||||
sheetNameArray: ["관로현황"],
|
||||
headerRange: "A1:K1",
|
||||
headerRange: detailHeaderRange,
|
||||
headerMapping: PIPE_ANALYSIS_DETAIL_EXCEL_HEADERS,
|
||||
});
|
||||
} catch (error) {
|
||||
|
||||
@@ -519,17 +519,69 @@ export const resolveMaterialName = (materialCode?: string) => {
|
||||
return materialMap.get(code) ?? code;
|
||||
};
|
||||
|
||||
/**
|
||||
* 관재질 라벨에서 영문 약어/코드를 걷어내고 엑셀 헤더용 한글명을 우선 추출한다.
|
||||
* - `염화비닐관(PVC)` -> `염화비닐관`
|
||||
* - `PCF관(강판보강 PE 나선형관)` -> `강판보강 나선형관`
|
||||
*/
|
||||
const toKoreanMaterialLabel = (value?: string) => {
|
||||
const normalized = String(value ?? "").trim();
|
||||
if (!normalized) return "";
|
||||
|
||||
const withoutParenthesis = normalized
|
||||
.replace(/\s*\([^)]*\)\s*/g, " ")
|
||||
.replace(/\s+/g, " ")
|
||||
.trim();
|
||||
const withoutAsciiToken = withoutParenthesis
|
||||
.replace(/[A-Za-z0-9-]+/g, " ")
|
||||
.replace(/\s+/g, " ")
|
||||
.trim();
|
||||
|
||||
if (/[가-힣]/.test(withoutAsciiToken)) {
|
||||
return withoutAsciiToken;
|
||||
}
|
||||
|
||||
if (/[가-힣]/.test(withoutParenthesis)) {
|
||||
return withoutParenthesis;
|
||||
}
|
||||
|
||||
const parenthesisMatches = Array.from(normalized.matchAll(/\(([^)]*)\)/g))
|
||||
.map((match) => String(match[1] ?? "").trim())
|
||||
.filter(Boolean);
|
||||
const koreanParenthesisText = parenthesisMatches.find((text) => /[가-힣]/.test(text));
|
||||
|
||||
if (koreanParenthesisText) {
|
||||
const simplifiedParenthesisText = koreanParenthesisText
|
||||
.replace(/[A-Za-z0-9-]+/g, " ")
|
||||
.replace(/\s+/g, " ")
|
||||
.trim();
|
||||
return simplifiedParenthesisText || koreanParenthesisText;
|
||||
}
|
||||
|
||||
return normalized;
|
||||
};
|
||||
|
||||
export const resolveMaterialColumnName = (column: PipeAnalysisMaterialColumn) => {
|
||||
const rawName = String(column.materialName ?? "").trim();
|
||||
const rawCode = String(column.materialCode ?? "").trim();
|
||||
const rawKey = String(column.key ?? "").trim();
|
||||
if (!rawName) {
|
||||
return resolveMaterialName(rawCode || rawKey);
|
||||
}
|
||||
if (rawName === rawCode || rawName === rawKey) {
|
||||
return resolveMaterialName(rawCode || rawKey);
|
||||
}
|
||||
return rawName;
|
||||
const mappedName = resolveMaterialName(rawCode || rawKey);
|
||||
const candidates = [
|
||||
toKoreanMaterialLabel(mappedName),
|
||||
toKoreanMaterialLabel(rawName),
|
||||
mappedName,
|
||||
rawName,
|
||||
rawCode,
|
||||
rawKey,
|
||||
].filter(Boolean);
|
||||
|
||||
return candidates[0] ?? "-";
|
||||
};
|
||||
|
||||
export const resolveMaterialKoreanName = (materialCode?: string) => {
|
||||
const resolved = resolveMaterialName(materialCode);
|
||||
const koreanLabel = toKoreanMaterialLabel(resolved);
|
||||
return koreanLabel || resolved;
|
||||
};
|
||||
|
||||
export const resolveElapsedYearBucketLabel = (bucket?: string) => {
|
||||
|
||||
@@ -36,11 +36,9 @@ import { ProcSearchBar } from "@common/business_components/ui/map/searchBar";
|
||||
import { Button } from "@common/components";
|
||||
import useSearchModalStore from "@/store/useSearchModalStore";
|
||||
import useStore from "@/store/useStore";
|
||||
import { downloadExcelWithKoreanHeaders } from "@common/business_components/ui";
|
||||
import AgedPipeLayerSettingPanel from "./components/agedPipe/AgedPipeLayerSettingPanel";
|
||||
import type { PipeAnalysisDetailRow } from "./components/pipeAnalysis/pipeAnalysisUtils";
|
||||
import {
|
||||
AGED_PIPE_EXCEL_HEADER,
|
||||
AGED_PIPE_MIN_ZOOM,
|
||||
AGED_PIPE_LAYER_TYPE,
|
||||
AGED_PIPE_PAGE_SIZE,
|
||||
@@ -53,7 +51,9 @@ import {
|
||||
type AgedPipeFilters,
|
||||
type AgedPipeRow,
|
||||
AGED_PIPE_DEFAULT_FILTERS,
|
||||
AGED_PIPE_GUIDE_MIN_ZOOM,
|
||||
} from "./components/agedPipe/agedPipeUtils";
|
||||
import { downloadAgedPipeCsv } from "./components/agedPipe/agedPipeExport";
|
||||
import { PIPE_ANALYSIS_DETAIL_ROW_SELECT_MESSAGE } from "./components/pipeAnalysis/pipeAnalysisUtils";
|
||||
import { openWindowPopup } from "@/features/windowPopup/lib/openWindowPopup";
|
||||
import type { WindowPopupKey } from "@/features/windowPopup/model/popupDefinitions";
|
||||
@@ -528,6 +528,7 @@ const Map = () => {
|
||||
const [agedPipeTotalCount, setAgedPipeTotalCount] = useState(0);
|
||||
const [agedPipeCurrentPage, setAgedPipeCurrentPage] = useState(1);
|
||||
const [isAgedPipeListLoading, setIsAgedPipeListLoading] = useState(false);
|
||||
const [agedPipeDownloadProgressText, setAgedPipeDownloadProgressText] = useState("");
|
||||
const { ctpv, sgg } = useStore();
|
||||
const shouldFocusAgedPipeOnNextSelectRef = useRef(false);
|
||||
const agedPipePopupWindowRef = useRef<Window | null>(null);
|
||||
@@ -1018,21 +1019,32 @@ const Map = () => {
|
||||
|
||||
try {
|
||||
setIsAgedPipeListLoading(true);
|
||||
const response = await fetchAgedPipeRows(1, appliedAgedPipeFilters, 10000);
|
||||
await downloadExcelWithKoreanHeaders({
|
||||
data: response.rows as JSON[],
|
||||
fileName: `노후관로_현황_${new Date().toISOString().slice(0, 10)}`,
|
||||
sheetNameArray: ["노후관로 현황"],
|
||||
headerRange: "A1:J1",
|
||||
headerMapping: AGED_PIPE_EXCEL_HEADER,
|
||||
setAgedPipeDownloadProgressText("CSV export 작업을 준비하고 있습니다.");
|
||||
await downloadAgedPipeCsv(appliedAgedPipeFilters, (job) => {
|
||||
if (job.status === "QUEUED") {
|
||||
setAgedPipeDownloadProgressText("CSV export 작업이 대기 중입니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (job.status === "RUNNING") {
|
||||
setAgedPipeDownloadProgressText(
|
||||
`CSV export 생성 중입니다. (${job.progressPercent ?? 0}%)`,
|
||||
);
|
||||
}
|
||||
});
|
||||
setAgedPipeDownloadProgressText("");
|
||||
} catch (error) {
|
||||
console.error("노후관로 목록 다운로드 중 오류:", error);
|
||||
alert("노후관로 목록 다운로드 중 오류가 발생했습니다.");
|
||||
setAgedPipeDownloadProgressText("");
|
||||
alert(
|
||||
error instanceof Error
|
||||
? error.message
|
||||
: "노후관로 CSV 다운로드 중 오류가 발생했습니다.",
|
||||
);
|
||||
} finally {
|
||||
setIsAgedPipeListLoading(false);
|
||||
}
|
||||
}, [agedPipeTotalCount, appliedAgedPipeFilters, fetchAgedPipeRows]);
|
||||
}, [agedPipeTotalCount, appliedAgedPipeFilters]);
|
||||
|
||||
useEffect(() => {
|
||||
const handleAgedPipePopupMessage = (event: MessageEvent) => {
|
||||
@@ -1224,13 +1236,21 @@ const Map = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="bg-container relative h-[calc(100dvh-5rem)] overflow-hidden">
|
||||
<div className="sn-map-control-layout bg-container relative h-[calc(100dvh-5rem)] overflow-hidden">
|
||||
{layerLoadError ? (
|
||||
<div className="absolute left-4 top-4 z-[60] max-w-[520px] rounded border border-red-200 bg-white px-4 py-3 text-sm text-red-700 shadow">
|
||||
레이어 설정 조회 실패: {layerLoadError}
|
||||
</div>
|
||||
) : null}
|
||||
<AnalysisPopupMenu onOpenPopup={openAnalysisPopup} />
|
||||
{agedPipeDownloadProgressText ? (
|
||||
<div className="absolute left-4 top-20 z-[60] max-w-[520px] rounded border border-emerald-200 bg-white px-4 py-3 text-sm text-emerald-700 shadow">
|
||||
{agedPipeDownloadProgressText}
|
||||
</div>
|
||||
) : null}
|
||||
<AnalysisPopupMenu
|
||||
onOpenPopup={openAnalysisPopup}
|
||||
onOpenInfoSearch={() => setIsSearchModalOpen(true)}
|
||||
/>
|
||||
<Gis
|
||||
treeData={treeData}
|
||||
isSearch={true}
|
||||
@@ -1247,7 +1267,13 @@ const Map = () => {
|
||||
setIsSearchModalOpen={setIsSearchModalOpen}
|
||||
onCheckedLayersChange={handleCheckedLayersChange}
|
||||
onOpenPopup={handleOpenLayerPopup}
|
||||
searchBar={<ProcSearchBar gisMaps={gisMaps} facilityTypes={facilityTypes} />}
|
||||
searchBar={
|
||||
<ProcSearchBar
|
||||
gisMaps={gisMaps}
|
||||
facilityTypes={facilityTypes}
|
||||
sidoSearchZoom={isAgedPipeChecked ? AGED_PIPE_GUIDE_MIN_ZOOM : undefined}
|
||||
/>
|
||||
}
|
||||
waterDepth={showWaterDepth ? WaterDepth : undefined}
|
||||
inlineLayerSettingView={inlineLayerSettingView}
|
||||
layerIconVisible={isAgedPipeLayerNode}
|
||||
@@ -1257,6 +1283,17 @@ const Map = () => {
|
||||
checkInterval={2500}
|
||||
checkedLayerChangeDelay={0}
|
||||
showZoomLevel={true}
|
||||
showZoomScaleInfo={true}
|
||||
showFloatingSearchButton={false}
|
||||
treeTogglePosition="top"
|
||||
zoomGuide={
|
||||
isAgedPipeChecked
|
||||
? {
|
||||
label: "노후관로 기준",
|
||||
zoom: AGED_PIPE_GUIDE_MIN_ZOOM,
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
|
||||
defaultZoom={7.5}
|
||||
defaultLonLat={[127.75, 36]}
|
||||
@@ -1293,6 +1330,37 @@ const Map = () => {
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
<style jsx global>{`
|
||||
.sn-map-control-layout .mapbtn {
|
||||
top: auto;
|
||||
right: 15px;
|
||||
bottom: 451px;
|
||||
}
|
||||
|
||||
.sn-map-control-layout .custom-toolbar {
|
||||
position: static;
|
||||
}
|
||||
|
||||
.sn-map-control-layout .tool-bar {
|
||||
top: auto;
|
||||
right: 15px;
|
||||
bottom: 248px;
|
||||
}
|
||||
|
||||
.sn-map-control-layout .zoom-level-control {
|
||||
right: 16px;
|
||||
bottom: 56px;
|
||||
}
|
||||
|
||||
.sn-map-control-layout .zoom-level-summary {
|
||||
right: 56px;
|
||||
bottom: -15px;
|
||||
}
|
||||
|
||||
.sn-map-control-layout .ol-scale-line {
|
||||
display: none;
|
||||
}
|
||||
`}</style>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -101,6 +101,46 @@ export const postData = async (url: string, data: object): Promise<any> => {
|
||||
}
|
||||
};
|
||||
|
||||
const parseDownloadFileName = (contentDisposition: string | null) => {
|
||||
if (!contentDisposition) return undefined;
|
||||
|
||||
const utf8Match = contentDisposition.match(/filename\*\s*=\s*UTF-8''([^;]+)/i);
|
||||
if (utf8Match?.[1]) {
|
||||
return decodeURIComponent(utf8Match[1].trim());
|
||||
}
|
||||
|
||||
const plainMatch = contentDisposition.match(/filename\s*=\s*"?([^\";]+)"?/i);
|
||||
return plainMatch?.[1]?.trim();
|
||||
};
|
||||
|
||||
export const postBlobData = async (
|
||||
url: string,
|
||||
data: object,
|
||||
): Promise<{ blob: Blob; fileName?: string }> => {
|
||||
const res = await fetch(resolveApiUrl(url), {
|
||||
method: "POST",
|
||||
headers: withSiteIdHeaders({
|
||||
"Content-Type": "application/json",
|
||||
}),
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
if (res.status === 401) {
|
||||
handleUnauthorizedResponse();
|
||||
}
|
||||
|
||||
if (!res.ok) {
|
||||
const errorText = await res.text().catch(() => "");
|
||||
throw new Error(
|
||||
`Failed to fetch blob: ${res.status} ${res.statusText}${errorText ? ` - ${errorText.slice(0, 200)}` : ""} (${url})`,
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
blob: await res.blob(),
|
||||
fileName: parseDownloadFileName(res.headers.get("content-disposition")),
|
||||
};
|
||||
};
|
||||
|
||||
export const postMutiPart = async (url: string, data: FormData): Promise<any> => {
|
||||
const res = await axios.post(`${BASE_URL}/${url}`, data, {
|
||||
headers: DEFAULT_HEADERS,
|
||||
|
||||
@@ -33,8 +33,8 @@ export const fetchCtpv = async (set: (state: any) => void) => {
|
||||
|
||||
const list = res.features
|
||||
.map((f: any) => ({
|
||||
text: f.properties.mctpv_korn_nm,
|
||||
val: f.properties.mctpv_cd,
|
||||
text: String(f.properties.mctpv_korn_nm ?? "").trim(),
|
||||
val: String(f.properties.mctpv_cd ?? "").trim(),
|
||||
}))
|
||||
.sort((a:any, b:any) => {
|
||||
// 커스텀 순서 정의
|
||||
@@ -83,8 +83,8 @@ export const fetchSgg = async (set: (state: any) => void) => {
|
||||
|
||||
const list = res.features
|
||||
.map((f: any) => ({
|
||||
text: f.properties.sgg_korn_nm,
|
||||
val: f.properties.sgg_cd,
|
||||
text: String(f.properties.sgg_korn_nm ?? "").trim(),
|
||||
val: String(f.properties.sgg_cd ?? "").trim(),
|
||||
}))
|
||||
.sort((a:any, b:any) => a.text.localeCompare(b.text, 'ko'));
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Button } from "@common/components";
|
||||
|
||||
interface ApproveButtonProps {
|
||||
approveFunc: () => void;
|
||||
approveFunc: () => void | Promise<void>;
|
||||
}
|
||||
|
||||
const ApproveButton = ({ approveFunc }: ApproveButtonProps) => {
|
||||
|
||||
@@ -1,21 +1,6 @@
|
||||
@tailwind components;
|
||||
|
||||
@layer components {
|
||||
.rg-grid .rg-header .rg-table .rg-header-group-cell {
|
||||
@apply !bg-[#466995] !text-[#fff];
|
||||
}
|
||||
.rg-grid .rg-header .rg-table {
|
||||
@apply !bg-[#5987bf] !text-[#fff];
|
||||
}
|
||||
|
||||
/* 상태바·체크바 헤더 */
|
||||
.rg-grid .rg-head .rg-table tr:first-child td:first-child,
|
||||
.rg-grid .rg-head .rg-table tr:first-child td:nth-child(2),
|
||||
.rg-grid .rg-header .rg-table tr:first-child td:first-child,
|
||||
.rg-grid .rg-header .rg-table tr:first-child td:nth-child(2) {
|
||||
@apply !bg-[#5987bf] !text-[#fff];
|
||||
}
|
||||
|
||||
.rg-grid .rg-body .rg-table .rg-data-row .rg-data-cell {
|
||||
@apply !bg-white;
|
||||
}
|
||||
@@ -36,14 +21,67 @@
|
||||
.rg-grid .rg-body .rg-table .rg-data-row .rg-data-cell.rg-cell-vrf-prcs-ok {
|
||||
@apply !font-semibold !text-[#3372cf];
|
||||
}
|
||||
/* 개별 반려: 높이/레이아웃은 RealGrid 행에 그대로 두고, 색·테두리·정렬만 버튼 느낌 */
|
||||
.rg-grid .rg-body .rg-table .rg-data-row .rg-data-cell.rg-cell-reject-mini-btn {
|
||||
text-align: center !important;
|
||||
vertical-align: middle !important;
|
||||
box-sizing: border-box !important;
|
||||
padding-left: 8px !important;
|
||||
padding-right: 8px !important;
|
||||
border-radius: 0.25rem !important;
|
||||
border: 1px solid rgb(248 113 113 / 0.55) !important;
|
||||
background-color: rgb(254 242 242) !important;
|
||||
color: rgb(185 28 28) !important;
|
||||
font-size: 1.2rem !important;
|
||||
font-weight: 600 !important;
|
||||
white-space: nowrap !important;
|
||||
cursor: pointer !important;
|
||||
text-decoration: none !important;
|
||||
}
|
||||
.rg-grid .rg-body .rg-table .rg-data-row .rg-data-cell.rg-cell-reject-mini-btn:hover {
|
||||
background-color: rgb(254 226 226) !important;
|
||||
border-color: rgb(239 68 68 / 0.85) !important;
|
||||
color: rgb(153 27 27) !important;
|
||||
}
|
||||
.rg-grid .rg-body .rg-table .rg-data-row .rg-data-cell.rg-cell-reject-mini-btn:active {
|
||||
background-color: rgb(254 202 202) !important;
|
||||
}
|
||||
.rg-grid .rg-body .rg-table .rg-data-row .rg-data-cell.rg-cell-outline-action-btn {
|
||||
text-align: center !important;
|
||||
vertical-align: middle !important;
|
||||
box-sizing: border-box !important;
|
||||
padding-left: 8px !important;
|
||||
padding-right: 8px !important;
|
||||
border-radius: 0.25rem !important;
|
||||
border: 1px solid rgb(148 163 184 / 0.7) !important;
|
||||
background-color: rgb(248 250 252) !important;
|
||||
color: rgb(51 65 85) !important;
|
||||
font-size: 1.2rem !important;
|
||||
font-weight: 600 !important;
|
||||
white-space: nowrap !important;
|
||||
cursor: pointer !important;
|
||||
text-decoration: none !important;
|
||||
}
|
||||
.rg-grid .rg-body .rg-table .rg-data-row .rg-data-cell.rg-cell-outline-action-btn:hover {
|
||||
background-color: rgb(241 245 249) !important;
|
||||
border-color: rgb(100 116 139 / 0.85) !important;
|
||||
color: rgb(30 41 59) !important;
|
||||
}
|
||||
.rg-grid .rg-body .rg-table .rg-data-row .rg-data-cell.rg-cell-outline-action-btn:active {
|
||||
background-color: rgb(226 232 240) !important;
|
||||
}
|
||||
.rg-grid .rg-body .rg-table .rg-data-row .rg-data-cell.rg-cell-action-link {
|
||||
@apply !font-semibold !text-[#2563eb] underline;
|
||||
cursor: pointer !important;
|
||||
}
|
||||
.rg-grid .rg-body .rg-table .rg-data-row .rg-data-cell.rg-cell-stats-status-pending {
|
||||
@apply !text-gray-500;
|
||||
}
|
||||
.rg-grid .rg-body .rg-table .rg-data-row .rg-data-cell.rg-cell-stats-status-submitted {
|
||||
@apply !font-semibold
|
||||
@apply !font-semibold;
|
||||
}
|
||||
.rg-grid .rg-body .rg-table .rg-data-row .rg-data-cell.rg-cell-stats-status-approved {
|
||||
@apply !font-semibold
|
||||
@apply !font-semibold;
|
||||
}
|
||||
.rg-grid .rg-body .rg-table .rg-data-row .rg-data-cell.rg-cell-stats-status-rejected {
|
||||
@apply !font-semibold !text-[#ff6c64];
|
||||
@@ -117,60 +155,6 @@
|
||||
.data-grid-status-bubble > span + span {
|
||||
@apply ml-4 border-l border-slate-200/70 pl-4;
|
||||
}
|
||||
|
||||
[data-theme="black"] {
|
||||
.rg-grid .rg-header .rg-table .rg-header-group-cell {
|
||||
@apply !bg-[#3C4043] !text-[#fff];
|
||||
}
|
||||
.rg-grid .rg-header .rg-table .rg-header-cell {
|
||||
@apply !bg-[#62686d] !text-[#fff];
|
||||
}
|
||||
.rg-grid .rg-head .rg-table tr:first-child td:first-child,
|
||||
.rg-grid .rg-head .rg-table tr:first-child td:nth-child(2),
|
||||
.rg-grid .rg-header .rg-table tr:first-child td:first-child,
|
||||
.rg-grid .rg-header .rg-table tr:first-child td:nth-child(2) {
|
||||
@apply !bg-[#62686d] !text-[#fff];
|
||||
}
|
||||
.rg-grid .rg-body .rg-table .rg-data-row .rg-data-cell {
|
||||
@apply !bg-[#545556] !text-[#fff];
|
||||
}
|
||||
.rg-grid .rg-body .rg-table .rg-data-row .rg-data-cell.rg-cell-vrf-prcs-bad {
|
||||
@apply !text-[#f87171];
|
||||
}
|
||||
.rg-grid .rg-body .rg-table .rg-data-row .rg-data-cell.rg-cell-vrf-prcs-ok {
|
||||
@apply !text-[#3372cf];
|
||||
}
|
||||
}
|
||||
|
||||
[data-theme="red"] {
|
||||
.rg-grid .rg-header .rg-table .rg-header-group-cell {
|
||||
@apply !bg-[#646469] !text-[#fff];
|
||||
}
|
||||
.rg-grid .rg-header .rg-table .rg-header-cell {
|
||||
@apply !bg-[#8d8d94] !text-[#fff];
|
||||
}
|
||||
.rg-grid .rg-head .rg-table tr:first-child td:first-child,
|
||||
.rg-grid .rg-head .rg-table tr:first-child td:nth-child(2),
|
||||
.rg-grid .rg-header .rg-table tr:first-child td:first-child,
|
||||
.rg-grid .rg-header .rg-table tr:first-child td:nth-child(2) {
|
||||
@apply !bg-[#8d8d94] !text-[#fff];
|
||||
}
|
||||
}
|
||||
|
||||
[data-theme="green"] {
|
||||
.rg-grid .rg-header .rg-table .rg-header-group-cell {
|
||||
@apply !bg-[#518585] !text-[#fff];
|
||||
}
|
||||
.rg-grid .rg-header .rg-table .rg-header-cell {
|
||||
@apply !bg-[#6bafae] !text-[#fff];
|
||||
}
|
||||
.rg-grid .rg-head .rg-table tr:first-child td:first-child,
|
||||
.rg-grid .rg-head .rg-table tr:first-child td:nth-child(2),
|
||||
.rg-grid .rg-header .rg-table tr:first-child td:first-child,
|
||||
.rg-grid .rg-header .rg-table tr:first-child td:nth-child(2) {
|
||||
@apply !bg-[#6bafae] !text-[#fff];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes rg-cell-stats-status-dot-ping {
|
||||
@@ -203,4 +187,123 @@
|
||||
.rg-grid .rg-head .rg-table tr td {
|
||||
border: none;
|
||||
border-bottom: 1px solid #e5e7eb;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* ST 통계 그리드 헤더 색 — @layer 밖(일반 규칙).
|
||||
* packages/rsone/components/grid/css/DataGrid.css 등 @layer 밖 !important와 동일 층에서
|
||||
* .rg-grid … 특이도로 덮어씀.
|
||||
*/
|
||||
.rg-grid .rg-header .rg-table .rg-header-group-cell {
|
||||
background-color: #466995 !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
.rg-grid .rg-header .rg-table {
|
||||
background-color: #5987bf !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
.rg-grid .rg-head .rg-table tr:first-child td:first-child,
|
||||
.rg-grid .rg-head .rg-table tr:first-child td:nth-child(2),
|
||||
.rg-grid .rg-header .rg-table tr:first-child td:first-child,
|
||||
.rg-grid .rg-header .rg-table tr:first-child td:nth-child(2) {
|
||||
background-color: #5987bf !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
.rg-grid .rg-header .rg-cell,
|
||||
.rg-grid .rg-head .rg-cell {
|
||||
background-color: #5987bf !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
[data-theme="black"] .rg-grid .rg-header .rg-table .rg-header-group-cell {
|
||||
background-color: #3c4043 !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
[data-theme="black"] .rg-grid .rg-header .rg-table .rg-header-cell {
|
||||
background-color: #62686d !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
[data-theme="black"] .rg-grid .rg-head .rg-table tr:first-child td:first-child,
|
||||
[data-theme="black"] .rg-grid .rg-head .rg-table tr:first-child td:nth-child(2),
|
||||
[data-theme="black"] .rg-grid .rg-header .rg-table tr:first-child td:first-child,
|
||||
[data-theme="black"] .rg-grid .rg-header .rg-table tr:first-child td:nth-child(2) {
|
||||
background-color: #62686d !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
[data-theme="black"] .rg-grid .rg-header .rg-cell,
|
||||
[data-theme="black"] .rg-grid .rg-head .rg-cell {
|
||||
background-color: #62686d !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
[data-theme="black"] .rg-grid .rg-body .rg-table .rg-data-row .rg-data-cell {
|
||||
background-color: #545556 !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
[data-theme="black"] .rg-grid .rg-body .rg-table .rg-data-row .rg-data-cell.rg-cell-vrf-prcs-bad {
|
||||
color: #f87171 !important;
|
||||
}
|
||||
[data-theme="black"] .rg-grid .rg-body .rg-table .rg-data-row .rg-data-cell.rg-cell-vrf-prcs-ok {
|
||||
color: #3372cf !important;
|
||||
}
|
||||
[data-theme="black"] .rg-grid .rg-body .rg-table .rg-data-row .rg-data-cell.rg-cell-reject-mini-btn {
|
||||
background-color: rgb(127 29 29 / 0.42) !important;
|
||||
border-color: rgb(248 113 113 / 0.5) !important;
|
||||
color: #fecaca !important;
|
||||
}
|
||||
[data-theme="black"] .rg-grid .rg-body .rg-table .rg-data-row .rg-data-cell.rg-cell-reject-mini-btn:hover {
|
||||
background-color: rgb(153 27 27 / 0.55) !important;
|
||||
border-color: rgb(252 165 165 / 0.75) !important;
|
||||
color: #fee2e2 !important;
|
||||
}
|
||||
[data-theme="black"] .rg-grid .rg-body .rg-table .rg-data-row .rg-data-cell.rg-cell-outline-action-btn {
|
||||
background-color: rgb(71 85 105 / 0.35) !important;
|
||||
border-color: rgb(148 163 184 / 0.55) !important;
|
||||
color: #e2e8f0 !important;
|
||||
}
|
||||
[data-theme="black"] .rg-grid .rg-body .rg-table .rg-data-row .rg-data-cell.rg-cell-outline-action-btn:hover {
|
||||
background-color: rgb(71 85 105 / 0.5) !important;
|
||||
border-color: rgb(203 213 225 / 0.65) !important;
|
||||
color: #f8fafc !important;
|
||||
}
|
||||
|
||||
[data-theme="red"] .rg-grid .rg-header .rg-table .rg-header-group-cell {
|
||||
background-color: #646469 !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
[data-theme="red"] .rg-grid .rg-header .rg-table .rg-header-cell {
|
||||
background-color: #8d8d94 !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
[data-theme="red"] .rg-grid .rg-head .rg-table tr:first-child td:first-child,
|
||||
[data-theme="red"] .rg-grid .rg-head .rg-table tr:first-child td:nth-child(2),
|
||||
[data-theme="red"] .rg-grid .rg-header .rg-table tr:first-child td:first-child,
|
||||
[data-theme="red"] .rg-grid .rg-header .rg-table tr:first-child td:nth-child(2) {
|
||||
background-color: #8d8d94 !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
[data-theme="red"] .rg-grid .rg-header .rg-cell,
|
||||
[data-theme="red"] .rg-grid .rg-head .rg-cell {
|
||||
background-color: #8d8d94 !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
[data-theme="green"] .rg-grid .rg-header .rg-table .rg-header-group-cell {
|
||||
background-color: #518585 !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
[data-theme="green"] .rg-grid .rg-header .rg-table .rg-header-cell {
|
||||
background-color: #6bafae !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
[data-theme="green"] .rg-grid .rg-head .rg-table tr:first-child td:first-child,
|
||||
[data-theme="green"] .rg-grid .rg-head .rg-table tr:first-child td:nth-child(2),
|
||||
[data-theme="green"] .rg-grid .rg-header .rg-table tr:first-child td:first-child,
|
||||
[data-theme="green"] .rg-grid .rg-header .rg-table tr:first-child td:nth-child(2) {
|
||||
background-color: #6bafae !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
[data-theme="green"] .rg-grid .rg-header .rg-cell,
|
||||
[data-theme="green"] .rg-grid .rg-head .rg-cell {
|
||||
background-color: #6bafae !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
@@ -378,6 +378,7 @@ const DataGrid = ({
|
||||
cellTooltipCallback,
|
||||
onCellEdited,
|
||||
onRowClick,
|
||||
onDataCellClick,
|
||||
onItemChecked,
|
||||
onItemAllChecked,
|
||||
onScrollToBottom,
|
||||
@@ -403,6 +404,7 @@ const DataGrid = ({
|
||||
cellTooltipCallback,
|
||||
);
|
||||
const onCellEditedRef = useRef<typeof onCellEdited>(onCellEdited);
|
||||
const onDataCellClickRef = useRef<typeof onDataCellClick>(onDataCellClick);
|
||||
const onScrollToBottomRef = useRef<(() => void) | undefined>(
|
||||
onScrollToBottom,
|
||||
);
|
||||
@@ -417,6 +419,7 @@ const DataGrid = ({
|
||||
onItemCheckedRef.current = onItemChecked;
|
||||
onItemAllCheckedRef.current = onItemAllChecked;
|
||||
onCellEditedRef.current = onCellEdited;
|
||||
onDataCellClickRef.current = onDataCellClick;
|
||||
|
||||
// highlightedRowId가 변경될 때 해당 행으로 스크롤 및 선택
|
||||
useEffect(() => {
|
||||
@@ -1180,7 +1183,11 @@ const DataGrid = ({
|
||||
// 행 클릭 이벤트 + 검증 오류 셀 클릭 시 showMessage (공식 문서 방식)
|
||||
useEffect(() => {
|
||||
const gridView = gridRef.current?.gridView;
|
||||
if (!gridView || (!onRowClick && !cellTooltipCallback)) return;
|
||||
if (
|
||||
!gridView ||
|
||||
(!onRowClick && !cellTooltipCallback && !onDataCellClick)
|
||||
)
|
||||
return;
|
||||
|
||||
gridView.onCellClicked = (grid, clickData) => {
|
||||
if (
|
||||
@@ -1199,10 +1206,10 @@ const DataGrid = ({
|
||||
};
|
||||
}
|
||||
).getCurrent?.();
|
||||
const fieldName =
|
||||
cellIndex?.fieldName ?? cellIndex?.column ?? "";
|
||||
// cellTooltipCallback 있으면 해당 셀 메시지로 showMessage (공식 문서: TooltipOptions + CellIndex)
|
||||
if (cellTooltipCallbackRef.current && row && cellIndex) {
|
||||
const fieldName =
|
||||
cellIndex.fieldName ?? cellIndex.column ?? "";
|
||||
const msg = cellTooltipCallbackRef.current({
|
||||
row: row as Record<string, string | number>,
|
||||
fieldName,
|
||||
@@ -1232,6 +1239,13 @@ const DataGrid = ({
|
||||
);
|
||||
}
|
||||
}
|
||||
if (onDataCellClickRef.current && row !== undefined) {
|
||||
onDataCellClickRef.current({
|
||||
row: (row ?? {}) as Record<string, string | number>,
|
||||
fieldName,
|
||||
itemIndex: clickData.itemIndex,
|
||||
});
|
||||
}
|
||||
if (onRowClick)
|
||||
onRowClick((row ?? {}) as Record<string, string | number>);
|
||||
} catch (error) {
|
||||
@@ -1242,7 +1256,7 @@ const DataGrid = ({
|
||||
return () => {
|
||||
if (gridView.onCellClicked) gridView.onCellClicked = undefined;
|
||||
};
|
||||
}, [onRowClick, cellTooltipCallback, columns]);
|
||||
}, [onRowClick, onDataCellClick, cellTooltipCallback, columns]);
|
||||
|
||||
useEffect(() => {
|
||||
const gridView = gridRef.current?.gridView;
|
||||
|
||||
@@ -0,0 +1,617 @@
|
||||
"use client";
|
||||
|
||||
import { type Dispatch, type MutableRefObject, type SetStateAction, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
|
||||
import { RealGridReact } from "realgrid-react";
|
||||
|
||||
import { getUserInfo } from "../../../../../packages/common/components/src/api";
|
||||
import { useAlertStore } from "@/shared/lib";
|
||||
import { statisticsApi } from "@/entities/statistics/api/statistics-service";
|
||||
import type {
|
||||
ReviewInputSaveRequest,
|
||||
VerificationResultListRequest,
|
||||
VerificationResultReportItem,
|
||||
} from "@/entities/statistics/model/statistics-interface";
|
||||
import {
|
||||
Button,
|
||||
Dialog,
|
||||
DialogClose,
|
||||
DialogContent,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
Label,
|
||||
LoadingWithAnimation,
|
||||
Tabs,
|
||||
TabsContent,
|
||||
TabsList,
|
||||
TabsTrigger,
|
||||
Textarea,
|
||||
} from "@common/components";
|
||||
|
||||
import DataGrid from "@/components/module/DataGrid";
|
||||
import { VerificationResultHistoryPagination } from "@/components/module/VerificationResultHistoryPagination";
|
||||
import type { CellStyleCallbackParams, ColumnInfo } from "@/components/type/DataGrid.type";
|
||||
|
||||
/** 통계 입력 현황 > 행 클릭 시 예외처리(prcsYn=3) 내역만 조회 */
|
||||
export interface ExceptionProcessingHistoryQueryContext {
|
||||
sewerBzmnCd: string;
|
||||
ctpvNm: string;
|
||||
sggNm: string;
|
||||
statsYr: string;
|
||||
statsCd: string;
|
||||
}
|
||||
|
||||
export interface ExceptionProcessingHistoryDialogProps {
|
||||
open: boolean;
|
||||
onOpenChange: (open: boolean) => void;
|
||||
queryContext?: ExceptionProcessingHistoryQueryContext | null;
|
||||
emptyMessage?: string;
|
||||
/** 반려 API 성공 후 (다이얼로그 내 목록 재조회 이후) 상위 화면 등에서 호출 */
|
||||
onRejectSuccess?: () => void | Promise<void>;
|
||||
}
|
||||
|
||||
type ExceptionHistoryGridRow = Record<string, string | number>;
|
||||
type ExceptionHistoryTabKey = "NV" | "IMR" | "HB";
|
||||
|
||||
const exceptionHistoryTabs: { value: ExceptionHistoryTabKey; label: string }[] = [
|
||||
{ value: "NV", label: "일반검증 내역" },
|
||||
{ value: "IMR", label: "I-MR 검증내역" },
|
||||
{ value: "HB", label: "HB 검증내역" },
|
||||
];
|
||||
|
||||
const TITLE = "예외처리 내역 조회";
|
||||
/** 예외처리 건만 */
|
||||
const PRCS_YN_LIST = "2";
|
||||
|
||||
export type ExceptionRejectSubmitItem = {
|
||||
vrfcSn: number;
|
||||
statsYr: string;
|
||||
sewerBzmnCd: string;
|
||||
statsCd: string;
|
||||
mdfrId: string;
|
||||
rjctOpnnCn?: string;
|
||||
};
|
||||
|
||||
function prcsYnCodeToNumber(raw: string | number | undefined): number | undefined {
|
||||
if (raw === undefined || raw === null) return undefined;
|
||||
if (typeof raw === "number" && Number.isFinite(raw)) return raw;
|
||||
const s = String(raw).trim();
|
||||
if (s === "") return undefined;
|
||||
const n = Number.parseInt(s, 10);
|
||||
return Number.isFinite(n) ? n : undefined;
|
||||
}
|
||||
|
||||
function exceptionPrcsYnNmCellStyle({ fieldName, row }: CellStyleCallbackParams): string | undefined {
|
||||
if (fieldName !== "prcsYnNm") return undefined;
|
||||
const code = prcsYnCodeToNumber(row.prcsYn);
|
||||
if (code === 0 || code === 4) return "rg-cell-vrf-prcs-bad";
|
||||
return "rg-cell-vrf-prcs-ok";
|
||||
}
|
||||
|
||||
const exceptionHistoryColumnInfo: ColumnInfo = {
|
||||
columns: [
|
||||
{ name: "ctpvNm", fieldName: "ctpvNm", header: { text: "시도" }, editable: false },
|
||||
{ name: "sggNm", fieldName: "sggNm", header: { text: "시군구" }, editable: false },
|
||||
{ name: "vrfcTrgtNm", fieldName: "vrfcTrgtNm", header: { text: "검증대상" }, editable: false },
|
||||
{ name: "rsnExpln", fieldName: "rsnExpln", header: { text: "사유" }, editable: false },
|
||||
{ name: "nowVlCn", fieldName: "nowVlCn", header: { text: "입력값" }, editable: false },
|
||||
{ name: "compVlCn", fieldName: "compVlCn", header: { text: "기준값" }, editable: false },
|
||||
{ name: "prcsYnNm", fieldName: "prcsYnNm", header: { text: "처리여부" }, editable: false },
|
||||
{ name: "pbcpAprvYn", fieldName: "pbcpAprvYn", header: { text: "공단승인여부" }, editable: false },
|
||||
{ name: "regDt", fieldName: "regDt", header: { text: "등록일시" }, editable: false },
|
||||
{ name: "mdfcnDt", fieldName: "mdfcnDt", header: { text: "갱신일시" }, editable: false },
|
||||
{
|
||||
name: "individualReject",
|
||||
fieldName: "individualReject",
|
||||
header: { text: "개별 반려" },
|
||||
editable: false,
|
||||
width: 104,
|
||||
styleName: "rg-cell-reject-mini-btn",
|
||||
},
|
||||
{ name: "prcsYn", fieldName: "prcsYn", header: { text: "검증결과상태코드" }, editable: false, visible: false },
|
||||
{ name: "vrfcSn", fieldName: "vrfcSn", header: { text: "vrfcSn" }, editable: false, visible: false },
|
||||
],
|
||||
columnLayout: [
|
||||
"ctpvNm",
|
||||
"sggNm",
|
||||
"vrfcTrgtNm",
|
||||
"rsnExpln",
|
||||
"nowVlCn",
|
||||
"compVlCn",
|
||||
"prcsYnNm",
|
||||
"pbcpAprvYn",
|
||||
"regDt",
|
||||
"mdfcnDt",
|
||||
"individualReject",
|
||||
"prcsYn",
|
||||
"vrfcSn",
|
||||
],
|
||||
};
|
||||
|
||||
export function ExceptionProcessingHistoryDialog({
|
||||
open,
|
||||
onOpenChange,
|
||||
queryContext,
|
||||
emptyMessage = "표시할 예외처리 내역이 없습니다.",
|
||||
onRejectSuccess,
|
||||
}: ExceptionProcessingHistoryDialogProps) {
|
||||
const { setMessage: alert } = useAlertStore((state) => state);
|
||||
const nvGridRef = useRef<RealGridReact | null>(null);
|
||||
const imrGridRef = useRef<RealGridReact | null>(null);
|
||||
const hbGridRef = useRef<RealGridReact | null>(null);
|
||||
const [rejectReasonDialogOpen, setRejectReasonDialogOpen] = useState(false);
|
||||
const [pendingRejectVrfcSns, setPendingRejectVrfcSns] = useState<number[]>([]);
|
||||
const [rejectReasonText, setRejectReasonText] = useState("");
|
||||
const [rejectSubmitting, setRejectSubmitting] = useState(false);
|
||||
|
||||
const [activeTab, setActiveTab] = useState<ExceptionHistoryTabKey>("NV");
|
||||
const [normalEntries, setNormalEntries] = useState<VerificationResultReportItem[]>([]);
|
||||
const [imrEntries, setImrEntries] = useState<VerificationResultReportItem[]>([]);
|
||||
const [hbEntries, setHbEntries] = useState<VerificationResultReportItem[]>([]);
|
||||
const [normalPageIndex, setNormalPageIndex] = useState(0);
|
||||
const [imrPageIndex, setImrPageIndex] = useState(0);
|
||||
const [hbPageIndex, setHbPageIndex] = useState(0);
|
||||
const [normalPageCount, setNormalPageCount] = useState(1);
|
||||
const [imrPageCount, setImrPageCount] = useState(1);
|
||||
const [hbPageCount, setHbPageCount] = useState(1);
|
||||
const [normalLoading, setNormalLoading] = useState(false);
|
||||
const [imrLoading, setImrLoading] = useState(false);
|
||||
const [hbLoading, setHbLoading] = useState(false);
|
||||
const [errorMessage, setErrorMessage] = useState<string | null>(null);
|
||||
|
||||
const resetState = useCallback(() => {
|
||||
setActiveTab("NV");
|
||||
setNormalEntries([]);
|
||||
setImrEntries([]);
|
||||
setHbEntries([]);
|
||||
setNormalPageIndex(0);
|
||||
setImrPageIndex(0);
|
||||
setHbPageIndex(0);
|
||||
setNormalPageCount(1);
|
||||
setImrPageCount(1);
|
||||
setHbPageCount(1);
|
||||
setNormalLoading(false);
|
||||
setImrLoading(false);
|
||||
setHbLoading(false);
|
||||
setErrorMessage(null);
|
||||
setRejectReasonDialogOpen(false);
|
||||
setPendingRejectVrfcSns([]);
|
||||
setRejectReasonText("");
|
||||
setRejectSubmitting(false);
|
||||
}, []);
|
||||
|
||||
const fetchPage = useCallback(
|
||||
async (vrfcMthdCd: ExceptionHistoryTabKey, pageIndex: number) => {
|
||||
if (!queryContext) return null;
|
||||
const param: VerificationResultListRequest = {
|
||||
sewerBzmnCd: queryContext.sewerBzmnCd,
|
||||
ctpvNm: queryContext.ctpvNm,
|
||||
sggNm: queryContext.sggNm,
|
||||
statsYr: queryContext.statsYr,
|
||||
statsCd: queryContext.statsCd,
|
||||
pbcpAprvYn: "N",
|
||||
vrfcMthdCd,
|
||||
prcsYnList: PRCS_YN_LIST,
|
||||
page: pageIndex + 1,
|
||||
size: 30,
|
||||
};
|
||||
return statisticsApi.getVerificationResultList(param);
|
||||
},
|
||||
[queryContext],
|
||||
);
|
||||
|
||||
const loadInitial = useCallback(async () => {
|
||||
if (!queryContext) {
|
||||
setErrorMessage("조회 조건이 없어 예외처리 내역을 불러올 수 없습니다.");
|
||||
return;
|
||||
}
|
||||
setErrorMessage(null);
|
||||
setNormalLoading(true);
|
||||
setImrLoading(true);
|
||||
setHbLoading(true);
|
||||
setNormalPageIndex(0);
|
||||
setImrPageIndex(0);
|
||||
setHbPageIndex(0);
|
||||
try {
|
||||
const [nvRes, imrRes, hbRes] = await Promise.all([
|
||||
fetchPage("NV", 0),
|
||||
fetchPage("IMR", 0),
|
||||
fetchPage("HB", 0),
|
||||
]);
|
||||
setNormalEntries(nvRes?.data?.verifyResultList ?? []);
|
||||
setImrEntries(imrRes?.data?.verifyResultList ?? []);
|
||||
setHbEntries(hbRes?.data?.verifyResultList ?? []);
|
||||
setNormalPageCount(nvRes?.data?.pageInfo?.totalPages ?? 1);
|
||||
setImrPageCount(imrRes?.data?.pageInfo?.totalPages ?? 1);
|
||||
setHbPageCount(hbRes?.data?.pageInfo?.totalPages ?? 1);
|
||||
} catch {
|
||||
setNormalEntries([]);
|
||||
setImrEntries([]);
|
||||
setHbEntries([]);
|
||||
setNormalPageCount(1);
|
||||
setImrPageCount(1);
|
||||
setHbPageCount(1);
|
||||
setErrorMessage("예외처리 내역 조회 중 오류가 발생했습니다.");
|
||||
} finally {
|
||||
setNormalLoading(false);
|
||||
setImrLoading(false);
|
||||
setHbLoading(false);
|
||||
}
|
||||
}, [fetchPage, queryContext]);
|
||||
|
||||
const handleNormalPageChange = useCallback(
|
||||
async (pageIndex: number) => {
|
||||
if (pageIndex === normalPageIndex || !queryContext) return;
|
||||
setErrorMessage(null);
|
||||
setNormalLoading(true);
|
||||
try {
|
||||
const response = await fetchPage("NV", pageIndex);
|
||||
setNormalEntries(response?.data?.verifyResultList ?? []);
|
||||
setNormalPageCount(response?.data?.pageInfo?.totalPages ?? 1);
|
||||
setNormalPageIndex(pageIndex);
|
||||
} catch {
|
||||
setErrorMessage("일반검증 내역 조회 중 오류가 발생했습니다.");
|
||||
} finally {
|
||||
setNormalLoading(false);
|
||||
}
|
||||
},
|
||||
[fetchPage, normalPageIndex, queryContext],
|
||||
);
|
||||
|
||||
const handleImrPageChange = useCallback(
|
||||
async (pageIndex: number) => {
|
||||
if (pageIndex === imrPageIndex || !queryContext) return;
|
||||
setErrorMessage(null);
|
||||
setImrLoading(true);
|
||||
try {
|
||||
const response = await fetchPage("IMR", pageIndex);
|
||||
setImrEntries(response?.data?.verifyResultList ?? []);
|
||||
setImrPageCount(response?.data?.pageInfo?.totalPages ?? 1);
|
||||
setImrPageIndex(pageIndex);
|
||||
} catch {
|
||||
setErrorMessage("I-MR 검증내역 조회 중 오류가 발생했습니다.");
|
||||
} finally {
|
||||
setImrLoading(false);
|
||||
}
|
||||
},
|
||||
[fetchPage, imrPageIndex, queryContext],
|
||||
);
|
||||
|
||||
const handleHbPageChange = useCallback(
|
||||
async (pageIndex: number) => {
|
||||
if (pageIndex === hbPageIndex || !queryContext) return;
|
||||
setErrorMessage(null);
|
||||
setHbLoading(true);
|
||||
try {
|
||||
const response = await fetchPage("HB", pageIndex);
|
||||
setHbEntries(response?.data?.verifyResultList ?? []);
|
||||
setHbPageCount(response?.data?.pageInfo?.totalPages ?? 1);
|
||||
setHbPageIndex(pageIndex);
|
||||
} catch {
|
||||
setErrorMessage("HB 검증내역 조회 중 오류가 발생했습니다.");
|
||||
} finally {
|
||||
setHbLoading(false);
|
||||
}
|
||||
},
|
||||
[fetchPage, hbPageIndex, queryContext],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) {
|
||||
resetState();
|
||||
return;
|
||||
}
|
||||
void loadInitial();
|
||||
}, [loadInitial, open, resetState]);
|
||||
|
||||
const mapRows = (entries: VerificationResultReportItem[]): ExceptionHistoryGridRow[] =>
|
||||
entries.map((item) => ({
|
||||
ctpvNm: item.ctpvNm,
|
||||
sggNm: item.sggNm,
|
||||
vrfcTrgtNm: item.vrfcTrgtNm,
|
||||
rsnExpln: item.rsnExpln,
|
||||
nowVlCn: item.nowVlCn ?? "-",
|
||||
compVlCn: item.compVlCn ?? "-",
|
||||
prcsYnNm: item.prcsYnNm ?? "-",
|
||||
prcsYn: item.prcsYn ?? "",
|
||||
pbcpAprvYn: item.pbcpAprvYn,
|
||||
regDt: (item.regDt ?? "").slice(0, 16),
|
||||
mdfcnDt: (item.mdfcnDt ?? "").slice(0, 16),
|
||||
individualReject: "개별 반려",
|
||||
vrfcSn: item.vrfcSn,
|
||||
}));
|
||||
|
||||
const normalRows = useMemo(() => mapRows(normalEntries), [normalEntries]);
|
||||
const imrRows = useMemo(() => mapRows(imrEntries), [imrEntries]);
|
||||
const hbRows = useMemo(() => mapRows(hbEntries), [hbEntries]);
|
||||
|
||||
const noopSetRows = ((_: SetStateAction<Record<string, string | number>[]>) => {}) as Dispatch<
|
||||
SetStateAction<Record<string, string | number>[]>
|
||||
>;
|
||||
|
||||
const handleOpenRejectReasonDialog = useCallback(() => {
|
||||
if (!queryContext) {
|
||||
alert("조회 조건이 없습니다.");
|
||||
return;
|
||||
}
|
||||
const rows =
|
||||
activeTab === "NV" ? normalRows : activeTab === "IMR" ? imrRows : hbRows;
|
||||
const gridRef =
|
||||
activeTab === "NV" ? nvGridRef : activeTab === "IMR" ? imrGridRef : hbGridRef;
|
||||
const gridView = gridRef.current?.gridView;
|
||||
if (!gridView) {
|
||||
alert("데이터가 존재하지 않습니다.");
|
||||
return;
|
||||
}
|
||||
const checkedIndices = (gridView.getCheckedRows?.(true, false, true) ?? []) as number[];
|
||||
if (checkedIndices.length === 0) {
|
||||
alert("반려할 항목을 체크해주세요.");
|
||||
return;
|
||||
}
|
||||
const vrfcSns: number[] = [];
|
||||
for (const itemIndex of checkedIndices) {
|
||||
const row = rows[itemIndex];
|
||||
if (!row) continue;
|
||||
const vrfcSn = Number(row.vrfcSn);
|
||||
if (!Number.isFinite(vrfcSn)) continue;
|
||||
vrfcSns.push(vrfcSn);
|
||||
}
|
||||
if (vrfcSns.length === 0) {
|
||||
alert("유효한 검증번호가 있는 행을 선택해주세요.");
|
||||
return;
|
||||
}
|
||||
setPendingRejectVrfcSns(vrfcSns);
|
||||
setRejectReasonText("");
|
||||
setRejectSubmitting(false);
|
||||
setRejectReasonDialogOpen(true);
|
||||
}, [activeTab, alert, hbRows, imrRows, normalRows, queryContext]);
|
||||
|
||||
const resetRejectReasonDialog = useCallback(() => {
|
||||
setRejectReasonDialogOpen(false);
|
||||
setPendingRejectVrfcSns([]);
|
||||
setRejectReasonText("");
|
||||
setRejectSubmitting(false);
|
||||
}, []);
|
||||
|
||||
const handleRejectReasonDialogOpenChange = useCallback(
|
||||
(nextOpen: boolean) => {
|
||||
if (!nextOpen) resetRejectReasonDialog();
|
||||
},
|
||||
[resetRejectReasonDialog],
|
||||
);
|
||||
|
||||
const handleConfirmReject = useCallback(async () => {
|
||||
if (!queryContext || pendingRejectVrfcSns.length === 0) {
|
||||
alert("반려할 항목이 없습니다. 다시 선택해주세요.");
|
||||
resetRejectReasonDialog();
|
||||
return;
|
||||
}
|
||||
let userInfo;
|
||||
try {
|
||||
userInfo = await getUserInfo();
|
||||
} catch {
|
||||
alert("사용자 정보를 불러오지 못했습니다.");
|
||||
return;
|
||||
}
|
||||
const mdfrId = userInfo.userUnqId;
|
||||
const trimmedReason = rejectReasonText.trim();
|
||||
|
||||
const items: ReviewInputSaveRequest[] = pendingRejectVrfcSns.map((vrfcSn) => ({
|
||||
type: "INPUT",
|
||||
statsYr: queryContext.statsYr,
|
||||
sewerBzmnCd: queryContext.sewerBzmnCd,
|
||||
statsCd: queryContext.statsCd,
|
||||
mdfrId,
|
||||
vrfcSn: String(vrfcSn),
|
||||
...(trimmedReason ? { rjctOpnnCn: trimmedReason } : {}),
|
||||
}));
|
||||
|
||||
setRejectSubmitting(true);
|
||||
try {
|
||||
const response = await statisticsApi.saveInputReturn(items);
|
||||
if (response.resultCode.toLowerCase() !== "success") {
|
||||
alert(response.message ?? "반려 처리 중 오류가 발생했습니다.");
|
||||
return;
|
||||
}
|
||||
alert("반려 처리되었습니다.");
|
||||
resetRejectReasonDialog();
|
||||
await Promise.all([
|
||||
loadInitial(),
|
||||
onRejectSuccess?.() ?? Promise.resolve(),
|
||||
]);
|
||||
} catch {
|
||||
alert("반려 처리 중 오류가 발생했습니다.");
|
||||
} finally {
|
||||
setRejectSubmitting(false);
|
||||
}
|
||||
}, [
|
||||
alert,
|
||||
loadInitial,
|
||||
onRejectSuccess,
|
||||
pendingRejectVrfcSns,
|
||||
queryContext,
|
||||
rejectReasonText,
|
||||
resetRejectReasonDialog,
|
||||
]);
|
||||
|
||||
const handleGridRowClick = useCallback(
|
||||
(rowData: Record<string, string | number>) => {
|
||||
const gridRef =
|
||||
activeTab === "NV" ? nvGridRef : activeTab === "IMR" ? imrGridRef : hbGridRef;
|
||||
const current = gridRef.current?.gridView?.getCurrent?.() as
|
||||
| { fieldName?: string; column?: string }
|
||||
| undefined;
|
||||
const fieldName = current?.fieldName ?? current?.column;
|
||||
if (fieldName !== "individualReject") return;
|
||||
const vrfcSn = Number(rowData.vrfcSn);
|
||||
if (!Number.isFinite(vrfcSn)) {
|
||||
alert("유효한 검증번호가 있는 행을 선택해주세요.");
|
||||
return;
|
||||
}
|
||||
setPendingRejectVrfcSns([vrfcSn]);
|
||||
setRejectReasonText("");
|
||||
setRejectSubmitting(false);
|
||||
setRejectReasonDialogOpen(true);
|
||||
},
|
||||
[activeTab, alert],
|
||||
);
|
||||
|
||||
const renderGrid = (
|
||||
rows: ExceptionHistoryGridRow[],
|
||||
pageIndex: number,
|
||||
pageCount: number,
|
||||
onPageIndexChange: (page: number) => void,
|
||||
loading: boolean,
|
||||
gridRef: MutableRefObject<RealGridReact | null>,
|
||||
) => {
|
||||
if (!loading && rows.length === 0) {
|
||||
return <p className="p-6 text-center text-[1.3rem] text-muted-foreground">{emptyMessage}</p>;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="relative space-y-2">
|
||||
<DataGrid
|
||||
columnInfo={exceptionHistoryColumnInfo}
|
||||
rowData={rows}
|
||||
setRowData={noopSetRows}
|
||||
isExcelImport={false}
|
||||
isExcelExport={false}
|
||||
showHeaderCheckbox={true}
|
||||
enableSort={false}
|
||||
getGridRef={gridRef}
|
||||
cellStyleCallback={exceptionPrcsYnNmCellStyle}
|
||||
onRowClick={handleGridRowClick}
|
||||
/>
|
||||
<VerificationResultHistoryPagination
|
||||
pageCount={Math.max(pageCount, 1)}
|
||||
pageIndex={Math.max(pageIndex, 0)}
|
||||
onPageIndexChange={onPageIndexChange}
|
||||
className="mx-2 mb-2"
|
||||
/>
|
||||
{loading && (
|
||||
<div className="absolute inset-0 z-10 rounded-md [data-theme='black']:bg-transparent bg-white/40 flex items-center justify-center">
|
||||
<div className="relative size-[5rem]">
|
||||
<LoadingWithAnimation color="primary" />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
<DialogContent className="max-w-[80%]" aria-describedby={undefined}>
|
||||
<DialogHeader>
|
||||
<DialogTitle>{`${TITLE} - ${queryContext?.statsYr} ${queryContext?.ctpvNm} ${queryContext?.sggNm}`}</DialogTitle>
|
||||
</DialogHeader>
|
||||
<div className="max-h-[85vh] space-y-5 overflow-auto">
|
||||
{errorMessage && (
|
||||
<p className="rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[1.2rem] text-destructive">
|
||||
{errorMessage}
|
||||
</p>
|
||||
)}
|
||||
<Tabs
|
||||
value={activeTab}
|
||||
onValueChange={(value) => setActiveTab(value as ExceptionHistoryTabKey)}
|
||||
className="w-full"
|
||||
variant="default"
|
||||
>
|
||||
<TabsList>
|
||||
{exceptionHistoryTabs.map((tab) => (
|
||||
<TabsTrigger key={tab.value} value={tab.value}>
|
||||
{tab.label}
|
||||
</TabsTrigger>
|
||||
))}
|
||||
</TabsList>
|
||||
<TabsContent value="NV" className="rounded-md border border-border">
|
||||
{renderGrid(
|
||||
normalRows,
|
||||
normalPageIndex,
|
||||
normalPageCount,
|
||||
handleNormalPageChange,
|
||||
normalLoading,
|
||||
nvGridRef,
|
||||
)}
|
||||
</TabsContent>
|
||||
<TabsContent value="IMR" className="rounded-md border border-border">
|
||||
{renderGrid(
|
||||
imrRows,
|
||||
imrPageIndex,
|
||||
imrPageCount,
|
||||
handleImrPageChange,
|
||||
imrLoading,
|
||||
imrGridRef,
|
||||
)}
|
||||
</TabsContent>
|
||||
<TabsContent value="HB" className="rounded-md border border-border">
|
||||
{renderGrid(
|
||||
hbRows,
|
||||
hbPageIndex,
|
||||
hbPageCount,
|
||||
handleHbPageChange,
|
||||
hbLoading,
|
||||
hbGridRef,
|
||||
)}
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
</div>
|
||||
<DialogFooter>
|
||||
<Button
|
||||
type="button"
|
||||
color="red"
|
||||
onClick={handleOpenRejectReasonDialog}
|
||||
disabled={rejectSubmitting}
|
||||
>
|
||||
일괄 반려
|
||||
</Button>
|
||||
<DialogClose asChild>
|
||||
<Button type="button" color="gray">
|
||||
닫기
|
||||
</Button>
|
||||
</DialogClose>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
|
||||
<Dialog open={rejectReasonDialogOpen} onOpenChange={handleRejectReasonDialogOpenChange}>
|
||||
<DialogContent className="max-w-[56rem]" aria-describedby={undefined}>
|
||||
<DialogHeader>
|
||||
<DialogTitle>예외처리 반려</DialogTitle>
|
||||
</DialogHeader>
|
||||
<div className="space-y-2 py-2">
|
||||
<Label htmlFor="exception-reject-reason" className="text-label">
|
||||
반려사유 (선택, 체크한 모든 행에 동일 적용)
|
||||
</Label>
|
||||
<Textarea
|
||||
id="exception-reject-reason"
|
||||
value={rejectReasonText}
|
||||
onChange={(e) => setRejectReasonText(e.target.value)}
|
||||
rows={4}
|
||||
className="min-h-[8rem] p-2 !text-xl"
|
||||
placeholder='미입력 시 "검증 리포트를 확인하여 주시기 바랍니다." 자동 주입'
|
||||
disabled={rejectSubmitting}
|
||||
/>
|
||||
</div>
|
||||
<DialogFooter>
|
||||
<Button
|
||||
type="button"
|
||||
color="red"
|
||||
disabled={rejectSubmitting}
|
||||
onClick={() => void handleConfirmReject()}
|
||||
>
|
||||
반려 확정
|
||||
</Button>
|
||||
<DialogClose asChild>
|
||||
<Button type="button" color="gray" disabled={rejectSubmitting}>
|
||||
취소
|
||||
</Button>
|
||||
</DialogClose>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -45,7 +45,7 @@ function prcsYnCodeToNumber(raw: string | number | undefined): number | undefine
|
||||
function verificationPrcsYnNmCellStyle({ fieldName, row }: CellStyleCallbackParams): string | undefined {
|
||||
if (fieldName !== "prcsYnNm") return undefined;
|
||||
const code = prcsYnCodeToNumber(row.prcsYn);
|
||||
if (code === 0 || code === 4) return "rg-cell-vrf-prcs-bad";
|
||||
if (code === 0 || code === 3) return "rg-cell-vrf-prcs-bad";
|
||||
return "rg-cell-vrf-prcs-ok";
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
Input,
|
||||
InputDatePicker,
|
||||
Label,
|
||||
} from "@common/components";
|
||||
|
||||
@@ -36,27 +37,43 @@ export interface MainFacilityMappingSaveDialogProps {
|
||||
onConfirm?: (values: MainFacilityMappingSaveDialogValues) => void | Promise<void>;
|
||||
}
|
||||
|
||||
function isValidYmd(ymd: string): boolean {
|
||||
if (!/^\d{8}$/.test(ymd)) return false;
|
||||
const y = Number(ymd.slice(0, 4));
|
||||
const m = Number(ymd.slice(4, 6));
|
||||
const d = Number(ymd.slice(6, 8));
|
||||
const dt = new Date(y, m - 1, d);
|
||||
return dt.getFullYear() === y && dt.getMonth() === m - 1 && dt.getDate() === d;
|
||||
function formatDateToYmd(d: Date | undefined): string | null {
|
||||
if (!d || Number.isNaN(d.getTime())) return null;
|
||||
const y = d.getFullYear();
|
||||
const m = String(d.getMonth() + 1).padStart(2, "0");
|
||||
const day = String(d.getDate()).padStart(2, "0");
|
||||
return `${y}${m}${day}`;
|
||||
}
|
||||
|
||||
function validatePrxyCtrtCn(value: string): string | null {
|
||||
const t = value.trim();
|
||||
if (!t) return "위탁계약기간을 입력해 주세요.";
|
||||
/** `YYYYMMDD` → `Date` (로컬 자정) */
|
||||
function parseYmdToDate(ymd: string): Date | undefined {
|
||||
const s = ymd.replace(/\D/g, "");
|
||||
if (s.length !== 8) return undefined;
|
||||
const y = Number(s.slice(0, 4));
|
||||
const mo = Number(s.slice(4, 6)) - 1;
|
||||
const day = Number(s.slice(6, 8));
|
||||
const d = new Date(y, mo, day);
|
||||
if (d.getFullYear() !== y || d.getMonth() !== mo || d.getDate() !== day) return undefined;
|
||||
return d;
|
||||
}
|
||||
|
||||
function parseInitialPrxyCtrtCnToDates(initial: string): { start: Date | undefined; end: Date | undefined } {
|
||||
const t = initial.trim();
|
||||
if (!/^\d{8}~\d{8}$/.test(t)) {
|
||||
return "위탁계약기간은 YYYYMMDD~YYYYMMDD 형식으로 입력해 주세요. (예: 20240101~20281231)";
|
||||
return { start: undefined, end: undefined };
|
||||
}
|
||||
const start = t.slice(0, 8);
|
||||
const end = t.slice(9, 17);
|
||||
if (!isValidYmd(start) || !isValidYmd(end)) {
|
||||
return "시작일 또는 종료일이 유효한 날짜가 아닙니다.";
|
||||
const start = parseYmdToDate(t.slice(0, 8));
|
||||
const end = parseYmdToDate(t.slice(9, 17));
|
||||
return { start, end };
|
||||
}
|
||||
|
||||
function validateContractRange(start: Date | undefined, end: Date | undefined): string | null {
|
||||
const startYmd = formatDateToYmd(start);
|
||||
const endYmd = formatDateToYmd(end);
|
||||
if (!startYmd || !endYmd) {
|
||||
return "시작일과 종료일을 선택해 주세요.";
|
||||
}
|
||||
if (start > end) {
|
||||
if (startYmd > endYmd) {
|
||||
return "시작일이 종료일보다 늦을 수 없습니다.";
|
||||
}
|
||||
return null;
|
||||
@@ -75,7 +92,8 @@ export function MainFacilityMappingSaveDialog({
|
||||
const [prxyBzentyNmCn, setPrxyBzentyNmCn] = useState("");
|
||||
const [cnsgnCstInput, setCnsgnCstInput] = useState("");
|
||||
const [wholNopeInput, setWholNopeInput] = useState("");
|
||||
const [prxyCtrtCn, setPrxyCtrtCn] = useState("");
|
||||
const [prxyCtrtStart, setPrxyCtrtStart] = useState<Date | undefined>(undefined);
|
||||
const [prxyCtrtEnd, setPrxyCtrtEnd] = useState<Date | undefined>(undefined);
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -94,7 +112,9 @@ export function MainFacilityMappingSaveDialog({
|
||||
? ""
|
||||
: String(initialWholNope),
|
||||
);
|
||||
setPrxyCtrtCn((initialPrxyCtrtCn ?? "").trim());
|
||||
const { start, end } = parseInitialPrxyCtrtCnToDates(initialPrxyCtrtCn ?? "");
|
||||
setPrxyCtrtStart(start);
|
||||
setPrxyCtrtEnd(end);
|
||||
}
|
||||
}, [open, initialPrxyBzentyNmCn, initialCnsgnCstVl, initialWholNope, initialPrxyCtrtCn]);
|
||||
|
||||
@@ -103,7 +123,8 @@ export function MainFacilityMappingSaveDialog({
|
||||
setPrxyBzentyNmCn("");
|
||||
setCnsgnCstInput("");
|
||||
setWholNopeInput("");
|
||||
setPrxyCtrtCn("");
|
||||
setPrxyCtrtStart(undefined);
|
||||
setPrxyCtrtEnd(undefined);
|
||||
}
|
||||
onOpenChange(nextOpen);
|
||||
};
|
||||
@@ -121,18 +142,21 @@ export function MainFacilityMappingSaveDialog({
|
||||
alert("전체 인원은 0 이상의 정수로 입력해 주세요.");
|
||||
return;
|
||||
}
|
||||
const prxyCtrtErr = validatePrxyCtrtCn(prxyCtrtCn);
|
||||
const prxyCtrtErr = validateContractRange(prxyCtrtStart, prxyCtrtEnd);
|
||||
if (prxyCtrtErr) {
|
||||
alert(prxyCtrtErr);
|
||||
return;
|
||||
}
|
||||
const startYmd = formatDateToYmd(prxyCtrtStart)!;
|
||||
const endYmd = formatDateToYmd(prxyCtrtEnd)!;
|
||||
const prxyCtrtCnParam = `${startYmd}~${endYmd}`;
|
||||
try {
|
||||
setIsSubmitting(true);
|
||||
await onConfirm?.({
|
||||
prxyBzentyNmCn: prxyBzentyNmCn.trim(),
|
||||
cnsgnCstVl,
|
||||
wholNope,
|
||||
prxyCtrtCn: prxyCtrtCn.trim(),
|
||||
prxyCtrtCn: prxyCtrtCnParam,
|
||||
});
|
||||
} finally {
|
||||
setIsSubmitting(false);
|
||||
@@ -193,14 +217,26 @@ export function MainFacilityMappingSaveDialog({
|
||||
</div>
|
||||
<div className="flex flex-col gap-2">
|
||||
<Label className="text-label">위탁계약기간</Label>
|
||||
<Input
|
||||
value={prxyCtrtCn}
|
||||
onChange={(e) => setPrxyCtrtCn(e.target.value)}
|
||||
className="!text-[1.3rem]"
|
||||
placeholder="YYYYMMDD~YYYYMMDD (예: 20240101~20281231)"
|
||||
autoComplete="off"
|
||||
disabled={isSubmitting}
|
||||
/>
|
||||
<div className="flex flex-col gap-3 sm:flex-row sm:items-end sm:gap-4">
|
||||
<div className="flex min-w-0 flex-1 flex-col gap-2">
|
||||
<Label className="text-label text-[1.2rem]">시작일</Label>
|
||||
<InputDatePicker
|
||||
value={prxyCtrtStart}
|
||||
onChange={setPrxyCtrtStart}
|
||||
className="w-full"
|
||||
disabled={isSubmitting}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex min-w-0 flex-1 flex-col gap-2">
|
||||
<Label className="text-label text-[1.2rem]">종료일</Label>
|
||||
<InputDatePicker
|
||||
value={prxyCtrtEnd}
|
||||
onChange={setPrxyCtrtEnd}
|
||||
className="w-full"
|
||||
disabled={isSubmitting}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<DialogFooter>
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useEffect, useRef, useState } from 'react';
|
||||
|
||||
import { useConfirm } from '@frontend-opensource/use-react-hooks';
|
||||
|
||||
import { useAlertStore, useGlobalProgressStore } from '@/shared/lib';
|
||||
import { useAlertStore, useGlobalProgressStore, useStatisticsInputToolbarGroupGate } from '@/shared/lib';
|
||||
import { statisticsInputSewSupplyRateApi } from '@/entities/statistics/api/input/statistics-input-sew-supply-rate-service';
|
||||
import { statisticsInputPublicSewageFacilityApiService } from '@/entities/statistics/api/input/statistics-public-sewage-facility-input-service';
|
||||
import { statisticsApi } from '@/entities/statistics/api/statistics-service';
|
||||
@@ -26,7 +26,7 @@ import { LoadingWithAnimation, Tabs, TabsContent, TabsList, TabsTrigger } from '
|
||||
|
||||
import { getUserInfo } from '../../../../../../packages/common/components/src/api';
|
||||
|
||||
import { MainFacilityMappingSaveDialog } from './MainFacilityMappingSaveDialog';
|
||||
import { MainFacilityMappingSaveDialog, type MainFacilityMappingSaveDialogValues } from './MainFacilityMappingSaveDialog';
|
||||
import SubmitDailog from './SubmitDailog';
|
||||
|
||||
import CancelSubmitButton from '@/components/button/CancelSubmitButton';
|
||||
@@ -145,6 +145,7 @@ const PublicSewageFacilityInp = () => {
|
||||
const { setMessage: alert } = useAlertStore((state) => state);
|
||||
const { confirm } = useConfirm();
|
||||
const { isAdminInfo } = useAdminStore();
|
||||
const toolbarGroupAllowed = useStatisticsInputToolbarGroupGate();
|
||||
const showGlobalProgress = useGlobalProgressStore((state) => state.show);
|
||||
const setGlobalProgress = useGlobalProgressStore((state) => state.setProgress);
|
||||
const setGlobalProgressLabel = useGlobalProgressStore((state) => state.setLabel);
|
||||
@@ -175,7 +176,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') {
|
||||
@@ -415,6 +416,13 @@ const PublicSewageFacilityInp = () => {
|
||||
.filter((sn) => sn !== '');
|
||||
|
||||
const wholNopeFromRow = Number(selectedMain.wholNope ?? 0);
|
||||
const deleteOnly = saveList.length === 0 && deleteList.length > 0;
|
||||
const nothingToPersist = saveList.length === 0 && deleteList.length === 0;
|
||||
if (nothingToPersist) {
|
||||
alert('저장할 변경 사항이 없습니다.');
|
||||
return;
|
||||
}
|
||||
|
||||
mainFacilityMappingSaveDraftRef.current = {
|
||||
statsYr: lastSearchedValues.year ?? '',
|
||||
sewerBzmnCd: lastSearchedValues.bsnmCd ?? '',
|
||||
@@ -429,6 +437,16 @@ const PublicSewageFacilityInp = () => {
|
||||
initialWholNope: Number.isFinite(wholNopeFromRow) ? wholNopeFromRow : 0,
|
||||
initialPrxyCtrtCn: String(selectedMain.prxyCtrtCn ?? ''),
|
||||
};
|
||||
|
||||
if (deleteOnly) {
|
||||
const draft = mainFacilityMappingSaveDraftRef.current;
|
||||
const ok = await runMainFacilityMappingSave(draft, null);
|
||||
if (ok) {
|
||||
mainFacilityMappingSaveDraftRef.current = null;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
setMainFacilityMappingSaveDialogKey((k) => k + 1);
|
||||
setMainFacilityMappingSaveDialogOpen(true);
|
||||
return;
|
||||
@@ -671,42 +689,40 @@ const PublicSewageFacilityInp = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const handleMainFacilityMappingSaveConfirm = async (input: {
|
||||
prxyBzentyNmCn: string;
|
||||
cnsgnCstVl: number;
|
||||
wholNope: number;
|
||||
prxyCtrtCn: string;
|
||||
}) => {
|
||||
const draft = mainFacilityMappingSaveDraftRef.current;
|
||||
if (!draft || !searchParamRef.current || !lastSearchedValues) {
|
||||
setMainFacilityMappingSaveDialogOpen(false);
|
||||
mainFacilityMappingSaveDraftRef.current = null;
|
||||
return;
|
||||
const runMainFacilityMappingSave = async (
|
||||
draft: MainFacilityMappingSaveDraft,
|
||||
dialogInput: MainFacilityMappingSaveDialogValues | null,
|
||||
): Promise<boolean> => {
|
||||
if (!searchParamRef.current || !lastSearchedValues) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
showGlobalProgress({ label: '저장 진행 중...', progress: 0 });
|
||||
const userInfo = await getUserInfo();
|
||||
const param: PublicSewageMainFacilityMappingSaveRequest = {
|
||||
const base = {
|
||||
statsYr: draft.statsYr,
|
||||
sewerBzmnCd: draft.sewerBzmnCd,
|
||||
admdstCd: draft.admdstCd,
|
||||
admdstNm: draft.admdstNm,
|
||||
mainFcltSn: draft.mainFcltSn,
|
||||
mainFcltNm: draft.mainFcltNm,
|
||||
prxyBzentyNmCn: input.prxyBzentyNmCn,
|
||||
cnsgnCstVl: input.cnsgnCstVl,
|
||||
wholNope: input.wholNope,
|
||||
prxyCtrtCn: input.prxyCtrtCn,
|
||||
userId: userInfo.userUnqId,
|
||||
saveList: draft.saveList,
|
||||
deleteList: draft.deleteList,
|
||||
};
|
||||
const param: PublicSewageMainFacilityMappingSaveRequest = dialogInput
|
||||
? {
|
||||
...base,
|
||||
prxyBzentyNmCn: dialogInput.prxyBzentyNmCn,
|
||||
cnsgnCstVl: dialogInput.cnsgnCstVl,
|
||||
wholNope: dialogInput.wholNope,
|
||||
prxyCtrtCn: dialogInput.prxyCtrtCn,
|
||||
}
|
||||
: { ...base };
|
||||
const response =
|
||||
await statisticsInputPublicSewageFacilityApiService.saveMainFacilityMapping(param);
|
||||
if (response.status === 'success') {
|
||||
setGlobalProgress(50);
|
||||
setMainFacilityMappingSaveDialogOpen(false);
|
||||
mainFacilityMappingSaveDraftRef.current = null;
|
||||
await loadPublicSewageFacilityActiveTabData(
|
||||
'ST00060002',
|
||||
searchParamRef.current,
|
||||
@@ -714,16 +730,32 @@ const PublicSewageFacilityInp = () => {
|
||||
);
|
||||
setGlobalProgress(100);
|
||||
alert('저장되었습니다.');
|
||||
} else {
|
||||
alert(response.message || '데이터 저장 중 오류가 발생했습니다.');
|
||||
return true;
|
||||
}
|
||||
alert(response.message || '데이터 저장 중 오류가 발생했습니다.');
|
||||
return false;
|
||||
} catch {
|
||||
alert('데이터 저장 중 오류가 발생했습니다.');
|
||||
return false;
|
||||
} finally {
|
||||
hideGlobalProgress();
|
||||
}
|
||||
};
|
||||
|
||||
const handleMainFacilityMappingSaveConfirm = async (input: MainFacilityMappingSaveDialogValues) => {
|
||||
const draft = mainFacilityMappingSaveDraftRef.current;
|
||||
if (!draft || !searchParamRef.current || !lastSearchedValues) {
|
||||
setMainFacilityMappingSaveDialogOpen(false);
|
||||
mainFacilityMappingSaveDraftRef.current = null;
|
||||
return;
|
||||
}
|
||||
const ok = await runMainFacilityMappingSave(draft, input);
|
||||
if (ok) {
|
||||
setMainFacilityMappingSaveDialogOpen(false);
|
||||
mainFacilityMappingSaveDraftRef.current = null;
|
||||
}
|
||||
};
|
||||
|
||||
const handleSearch = async (values: SearchFormValues) => {
|
||||
if (!values.sido || values.sido === 'ALL') {
|
||||
alert('시도를 선택해주세요.');
|
||||
@@ -891,7 +923,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' : '',
|
||||
}));
|
||||
@@ -924,7 +960,14 @@ const PublicSewageFacilityInp = () => {
|
||||
inputPeriodEnterable,
|
||||
isAdminInfo,
|
||||
);
|
||||
const { showSaveInToolbar, showEnterableToolbarButtons, showActionToolbarCard } = activeTabToolbar;
|
||||
const {
|
||||
showSaveInToolbar: baseShowSaveInToolbar,
|
||||
showEnterableToolbarButtons: baseShowEnterableToolbarButtons,
|
||||
showActionToolbarCard: baseShowActionToolbarCard,
|
||||
} = activeTabToolbar;
|
||||
const showSaveInToolbar = baseShowSaveInToolbar && toolbarGroupAllowed;
|
||||
const showEnterableToolbarButtons = baseShowEnterableToolbarButtons && toolbarGroupAllowed;
|
||||
const showActionToolbarCard = baseShowActionToolbarCard && toolbarGroupAllowed;
|
||||
const isMainFacilityTab = activeTab === 'ST00060002';
|
||||
|
||||
const openVerificationHistoryDialog = () => {
|
||||
@@ -961,7 +1004,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 +1012,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 +1028,7 @@ const PublicSewageFacilityInp = () => {
|
||||
<div className="relative size-[5rem]">
|
||||
<LoadingWithAnimation color="primary" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<Tabs value={activeTab} onValueChange={(v) => void handleActiveTabChange(v)}>
|
||||
<TabsList>
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useEffect, useLayoutEffect,useMemo, useRef, useState } from "react";
|
||||
|
||||
import { useConfirm } from "@frontend-opensource/use-react-hooks";
|
||||
|
||||
import { useAlertStore, useGlobalProgressStore } from "@/shared/lib";
|
||||
import { useAlertStore, useGlobalProgressStore, useStatisticsInputToolbarGroupGate } from "@/shared/lib";
|
||||
import {
|
||||
STATISTICS_INPUT_URL_PATH,
|
||||
verificationSearchToFormValues,
|
||||
@@ -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));
|
||||
|
||||
@@ -375,6 +375,7 @@ const SewagePipeInp = () => {
|
||||
const hideGlobalProgress = useGlobalProgressStore((state) => state.hide);
|
||||
const globalProgressVisible = useGlobalProgressStore((state) => state.visible);
|
||||
const { isAdminInfo } = useAdminStore();
|
||||
const toolbarGroupAllowed = useStatisticsInputToolbarGroupGate();
|
||||
|
||||
const getGridDataRef = useRef<(() => Record<string, string | number>[]) | null>(null);
|
||||
const getFactInstallGridDataRef = useRef<(() => Record<string, string | number>[]) | null>(null);
|
||||
@@ -841,27 +842,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 +904,7 @@ const SewagePipeInp = () => {
|
||||
};
|
||||
|
||||
const submitFunc = async (isException: boolean) => {
|
||||
const tabKey = activeTabRef.current;
|
||||
// const tabKey = activeTabRef.current;
|
||||
const verificationBlocked = getVerificationPeriodActionBlockedMessage(periodCheckList);
|
||||
if (verificationBlocked) {
|
||||
alert(verificationBlocked);
|
||||
@@ -1783,10 +1784,12 @@ const SewagePipeInp = () => {
|
||||
showEnterableToolbarButtons: baseShowEnterableToolbarButtons,
|
||||
showActionToolbarCard: baseShowActionToolbarCard,
|
||||
} = activeTabToolbar;
|
||||
const showSaveInToolbar = !hideToolbarForConnectionTab && baseShowSaveInToolbar;
|
||||
const showSaveInToolbar =
|
||||
!hideToolbarForConnectionTab && baseShowSaveInToolbar && toolbarGroupAllowed;
|
||||
const showEnterableToolbarButtons =
|
||||
!hideToolbarForConnectionTab && baseShowEnterableToolbarButtons;
|
||||
const showActionToolbarCard = !hideToolbarForConnectionTab && baseShowActionToolbarCard;
|
||||
!hideToolbarForConnectionTab && baseShowEnterableToolbarButtons && toolbarGroupAllowed;
|
||||
const showActionToolbarCard =
|
||||
!hideToolbarForConnectionTab && baseShowActionToolbarCard && toolbarGroupAllowed;
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
||||
|
||||
import { useConfirm } from "@frontend-opensource/use-react-hooks";
|
||||
|
||||
import { useAlertStore, useGlobalProgressStore } from "@/shared/lib";
|
||||
import { useAlertStore, useGlobalProgressStore, useStatisticsInputToolbarGroupGate } from "@/shared/lib";
|
||||
import {
|
||||
STATISTICS_INPUT_URL_PATH,
|
||||
verificationSearchToFormValues,
|
||||
@@ -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));
|
||||
|
||||
@@ -192,6 +192,7 @@ const SeweragePenetrationRateInp = () => {
|
||||
}, [activeTabId]);
|
||||
|
||||
const { isAdminInfo } = useAdminStore();
|
||||
const toolbarGroupAllowed = useStatisticsInputToolbarGroupGate();
|
||||
|
||||
const getGridDataRef = useRef<(() => Record<string, string | number>[]) | null>(null);
|
||||
|
||||
@@ -710,12 +711,15 @@ const SeweragePenetrationRateInp = () => {
|
||||
? Boolean(lastSearchedValues?.gugun && lastSearchedValues.gugun !== 'ALL')
|
||||
: true;
|
||||
|
||||
const showSaveInToolbar = (isEnterable || isAdminInfo) && gugunOkOrNotDoList;
|
||||
const showEnterableToolbarButtons = isEnterable && gugunOkOrNotDoList;
|
||||
const baseShowSaveInToolbar = (isEnterable || isAdminInfo) && gugunOkOrNotDoList;
|
||||
const baseShowEnterableToolbarButtons = isEnterable && gugunOkOrNotDoList;
|
||||
const showSaveInToolbar = baseShowSaveInToolbar && toolbarGroupAllowed;
|
||||
const showEnterableToolbarButtons = baseShowEnterableToolbarButtons && toolbarGroupAllowed;
|
||||
/** 카드는 저장/제출줄/제출취소 중 하나라도 보일 때만 (관리자만으로 빈 카드 방지) */
|
||||
const showActionToolbarCard =
|
||||
rowData.length > 0 &&
|
||||
(showSaveInToolbar ||
|
||||
toolbarGroupAllowed &&
|
||||
(baseShowSaveInToolbar ||
|
||||
(statusInfo?.laeSbmsnSttsCd === '2' && (isAdminInfo || (isEnterable && gugunOkOrNotDoList))));
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,21 +1,32 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
|
||||
import { useConfirm } from "@frontend-opensource/use-react-hooks";
|
||||
import { RealGridReact } from "realgrid-react";
|
||||
import useSWR, { useSWRConfig } from "swr";
|
||||
|
||||
import { useAlertStore } from "@/shared/lib";
|
||||
import { useAlertStore, useStatisticsInputStatusConfirmGroupGate } 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 { LoadingWithAnimation } from "@common/components";
|
||||
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";
|
||||
@@ -31,7 +42,9 @@ const getStatsInputStatusFetcher = async (
|
||||
|
||||
// 하수도 통계 관리 > 00. 통계 입력 현황
|
||||
const StatsInputStatusInp = () => {
|
||||
|
||||
const { setMessage: alert } = useAlertStore((state) => state);
|
||||
const { confirm } = useConfirm();
|
||||
const activeTabId = useTabStore((state) => state.activeTabId);
|
||||
const [rowData, setRowData] = useState<Record<string, string | number>[]>(
|
||||
[],
|
||||
@@ -44,6 +57,12 @@ 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 [isApproveLoading, setIsApproveLoading] = useState(false);
|
||||
const confirmGroupToolbarAllowed = useStatisticsInputStatusConfirmGroupGate();
|
||||
|
||||
const swrKey = searchParams
|
||||
? (["stats-input-status", searchParams] as const)
|
||||
@@ -56,7 +75,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,14 +143,18 @@ const StatsInputStatusInp = () => {
|
||||
setHasCompletedSearch(false);
|
||||
periodCheckListRef.current = [];
|
||||
inputPeriodCurrentRef.current = false;
|
||||
setExceptionHistoryOpen(false);
|
||||
setExceptionHistoryContext(null);
|
||||
setIsApproveLoading(false);
|
||||
};
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -139,14 +167,106 @@ const StatsInputStatusInp = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
// 승인 요청 로직
|
||||
if (!(await confirm("조회된 통계 항목을 승인하시겠습니까?"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
setIsApproveLoading(true);
|
||||
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.resultCode.toLocaleLowerCase() === "success") {
|
||||
if (searchParams) {
|
||||
await mutate(["stats-input-status", searchParams]);
|
||||
}
|
||||
alert(response.message ?? "승인되었습니다.");
|
||||
} else {
|
||||
alert(response.message ?? "승인에 실패했습니다.");
|
||||
}
|
||||
} catch {
|
||||
alert("승인 처리 중 오류가 발생했습니다.");
|
||||
} finally {
|
||||
setIsApproveLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
const allRowsLaeSbmsnApproved = useMemo(
|
||||
() =>
|
||||
rowData.length > 0 &&
|
||||
rowData.every((row) => String(row.laeSbmsnSttsCd ?? "") === "3"),
|
||||
[rowData],
|
||||
);
|
||||
|
||||
const showActionToolbarCard =
|
||||
hasCompletedSearch && rowData.length > 0 && gugunOkOrNotDoList && inputPeriodCurrentRef.current;
|
||||
hasCompletedSearch &&
|
||||
rowData.length > 0 &&
|
||||
gugunOkOrNotDoList &&
|
||||
inputPeriodCurrentRef.current &&
|
||||
!allRowsLaeSbmsnApproved &&
|
||||
confirmGroupToolbarAllowed;
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -159,7 +279,7 @@ const StatsInputStatusInp = () => {
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{isLoading && (
|
||||
{(isLoading || isApproveLoading) && (
|
||||
<div className="[data-theme='black']:bg-transparent absolute inset-0 z-50 flex items-center justify-center rounded-lg p-10">
|
||||
<div className="relative size-[5rem]">
|
||||
<LoadingWithAnimation color="primary" />
|
||||
@@ -173,8 +293,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 +318,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,4 +1,4 @@
|
||||
import { useRef, useState } from "react";
|
||||
import { useCallback, useRef, useState } from "react";
|
||||
|
||||
import { useAlertStore } from "@/shared/lib";
|
||||
import { statisticsApi } from "@/entities/statistics/api/statistics-service";
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
|
||||
import DataGrid from "@/components/module/DataGrid";
|
||||
import SearchForm from "@/components/module/SearchForm";
|
||||
import type { ColumnConfig } from "@/components/type/DataGrid.type";
|
||||
import type { ColumnConfig, DataCellClickCallbackParams } from "@/components/type/DataGrid.type";
|
||||
import type { SearchFormValues } from "@/components/type/SearchForm.type";
|
||||
import { toGridRows } from "@/components/util/grid/gridFunction";
|
||||
|
||||
@@ -53,6 +53,8 @@ function formatYmdForDisplay(ymd: string): string {
|
||||
return `${s.slice(0, 4)}-${s.slice(4, 6)}-${s.slice(6, 8)}`;
|
||||
}
|
||||
|
||||
const PERIOD_DETAIL_FIELD = "detailInfo";
|
||||
|
||||
const StatisticsInputManagement = () => {
|
||||
const { setMessage: alert } = useAlertStore((state) => state);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
@@ -88,6 +90,7 @@ const StatisticsInputManagement = () => {
|
||||
seType: seTypeToDisplayLabel(row.seType),
|
||||
inptBgngYmd: formatYmdForDisplay(row.inptBgngYmd),
|
||||
inptEndYmd: formatYmdForDisplay(row.inptEndYmd),
|
||||
[PERIOD_DETAIL_FIELD]: "상세정보",
|
||||
}));
|
||||
setRowData(toGridRows(rowsForGrid));
|
||||
} else {
|
||||
@@ -119,48 +122,59 @@ const StatisticsInputManagement = () => {
|
||||
setPeriodDialogOpen(true);
|
||||
};
|
||||
|
||||
const handleRowClick = async (row: Record<string, string | number>) => {
|
||||
const seCdRaw = row.seCd;
|
||||
const seCdNum =
|
||||
typeof seCdRaw === "number"
|
||||
? seCdRaw
|
||||
: parseInt(String(seCdRaw ?? ""), 10);
|
||||
const seCd = Number.isFinite(seCdNum) ? seCdNum : 0;
|
||||
const statsYr = String(row.statsYr ?? "");
|
||||
const seType = rowSeTypeToCode(row);
|
||||
const openPeriodDetailForRow = useCallback(
|
||||
async (row: Record<string, string | number>) => {
|
||||
const seCdRaw = row.seCd;
|
||||
const seCdNum =
|
||||
typeof seCdRaw === "number"
|
||||
? seCdRaw
|
||||
: parseInt(String(seCdRaw ?? ""), 10);
|
||||
const seCd = Number.isFinite(seCdNum) ? seCdNum : 0;
|
||||
const statsYr = String(row.statsYr ?? "");
|
||||
const seType = rowSeTypeToCode(row);
|
||||
|
||||
try {
|
||||
setIsLoading(true);
|
||||
const res = await statisticsApi.getStatsInputPeriodDetail({
|
||||
statsYr,
|
||||
seType,
|
||||
seCd,
|
||||
});
|
||||
try {
|
||||
setIsLoading(true);
|
||||
const res = await statisticsApi.getStatsInputPeriodDetail({
|
||||
statsYr,
|
||||
seType,
|
||||
seCd,
|
||||
});
|
||||
|
||||
if (res.status !== "success" || !res.data) {
|
||||
alert(res.message || "상세 정보를 조회하지 못했습니다.");
|
||||
return;
|
||||
if (res.status !== "success" || !res.data) {
|
||||
alert(res.message || "상세 정보를 조회하지 못했습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
const detail = res.data;
|
||||
setPeriodDialogMode("edit");
|
||||
setPeriodDialogInitial({
|
||||
statsYr: String(detail.statsYr ?? statsYr),
|
||||
seType: detail.seType === "VRFC" ? "VRFC" : "INPT",
|
||||
seCd:
|
||||
typeof detail.seCd === "number" && Number.isFinite(detail.seCd)
|
||||
? detail.seCd
|
||||
: seCd,
|
||||
inptBgngYmd: parseYmdToDate(detail.inptBgngYmd),
|
||||
inptEndYmd: parseYmdToDate(detail.inptEndYmd),
|
||||
});
|
||||
setPeriodDialogOpen(true);
|
||||
} catch {
|
||||
alert("상세 정보 조회 중 오류가 발생했습니다.");
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
},
|
||||
[alert],
|
||||
);
|
||||
|
||||
const detail = res.data;
|
||||
setPeriodDialogMode("edit");
|
||||
setPeriodDialogInitial({
|
||||
statsYr: String(detail.statsYr ?? statsYr),
|
||||
seType: detail.seType === "VRFC" ? "VRFC" : "INPT",
|
||||
seCd:
|
||||
typeof detail.seCd === "number" && Number.isFinite(detail.seCd)
|
||||
? detail.seCd
|
||||
: seCd,
|
||||
inptBgngYmd: parseYmdToDate(detail.inptBgngYmd),
|
||||
inptEndYmd: parseYmdToDate(detail.inptEndYmd),
|
||||
});
|
||||
setPeriodDialogOpen(true);
|
||||
} catch {
|
||||
alert("상세 정보 조회 중 오류가 발생했습니다.");
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
const handlePeriodDetailCellClick = useCallback(
|
||||
({ fieldName, row }: DataCellClickCallbackParams) => {
|
||||
if (fieldName !== PERIOD_DETAIL_FIELD) return;
|
||||
void openPeriodDetailForRow(row);
|
||||
},
|
||||
[openPeriodDetailForRow],
|
||||
);
|
||||
|
||||
const columns: ColumnConfig[] = [
|
||||
{
|
||||
@@ -193,6 +207,14 @@ const StatisticsInputManagement = () => {
|
||||
header: { text: "종료일" },
|
||||
editable: false,
|
||||
},
|
||||
{
|
||||
name: PERIOD_DETAIL_FIELD,
|
||||
fieldName: PERIOD_DETAIL_FIELD,
|
||||
header: { text: "상세정보" },
|
||||
editable: false,
|
||||
width: 118,
|
||||
styleName: "rg-cell-outline-action-btn",
|
||||
},
|
||||
];
|
||||
|
||||
const columnLayout = [
|
||||
@@ -201,6 +223,7 @@ const StatisticsInputManagement = () => {
|
||||
"seCd",
|
||||
"inptBgngYmd",
|
||||
"inptEndYmd",
|
||||
PERIOD_DETAIL_FIELD,
|
||||
];
|
||||
|
||||
return (
|
||||
@@ -232,7 +255,7 @@ const StatisticsInputManagement = () => {
|
||||
setRowData={setRowData}
|
||||
isExcelImport={false}
|
||||
isExcelExport={false}
|
||||
onRowClick={handleRowClick}
|
||||
onDataCellClick={handlePeriodDetailCellClick}
|
||||
/>
|
||||
<StatisticsInputPeriodDialog
|
||||
open={periodDialogOpen}
|
||||
|
||||
@@ -3,37 +3,92 @@ import { useState } from "react";
|
||||
import DataGrid from "@/components/module/DataGrid";
|
||||
import SearchForm from "@/components/module/SearchForm";
|
||||
import type { ColumnConfig } from "@/components/type/DataGrid.type";
|
||||
import type { SearchFormValues } from "@/components/type/SearchForm.type";
|
||||
import { toGridRows } from "@/components/util/grid/gridFunction";
|
||||
import { statisticsApi } from "@/entities/statistics/api/statistics-service";
|
||||
import { useAlertStore } from "@/shared/lib";
|
||||
import { LoadingWithAnimation } from "@common/components";
|
||||
|
||||
const StatisticsReviewHistory = () => {
|
||||
const { setMessage: alert } = useAlertStore((state) => state);
|
||||
const [rowData, setRowData] = useState<Record<string, string | number>[]>([]);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
const columns: ColumnConfig[] = [
|
||||
{ name: 'sido', fieldName: '시도', header: { text: '시도' }, mergeCells: true, editable: false, sortdisable: true },
|
||||
{ name: 'sgg', fieldName: '시군구', header: { text: '시군구' }, mergeCells: true, editable: false, sortdisable: true },
|
||||
{ name: '구분', fieldName: '구분', header: { text: '구분' }, editable: false, sortdisable: true },
|
||||
{ name: '광역자치단체', fieldName: '광역자치단체', header: { text: '광역자치단체' }, editable: false, sortdisable: true },
|
||||
{ name: '공단', fieldName: '공단', header: { text: '공단' }, editable: false, sortdisable: true },
|
||||
{ name: '처리내역', fieldName: '처리내역', header: { text: '처리내역' }, editable: false, sortdisable: true },
|
||||
{ name: "statsYr", fieldName: "statsYr", header: { text: "연도" }, editable: false },
|
||||
{ name: "ctpvNm", fieldName: "ctpvNm", header: { text: "시도" }, editable: false },
|
||||
{ name: "sggNm", fieldName: "sggNm", header: { text: "시군구" }, editable: false },
|
||||
{ name: "sewerBzmnCd", fieldName: "sewerBzmnCd", header: { text: "하수사업자코드" }, editable: false },
|
||||
{ name: "statsCd", fieldName: "statsCd", header: { text: "통계코드" }, editable: false },
|
||||
{ name: "menuNm", fieldName: "menuNm", header: { text: "통계항목" }, editable: false },
|
||||
{ name: "chckerOpinionSm", fieldName: "chckerOpinionSm", header: { text: "검토자의견" }, editable: false },
|
||||
{ name: "wrterOpinionSm", fieldName: "wrterOpinionSm", header: { text: "처리내역" }, editable: false },
|
||||
];
|
||||
|
||||
const columnLayout = [
|
||||
'sido',
|
||||
'sgg',
|
||||
'구분',
|
||||
{
|
||||
name: 'groupA',
|
||||
hideChildHeaders: false,
|
||||
header: { text: '검토내역' },
|
||||
items: ['광역자치단체', '공단', '처리내역'],
|
||||
},
|
||||
"statsYr",
|
||||
"ctpvNm",
|
||||
"sggNm",
|
||||
"sewerBzmnCd",
|
||||
"statsCd",
|
||||
"menuNm",
|
||||
"chckerOpinionSm",
|
||||
"wrterOpinionSm",
|
||||
];
|
||||
|
||||
const handleSearch = async (values: SearchFormValues) => {
|
||||
if (!values.year?.trim()) {
|
||||
alert("년도를 선택해주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
setIsLoading(true);
|
||||
const res = await statisticsApi.getStatiscicsManagementReviewHistory({
|
||||
statsYr: values.year.trim(),
|
||||
...(values.bsnmCd?.trim() ? { sewerBzmnCd: values.bsnmCd.trim() } : {}),
|
||||
...(values.sido && values.sido !== "ALL" ? { ctpvNm: values.sido } : {}),
|
||||
});
|
||||
|
||||
if (res.status === "success" && Array.isArray(res.data)) {
|
||||
setRowData(toGridRows(res.data));
|
||||
} else {
|
||||
setRowData([]);
|
||||
alert(res.message || "조회된 데이터가 없습니다.");
|
||||
}
|
||||
} catch {
|
||||
setRowData([]);
|
||||
alert("데이터 조회 중 오류가 발생했습니다.");
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleReset = () => {
|
||||
setRowData([]);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<SearchForm />
|
||||
<DataGrid columnInfo={{ columns, columnLayout }} rowStartNum={2} fixedColumns={3} rowData={rowData} setRowData={setRowData} isExcelImport={false} />
|
||||
</>
|
||||
<div className="relative">
|
||||
<SearchForm onSubmit={handleSearch} onReset={handleReset} />
|
||||
{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" />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<DataGrid
|
||||
columnInfo={{ columns, columnLayout }}
|
||||
rowStartNum={2}
|
||||
fixedColumns={3}
|
||||
rowData={rowData}
|
||||
setRowData={setRowData}
|
||||
isExcelImport={false}
|
||||
enableSort={false}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default StatisticsReviewHistory;
|
||||
export default StatisticsReviewHistory;
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { useState, useMemo } from "react";
|
||||
import { useCallback, useMemo, useState } from "react";
|
||||
import { useConfirm } from "@frontend-opensource/use-react-hooks";
|
||||
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 +19,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,12 +41,25 @@ 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" || String(row.prvnStatusCd ?? "") === "3");
|
||||
|
||||
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);
|
||||
const { confirm } = useConfirm();
|
||||
const [rowData, setRowData] = useState<Record<string, string | number>[]>([]);
|
||||
const [historyRowData, setHistoryRowData] = useState<ReviewHistoryRow[]>([]);
|
||||
const [isLoading, setIsLoading] = useState<boolean>(false);
|
||||
const [isApproveLoading, setIsApproveLoading] = useState(false);
|
||||
const [searchedYear, setSearchedYear] = useState<string>("");
|
||||
const [lastSearchedValues, setLastSearchedValues] = useState<SearchFormValues | null>(null);
|
||||
const [hasCompletedSearch, setHasCompletedSearch] = useState(false);
|
||||
@@ -90,6 +111,7 @@ const StatsInputStatusRvw = () => {
|
||||
setSearchedYear("");
|
||||
setLastSearchedValues(null);
|
||||
setHasCompletedSearch(false);
|
||||
setIsApproveLoading(false);
|
||||
};
|
||||
|
||||
const handleSearch = async (values: SearchFormValues) => {
|
||||
@@ -113,13 +135,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 +152,143 @@ 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;
|
||||
}
|
||||
|
||||
if (!(await confirm("조회된 통계 항목을 승인하시겠습니까?"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
setIsApproveLoading(true);
|
||||
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.resultCode.toLocaleLowerCase() === "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("승인 처리 중 오류가 발생했습니다.");
|
||||
} finally {
|
||||
setIsApproveLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
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],
|
||||
);
|
||||
|
||||
/** 진행상태(prvn) 코드가 모두 승인완료(3) */
|
||||
const allPrvnStatusApproved = useMemo(
|
||||
() =>
|
||||
rowData.length > 0 &&
|
||||
rowData.every((row) => String(row.prvnStatusCd ?? "") === "3"),
|
||||
[rowData],
|
||||
);
|
||||
|
||||
const showActionToolbarCard =
|
||||
hasCompletedSearch && rowData.length > 0 && gugunOkOrNotDoList;
|
||||
hasCompletedSearch &&
|
||||
rowData.length > 0 &&
|
||||
gugunOkOrNotDoList &&
|
||||
allSubmitStatusApproved &&
|
||||
!allPrvnStatusApproved;
|
||||
|
||||
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">
|
||||
@@ -182,7 +302,7 @@ const StatsInputStatusRvw = () => {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{isLoading && (
|
||||
{(isLoading || isApproveLoading) && (
|
||||
<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" />
|
||||
@@ -193,12 +313,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;
|
||||
@@ -4,11 +4,13 @@ import type { Dispatch, SetStateAction } from "react";
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
|
||||
import { useConfirm } from "@frontend-opensource/use-react-hooks";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import dayjs from "dayjs";
|
||||
import type { RealGridReact } from "realgrid-react";
|
||||
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import { useAlertStore, useMutationWrapper, useUserStore } from "@/shared/lib";
|
||||
import { CodeSelect } from "@/entities/code";
|
||||
import { CodeApi, CodeSelect } from "@/entities/code";
|
||||
import {
|
||||
type ApproveRequest,
|
||||
type RejectRequest,
|
||||
@@ -138,12 +140,6 @@ const DEFAULT_SUB_FILTERS: StatisticsVerificationSubFilterState = {
|
||||
pbcpAprvYn: "N",
|
||||
};
|
||||
|
||||
const STATUS_OPTIONS = [
|
||||
{ label: "수정완료", value: "1" },
|
||||
{ label: "예외통과", value: "2" },
|
||||
{ label: "반려", value: "3" },
|
||||
];
|
||||
|
||||
const APPROVAL_STATUS_OPTIONS = [
|
||||
{ label: "승인", value: "Y" },
|
||||
{ label: "미승인", value: "N" },
|
||||
@@ -195,6 +191,18 @@ function StatisticsVerificationReport() {
|
||||
[filters, subFilters],
|
||||
);
|
||||
|
||||
const { data: statusOptions } = useQuery({
|
||||
queryKey: [ENDPOINT.CMS_SERVICE.CODE, "STINPTEXCT"],
|
||||
queryFn: () => CodeApi.getCode("STINPTEXCT"),
|
||||
select: (data) =>
|
||||
data
|
||||
.filter(({ lwpoCd }) => !["0", "4"].includes(lwpoCd))
|
||||
.map(({ lwpoCdNm: label, lwpoCd: value }) => ({
|
||||
label,
|
||||
value,
|
||||
})),
|
||||
});
|
||||
|
||||
const statisticsVerificationReportQuery = useStatsVrfcRptData(filters);
|
||||
const statisticsVerificationResultQuery =
|
||||
useStatsVrfcRsltData(detailParams);
|
||||
@@ -594,7 +602,7 @@ function StatisticsVerificationReport() {
|
||||
label="상태"
|
||||
value={subFilters.prcsYnList}
|
||||
onChange={handleSubFilterChange("prcsYnList")}
|
||||
options={STATUS_OPTIONS}
|
||||
options={statusOptions ?? []}
|
||||
/>
|
||||
<FilterSelect
|
||||
label="승인상태"
|
||||
@@ -691,7 +699,7 @@ function FilterCombobox({
|
||||
onChange(list.length > 0 ? list.join(",") : undefined);
|
||||
}}
|
||||
>
|
||||
<ComboboxChips ref={anchor} className="max-w-[26rem]">
|
||||
<ComboboxChips ref={anchor} className="max-w-[32rem]">
|
||||
<ComboboxValue>
|
||||
{(values: string[]) => (
|
||||
<>
|
||||
|
||||
@@ -279,6 +279,16 @@ export type CellEditedCallback = (
|
||||
params: CellEditedCallbackParams,
|
||||
) => void;
|
||||
|
||||
/** 데이터 셀 클릭 시 컬럼(필드)까지 전달 — 특정 컬럼만 반응할 때 사용 */
|
||||
export type DataCellClickCallbackParams = {
|
||||
row: Record<string, string | number>;
|
||||
fieldName: string;
|
||||
itemIndex: number;
|
||||
};
|
||||
export type DataCellClickCallback = (
|
||||
params: DataCellClickCallbackParams,
|
||||
) => void;
|
||||
|
||||
export type DataGridProps = {
|
||||
columnInfo: ColumnInfo;
|
||||
rowStartNum?: number; // 헤더 행 개수 (1부터 시작, 예: 2면 1행과 2행까지 헤더로 간주)
|
||||
@@ -306,6 +316,8 @@ export type DataGridProps = {
|
||||
/** 외부에서 gridRef에 직접 접근하기 위한 ref (setRows/addRows/setValue 직접 호출용) */
|
||||
getGridRef?: React.MutableRefObject<RealGridReact | null>;
|
||||
onRowClick?: (rowData: Record<string, string | number>) => void; // 행 클릭 이벤트
|
||||
/** 데이터 셀 클릭 시 행 + 클릭한 필드명 전달 (`onRowClick`과 함께 쓸 수 있음) */
|
||||
onDataCellClick?: DataCellClickCallback;
|
||||
/** CheckBar 행 체크 변경 */
|
||||
onItemChecked?: (itemIndex: number, checked: boolean) => void;
|
||||
/** CheckBar 헤더 전체 선택/해제 */
|
||||
|
||||
@@ -10,6 +10,14 @@ export const StatsInputStatusInpColumn = {
|
||||
{ name: 'sggNm', fieldName: 'sggNm', header: { text: '시군구' }, editable: false },
|
||||
{ name: 'statsCd', fieldName: 'statsCd', header: { text: '메뉴코드' }, visible: false, editable: false },
|
||||
{ name: 'menuTabName', fieldName: 'menuTabName', header: { text: '구분' }, editable: false, width: 220 },
|
||||
{
|
||||
name: 'exceptionSubmitHistory',
|
||||
fieldName: 'exceptionSubmitHistory',
|
||||
header: { text: '예외제출내역' },
|
||||
editable: false,
|
||||
width: 118,
|
||||
styleName: 'rg-cell-outline-action-btn',
|
||||
},
|
||||
{ name: 'laeSbmsnSttsNm', fieldName: 'laeSbmsnSttsNm', header: { text: '진행상황' }, editable: false },
|
||||
{ name: 'laePicNm', fieldName: 'laePicNm', header: { text: '작성자' }, editable: false },
|
||||
{ name: 'laePicTelNo', fieldName: 'laePicTelNo', header: { text: '작성자연락처' }, editable: false },
|
||||
@@ -27,6 +35,7 @@ export const StatsInputStatusInpColumn = {
|
||||
'sggNm',
|
||||
'statsCd',
|
||||
'menuTabName',
|
||||
'exceptionSubmitHistory',
|
||||
{
|
||||
name: 'groupA',
|
||||
hideChildHeaders: false,
|
||||
|
||||
@@ -6,7 +6,7 @@ export const LogHistoryColumn = {
|
||||
{ name: 'sggNm', fieldName: 'sggNm', header: { text: '시군구' }, editable: false },
|
||||
{ name: 'statsYr', fieldName: 'statsYr', header: { text: '연도' }, editable: false },
|
||||
{ name: 'statsLogSn', fieldName: 'statsLogSn', header: { text: '일련번호' }, editable: false, visible: false, valueType: ValueType.NUMBER, dataFormat: '#,##0' },
|
||||
{ name: 'menuNm', fieldName: 'menuNm', header: { text: '메뉴명' }, editable: false },
|
||||
{ name: 'menuNm', fieldName: 'menuNm', header: { text: '통계항목' }, editable: false },
|
||||
{ name: 'tblNm', fieldName: 'tblNm', header: { text: '테이블명' }, visible: false, editable: false },
|
||||
{ name: 'statsDataChgComNm', fieldName: 'statsDataChgComNm', header: { text: '요청 기능명' }, editable: false },
|
||||
{ name: 'rgtrId', fieldName: 'rgtrId', header: { text: '등록자' }, editable: false, visible: false },
|
||||
|
||||
@@ -9,6 +9,13 @@ const StatsInputStatusInfoColumnRaw = {
|
||||
{ name: 'sewerBzmnCd', fieldName: 'sewerBzmnCd', header: { text: '사업자코드' }, visible: false },
|
||||
{ name: 'statsCd', fieldName: 'statsCd', header: { text: '메뉴코드' }, visible: false },
|
||||
{ name: 'tabNm', fieldName: 'tabNm', header: { text: '구분' }, width: 220 },
|
||||
{
|
||||
name: 'reviewHistory',
|
||||
fieldName: 'reviewHistory',
|
||||
header: { text: '검토이력' },
|
||||
width: 118,
|
||||
styleName: 'rg-cell-outline-action-btn',
|
||||
},
|
||||
|
||||
{ name: 'chargerNm', fieldName: 'chargerNm', header: { text: '제출자' } },
|
||||
{ name: 'chargerCttpc', fieldName: 'chargerCttpc', header: { text: '연락처' } },
|
||||
@@ -22,6 +29,7 @@ const StatsInputStatusInfoColumnRaw = {
|
||||
'ctpvNm',
|
||||
'sggNm',
|
||||
'tabNm',
|
||||
'reviewHistory',
|
||||
'chargerNm',
|
||||
'chargerCttpc',
|
||||
'submitStatusNm',
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { ValueType } from "realgrid";
|
||||
|
||||
import type { ColumnInfoList } from "@/components/type/DataGrid.type";
|
||||
|
||||
/**
|
||||
* 하수도 통계 관리 > 02. 하수관로 (합계)
|
||||
* 항목은 검토(SewagePipeRvwColumn)와 동일하나 footer·mergeCells·구분(displayYear)·비고(rmrk) 제외.
|
||||
@@ -7,7 +9,7 @@ import { ValueType } from "realgrid";
|
||||
*/
|
||||
|
||||
/** ST00020003 관종별: 입력 `SeweragePipeInputPipeTypeStatusItem`·합계 `SewagePipePipeTypeFacilityStatusItem`과 동일 (yy1=1996년 이전 … yy30) */
|
||||
const YY_PIPE_TYPE_FACILITY_MAX = 30;
|
||||
// const YY_PIPE_TYPE_FACILITY_MAX = 30;
|
||||
|
||||
const rawSewagePipeTotList = [
|
||||
{
|
||||
@@ -605,103 +607,6 @@ const rawSewagePipeTotList = [
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
tabKey: "ST00020003",
|
||||
tabLabel: "관종별 현황",
|
||||
rowStartNum: 2,
|
||||
fixedColumns: 2,
|
||||
columns: [
|
||||
{ name: "ctpvNm", fieldName: "ctpvNm", header: { text: "시도" }, editable: false },
|
||||
{ name: "sggNm", fieldName: "sggNm", header: { text: "시군구" }, editable: false },
|
||||
{ name: "admdstNm", fieldName: "admdstNm", header: { text: "행정구역명" }, editable: false },
|
||||
{ name: "swrgPipeNm", fieldName: "swrgPipeNm", header: { text: "관종" }, editable: false },
|
||||
{
|
||||
name: "pipeByPrstWholSum",
|
||||
fieldName: "pipeByPrstWhol",
|
||||
header: { text: "계" },
|
||||
valueType: ValueType.NUMBER,
|
||||
dataFormat: "#,##0.0",
|
||||
editable: false,
|
||||
},
|
||||
{
|
||||
name: "lyngPrlgSum",
|
||||
fieldName: "lyngPrlg",
|
||||
header: { text: "매설연장(m)" },
|
||||
valueType: ValueType.NUMBER,
|
||||
dataFormat: "#,##0.0",
|
||||
editable: false,
|
||||
},
|
||||
{
|
||||
name: "dmltnPrlgSum",
|
||||
fieldName: "dmltnPrlg",
|
||||
header: { text: "철거연장(m)" },
|
||||
valueType: ValueType.NUMBER,
|
||||
dataFormat: "#,##0.0",
|
||||
editable: false,
|
||||
},
|
||||
...Array.from({ length: YY_PIPE_TYPE_FACILITY_MAX }, (_, i) => {
|
||||
const yyIdx = i + 1;
|
||||
const wholField = `yy${yyIdx}PrlgWhol`;
|
||||
const lyngField = `yy${yyIdx}LyngPrlg`;
|
||||
const dmltnField = `yy${yyIdx}DmltnPrlg`;
|
||||
return [
|
||||
{
|
||||
name: wholField,
|
||||
fieldName: wholField,
|
||||
header: { text: "계" },
|
||||
valueType: ValueType.NUMBER,
|
||||
dataFormat: "#,##0.0",
|
||||
editable: false,
|
||||
},
|
||||
{
|
||||
name: lyngField,
|
||||
fieldName: lyngField,
|
||||
header: { text: "매설연장(m)" },
|
||||
valueType: ValueType.NUMBER,
|
||||
dataFormat: "#,##0.0",
|
||||
editable: false,
|
||||
},
|
||||
{
|
||||
name: dmltnField,
|
||||
fieldName: dmltnField,
|
||||
header: { text: "철거연장(m)" },
|
||||
valueType: ValueType.NUMBER,
|
||||
dataFormat: "#,##0.0",
|
||||
editable: false,
|
||||
},
|
||||
];
|
||||
}).flat(),
|
||||
],
|
||||
columnLayout: [
|
||||
{
|
||||
name: "areaGroup",
|
||||
header: { text: "행정구역" },
|
||||
items: ["ctpvNm", "sggNm", "admdstNm"],
|
||||
},
|
||||
"swrgPipeNm",
|
||||
{
|
||||
name: "summaryGroup",
|
||||
header: { text: "총계" },
|
||||
items: ["pipeByPrstWholSum", "lyngPrlgSum", "dmltnPrlgSum"],
|
||||
},
|
||||
{
|
||||
name: "year1996Before",
|
||||
header: { text: "1996년이전" },
|
||||
items: ["yy1PrlgWhol", "yy1LyngPrlg", "yy1DmltnPrlg"],
|
||||
},
|
||||
...Array.from({ length: YY_PIPE_TYPE_FACILITY_MAX - 1 }, (_, i) => {
|
||||
const yyIdx = i + 2;
|
||||
const year = 1994 + yyIdx;
|
||||
return {
|
||||
name: `group_yy${yyIdx}`,
|
||||
header: { text: `${year}년` },
|
||||
items: [`yy${yyIdx}PrlgWhol`, `yy${yyIdx}LyngPrlg`, `yy${yyIdx}DmltnPrlg`],
|
||||
};
|
||||
}),
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
tabKey: "ST00020004",
|
||||
tabLabel: "관경별 현황",
|
||||
@@ -1019,13 +924,72 @@ const rawSewagePipeTotList = [
|
||||
],
|
||||
},
|
||||
"rmrk",
|
||||
],
|
||||
],
|
||||
},
|
||||
|
||||
|
||||
];
|
||||
|
||||
export const SewagePipeColumnInfoListTot = rawSewagePipeTotList.map((tab) => ({
|
||||
// 2. 동적 컬럼(ST00020003) 생성 함수
|
||||
export const getST00020003Config = (statsYr: string | number) => {
|
||||
const startYear = 1995;
|
||||
const endYear = Number(statsYr) || new Date().getFullYear();
|
||||
|
||||
return {
|
||||
tabKey: "ST00020003",
|
||||
tabLabel: "관종별 현황",
|
||||
rowStartNum: 2,
|
||||
fixedColumns: 2,
|
||||
columns: [
|
||||
{ name: "ctpvNm", fieldName: "ctpvNm", header: { text: "시도" }, editable: false },
|
||||
{ name: "sggNm", fieldName: "sggNm", header: { text: "시군구" }, editable: false },
|
||||
{ name: "admdstNm", fieldName: "admdstNm", header: { text: "행정구역명" }, editable: false },
|
||||
{ name: "swrgPipeNm", fieldName: "swrgPipeNm", header: { text: "관종" }, editable: false },
|
||||
{ name: "pipeByPrstWholSum", fieldName: "pipeByPrstWhol", header: { text: "계" }, valueType: ValueType.NUMBER, dataFormat: "#,##0.0", editable: false },
|
||||
{ name: "lyngPrlgSum", fieldName: "lyngPrlg", header: { text: "매설연장(m)" }, valueType: ValueType.NUMBER, dataFormat: "#,##0.0", editable: false },
|
||||
{ name: "dmltnPrlgSum", fieldName: "dmltnPrlg", header: { text: "철거연장(m)" }, valueType: ValueType.NUMBER, dataFormat: "#,##0.0", editable: false },
|
||||
...(() => {
|
||||
const yearColumns = [];
|
||||
for (let yr = startYear; yr <= endYear; yr++) {
|
||||
yearColumns.push(
|
||||
{ name: `prlg_whol_${yr}`, fieldName: `prlg_whol_${yr}`, header: { text: "계" }, valueType: ValueType.NUMBER, dataFormat: "#,##0.0", editable: false },
|
||||
{ name: `lyng_prlg_${yr}`, fieldName: `lyng_prlg_${yr}`, header: { text: "매설연장(m)" }, valueType: ValueType.NUMBER, dataFormat: "#,##0.0", editable: false },
|
||||
{ name: `dmltn_prlg_${yr}`, fieldName: `dmltn_prlg_${yr}`, header: { text: "철거연장(m)" }, valueType: ValueType.NUMBER, dataFormat: "#,##0.0", editable: false }
|
||||
);
|
||||
}
|
||||
return yearColumns;
|
||||
})(),
|
||||
],
|
||||
columnLayout: [
|
||||
{ name: "areaGroup", header: { text: "행정구역" }, items: ["ctpvNm", "sggNm", "admdstNm"] },
|
||||
"swrgPipeNm",
|
||||
{ name: "summaryGroup", header: { text: "총계" }, items: ["pipeByPrstWholSum", "lyngPrlgSum", "dmltnPrlgSum"] },
|
||||
...(() => {
|
||||
const layouts = [];
|
||||
for (let yr = startYear; yr <= endYear; yr++) {
|
||||
layouts.push({
|
||||
name: `group_${yr}`,
|
||||
header: { text: yr === 1995 ? "1996년이전" : `${yr}년` },
|
||||
items: [`prlg_whol_${yr}`, `lyng_prlg_${yr}`, `dmltn_prlg_${yr}`],
|
||||
});
|
||||
}
|
||||
return layouts;
|
||||
})(),
|
||||
],
|
||||
};
|
||||
};
|
||||
|
||||
export const SewagePipeColumnInfoListTot: ColumnInfoList[] = rawSewagePipeTotList.map((tab) => ({
|
||||
...tab,
|
||||
columns: tab.columns.map((col) => ({ ...col, editable: false as const })),
|
||||
}));
|
||||
|
||||
const st00020003PlaceholderTab: ColumnInfoList = {
|
||||
tabKey: "ST00020003",
|
||||
tabLabel: "관종별 현황",
|
||||
rowStartNum: 2,
|
||||
fixedColumns: 2,
|
||||
columns: [],
|
||||
columnLayout: [],
|
||||
};
|
||||
|
||||
SewagePipeColumnInfoListTot.splice(2, 0, st00020003PlaceholderTab);
|
||||
@@ -0,0 +1,72 @@
|
||||
import { client } from "@/shared/api";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import type {
|
||||
GroupUserService,
|
||||
GroupUserSearchParams,
|
||||
GroupUserListResponseDto,
|
||||
GroupUserDetailResponse,
|
||||
PageGroupUserList,
|
||||
GroupUserSaveData,
|
||||
GroupUserUpdateData,
|
||||
} from "../model/group-user-interface";
|
||||
|
||||
export class GroupUsersApiService implements GroupUserService {
|
||||
// 그룹 사용자 목록 조회
|
||||
public async findPageGroupUser(
|
||||
params: GroupUserSearchParams,
|
||||
): Promise<PageGroupUserList> {
|
||||
const response = await client.get<PageGroupUserList>(
|
||||
`${ENDPOINT.CMS_SERVICE.GROUP_USERS}`,
|
||||
{ params },
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
// 그룹 사용자 단건 조회
|
||||
public async findByGroupAndUserId(
|
||||
grpSn: number,
|
||||
userUnqId: string,
|
||||
): Promise<GroupUserDetailResponse> {
|
||||
const response = await client.get<GroupUserDetailResponse>(
|
||||
`${ENDPOINT.CMS_SERVICE.GROUP_USERS}/${grpSn}/${userUnqId}`,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
// 그룹 사용자 저장
|
||||
public async saveGroupUser(
|
||||
data: GroupUserSaveData[],
|
||||
): Promise<GroupUserListResponseDto[]> {
|
||||
const response = await client.post<GroupUserListResponseDto[]>(
|
||||
`${ENDPOINT.CMS_SERVICE.GROUP_USERS}`,
|
||||
data,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
// 그룹 사용자 수정
|
||||
public async updateGroupUser(
|
||||
grpSn: number,
|
||||
userUnqId: string,
|
||||
data: GroupUserUpdateData,
|
||||
): Promise<GroupUserDetailResponse> {
|
||||
const response = await client.put<GroupUserDetailResponse>(
|
||||
`${ENDPOINT.CMS_SERVICE.GROUP_USERS}/${grpSn}/${userUnqId}`,
|
||||
data,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
// 그룹 사용자 삭제
|
||||
public async deleteGroupUser(
|
||||
groupId: string,
|
||||
userUnqId: string,
|
||||
): Promise<boolean> {
|
||||
const response = await client.delete<boolean>(
|
||||
`${ENDPOINT.CMS_SERVICE.GROUP_USERS}/${groupId}/${userUnqId}`,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
}
|
||||
|
||||
export const GroupUsersApi = new GroupUsersApiService();
|
||||
@@ -0,0 +1,5 @@
|
||||
export { GroupUsersApi } from "./api/group-user-service";
|
||||
export {
|
||||
type GroupUserListResponseDto,
|
||||
type GroupUserSaveData,
|
||||
} from "./model/group-user-interface";
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
import { GroupUsersApi } from "../api/group-user-service";
|
||||
|
||||
export const GRP_ST_INPUT = "GRP_ST_INPUT";
|
||||
export const GRP_ST_CONFIRM = "GRP_ST_CONFIRM";
|
||||
export const GRP_ADMIN = "GRP_ADMIN";
|
||||
|
||||
const PAGE_SIZE = 500;
|
||||
|
||||
/**
|
||||
* 지정한 그룹(`keyword`)마다 `findPageGroupUser`를 호출하고,
|
||||
* 응답 목록이 비어 있지 않으며 로그인 사용자 `userUnqId`와 일치하는 행이 있으면 true.
|
||||
*/
|
||||
export async function checkPageGroupUserMembershipForUser(
|
||||
userName: string,
|
||||
userUnqId: string,
|
||||
groupKeywords: readonly string[],
|
||||
): Promise<boolean> {
|
||||
const uid = userUnqId.trim();
|
||||
const nm = userName.trim();
|
||||
if (!uid || !nm) return false;
|
||||
|
||||
const paramsBase = { userNm: nm, page: 0, size: PAGE_SIZE };
|
||||
|
||||
for (const keyword of groupKeywords) {
|
||||
const page = await GroupUsersApi.findPageGroupUser({
|
||||
...paramsBase,
|
||||
keyword,
|
||||
});
|
||||
const rows = page.content ?? [];
|
||||
if (rows.length > 0 && rows.some((r) => String(r.userUnqId ?? "").trim() === uid)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 통계 입력 화면 상단 액션 — `GRP_ST_INPUT` / `GRP_ADMIN`.
|
||||
*/
|
||||
export async function checkStatisticsInputToolbarGroupMembership(
|
||||
userName: string,
|
||||
userUnqId: string,
|
||||
): Promise<boolean> {
|
||||
return checkPageGroupUserMembershipForUser(userName, userUnqId, [GRP_ST_INPUT, GRP_ADMIN]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 통계 입력 현황 승인 등 — `GRP_ST_CONFIRM` / `GRP_ADMIN`.
|
||||
*/
|
||||
export async function checkStatisticsInputStatusConfirmGroupMembership(
|
||||
userName: string,
|
||||
userUnqId: string,
|
||||
): Promise<boolean> {
|
||||
return checkPageGroupUserMembershipForUser(userName, userUnqId, [GRP_ST_CONFIRM, GRP_ADMIN]);
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
import type { PageableList, PageableParams } from "@/shared/model";
|
||||
|
||||
// 그룹 사용자 검색 파라미터 인터페이스
|
||||
export interface GroupUserSearchParams extends PageableParams {
|
||||
keyword?: string;
|
||||
userNm?: string;
|
||||
}
|
||||
|
||||
// 그룹 사용자 목록 응답 인터페이스
|
||||
export interface GroupUserListResponseDto {
|
||||
mode: string;
|
||||
groupId: string;
|
||||
userUnqId: string;
|
||||
userId: string;
|
||||
userName: string;
|
||||
ogdpSeCd: string;
|
||||
ogdpSeNm: string;
|
||||
mphn: string;
|
||||
}
|
||||
|
||||
// 그룹 사용자 페이지 응답 인터페이스
|
||||
export type PageGroupUserList = PageableList<GroupUserListResponseDto>;
|
||||
|
||||
// 그룹 사용자 상세 응답 인터페이스
|
||||
export interface GroupUserDetailResponse {
|
||||
grpSn: number;
|
||||
userUnqId: string;
|
||||
userId: string;
|
||||
userName: string;
|
||||
email: string;
|
||||
mphn: string;
|
||||
regDt: string;
|
||||
rgtr: string;
|
||||
mdfcnDt: string;
|
||||
mdfr: string;
|
||||
rgtrNm: string;
|
||||
mdfrNm: string;
|
||||
}
|
||||
|
||||
// 그룹 사용자 저장 데이터 인터페이스
|
||||
export interface GroupUserSaveData {
|
||||
mode: string;
|
||||
groupId: string;
|
||||
userUnqId: string;
|
||||
}
|
||||
|
||||
// 그룹 사용자 수정 데이터 인터페이스
|
||||
export interface GroupUserUpdateData {
|
||||
userUnqId: string;
|
||||
}
|
||||
|
||||
// 그룹 사용자 서비스 인터페이스
|
||||
export interface GroupUserService {
|
||||
// 그룹 사용자 목록 조회
|
||||
findPageGroupUser: (
|
||||
params: GroupUserSearchParams,
|
||||
) => Promise<PageGroupUserList>;
|
||||
|
||||
// 그룹 사용자 단건 조회
|
||||
findByGroupAndUserId: (
|
||||
grpSn: number,
|
||||
userUnqId: string,
|
||||
) => Promise<GroupUserDetailResponse>;
|
||||
|
||||
// 그룹 사용자 저장
|
||||
saveGroupUser: (
|
||||
data: GroupUserSaveData[],
|
||||
) => Promise<GroupUserListResponseDto[]>;
|
||||
|
||||
// 그룹 사용자 수정
|
||||
updateGroupUser: (
|
||||
grpSn: number,
|
||||
userUnqId: string,
|
||||
data: GroupUserUpdateData,
|
||||
) => Promise<GroupUserDetailResponse>;
|
||||
|
||||
// 그룹 사용자 삭제
|
||||
deleteGroupUser: (groupId: string, userUnqId: string) => Promise<boolean>;
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
type ImrStatusResponse,
|
||||
type ReviewerInfoRequest,
|
||||
type ReviewerInfoResponse,
|
||||
type ReviewInputSaveRequest,
|
||||
type ReviewOpinionSaveRequest,
|
||||
type ReviewOpinionSaveResponse,
|
||||
type ReviewReturnSaveRequest,
|
||||
@@ -20,6 +21,8 @@ import {
|
||||
type ReviewSubmitResponse,
|
||||
type SearchCondition,
|
||||
type Sgg,
|
||||
type StatiscicsManagementReviewHistoryRequest,
|
||||
type StatiscicsManagementReviewHistoryResponse,
|
||||
type StatisticsColumnGuideListResponse,
|
||||
type StatisticsLogDetailResponse,
|
||||
type StatisticsLogRequest,
|
||||
@@ -33,6 +36,9 @@ import {
|
||||
type StatsInputPeriodListRequest,
|
||||
type StatsInputPeriodSaveApiResponse,
|
||||
type StatsInputPeriodSaveRequest,
|
||||
type StatsInputStatusApproveBatchRequest,
|
||||
type StatsInputStatusApproveKind,
|
||||
type StatsInputStatusApproveResponse,
|
||||
type SubmitExceptionRequest,
|
||||
type SubmitExceptionResponse,
|
||||
type SubmitVerifyExceptionRequest,
|
||||
@@ -214,6 +220,56 @@ export class StatisticsApiService implements StatisticsService {
|
||||
return response.data;
|
||||
}
|
||||
|
||||
/** 입력 반려 — JSON body는 `ReviewInputSaveRequest`(type 제외) 항목의 배열, `type`은 쿼리 */
|
||||
public async saveInputReturn(
|
||||
items: ReviewInputSaveRequest[],
|
||||
): Promise<ReviewReturnSaveResponse> {
|
||||
if (items.length === 0) {
|
||||
throw new Error("saveInputReturn: 항목이 비어 있습니다.");
|
||||
}
|
||||
const [first] = items;
|
||||
if (!first) {
|
||||
throw new Error("saveInputReturn: 항목이 비어 있습니다.");
|
||||
}
|
||||
const type = first.type;
|
||||
if (!items.every((i) => i.type === type)) {
|
||||
throw new Error("saveInputReturn: 모든 항목의 type이 같아야 합니다.");
|
||||
}
|
||||
const body = items.map(({ type: _t, rjctOpnnCn, ...rest }) => {
|
||||
const row: Record<string, string> = {
|
||||
statsYr: rest.statsYr,
|
||||
sewerBzmnCd: rest.sewerBzmnCd,
|
||||
statsCd: rest.statsCd,
|
||||
mdfrId: rest.mdfrId,
|
||||
};
|
||||
if (rest.vrfcSn != null && String(rest.vrfcSn).trim() !== "") {
|
||||
row.vrfcSn = String(rest.vrfcSn);
|
||||
}
|
||||
const trimmed = rjctOpnnCn?.trim();
|
||||
if (trimmed) row.rjctOpnnCn = trimmed;
|
||||
return row;
|
||||
});
|
||||
const response = await stClient.post<ReviewReturnSaveResponse>(
|
||||
`${ENDPOINT.ST_SERVICE.STATS}/reject`,
|
||||
body,
|
||||
{ params: { type } },
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
/** 통계 입력 현황 일괄 승인 — 쿼리 `type`(기본 `INPUT`), body는 `{ list }` */
|
||||
public async approveStatsInputStatus(
|
||||
param: StatsInputStatusApproveBatchRequest,
|
||||
type: StatsInputStatusApproveKind = "INPUT",
|
||||
): Promise<StatsInputStatusApproveResponse> {
|
||||
const response = await stClient.post<StatsInputStatusApproveResponse>(
|
||||
`${ENDPOINT.ST_SERVICE.STATS}/approve`,
|
||||
param.list,
|
||||
{ params: { type } },
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async submitReview(
|
||||
param: ReviewSubmitRequest,
|
||||
): Promise<ReviewSubmitResponse> {
|
||||
@@ -247,6 +303,14 @@ export class StatisticsApiService implements StatisticsService {
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async getStatiscicsManagementReviewHistory(param: StatiscicsManagementReviewHistoryRequest): Promise<StatiscicsManagementReviewHistoryResponse> {
|
||||
const response = await stClient.get<StatiscicsManagementReviewHistoryResponse>(
|
||||
`${ENDPOINT.ST_SERVICE.REVIEW}/stats-review`,
|
||||
{ params: param },
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
}
|
||||
|
||||
export const statisticsApi = new StatisticsApiService();
|
||||
|
||||
@@ -74,6 +74,12 @@ export {
|
||||
type ImrLogResponse,
|
||||
} from "./model/imr/imr-interface";
|
||||
export { imrVerificationHistoryColumns } from "./model/imr/imr-verification-history-columns";
|
||||
export {
|
||||
type StatsInputStatusApproveBatchRequest,
|
||||
type StatsInputStatusApproveItem,
|
||||
type StatsInputStatusApproveKind,
|
||||
type StatsInputStatusApproveResponse,
|
||||
} from "./model/statistics-interface";
|
||||
export { type StatsInputStatusList } from "./model/input/statistics-input-status-interface";
|
||||
export { userListColumns } from "./model/notice-talk/notice-talk-sending-columns";
|
||||
export {
|
||||
|
||||
@@ -230,6 +230,7 @@ export interface VerifyResultItem {
|
||||
nowVlCn?: string;
|
||||
compVlCn?: string;
|
||||
prcsYn?: string;
|
||||
prcsYnNm?: string;
|
||||
prcsOpnnExpln?: string;
|
||||
prcrId?: string;
|
||||
rjctOpnnCn?: string;
|
||||
|
||||
+5
-4
@@ -187,10 +187,11 @@ export interface PublicSewageMainFacilityMappingSaveRequest {
|
||||
admdstNm: string;
|
||||
mainFcltSn: string;
|
||||
mainFcltNm: string;
|
||||
prxyBzentyNmCn: string;
|
||||
cnsgnCstVl: number;
|
||||
wholNope: number;
|
||||
prxyCtrtCn: string;
|
||||
/** 매핑 추가(saveList 있음) 시 입력. 매핑 삭제만 할 때는 요청에서 생략 가능 */
|
||||
prxyBzentyNmCn?: string;
|
||||
cnsgnCstVl?: number;
|
||||
wholNope?: number;
|
||||
prxyCtrtCn?: string;
|
||||
userId: string;
|
||||
saveList: PublicSewageMainFacilityMappingSaveItem[];
|
||||
deleteList: string[];
|
||||
|
||||
@@ -340,6 +340,7 @@ export interface ReviewReturnSaveRequest {
|
||||
statsCd: string;
|
||||
rjctOpnnCn: string;
|
||||
mdfrId: string;
|
||||
vrfcSn?: string;
|
||||
}
|
||||
|
||||
export interface ReviewReturnSaveResponse {
|
||||
@@ -349,6 +350,17 @@ export interface ReviewReturnSaveResponse {
|
||||
updatedStts: string;
|
||||
}
|
||||
|
||||
export interface ReviewInputSaveRequest {
|
||||
type: "INPUT";
|
||||
statsYr: string;
|
||||
sewerBzmnCd: string;
|
||||
statsCd: string;
|
||||
/** 미입력·빈 문자열이면 요청 body에 포함하지 않음 */
|
||||
rjctOpnnCn?: string;
|
||||
mdfrId: string;
|
||||
vrfcSn?: string;
|
||||
}
|
||||
|
||||
export interface ReviewSubmitRequest {
|
||||
statsYr: string;
|
||||
sewerBzmnCd: string;
|
||||
@@ -363,6 +375,30 @@ export interface ReviewSubmitResponse {
|
||||
message?: string;
|
||||
}
|
||||
|
||||
/** 통계 일괄 승인 `/stats/approve` 쿼리 파라미터 `type` */
|
||||
export type StatsInputStatusApproveKind = "INPUT" | "REVIEW";
|
||||
|
||||
/** 통계 입력 현황 승인 요청 항목 (행 단위) */
|
||||
export interface StatsInputStatusApproveItem {
|
||||
statsYr: string;
|
||||
sewerBzmnCd: string;
|
||||
statsCd: string;
|
||||
mdfrId: string;
|
||||
}
|
||||
|
||||
/** 통계 입력 현황 일괄 승인 API 요청 본문 */
|
||||
export interface StatsInputStatusApproveBatchRequest {
|
||||
list: StatsInputStatusApproveItem[];
|
||||
}
|
||||
|
||||
/** 통계 입력 현황 일괄 승인 API 응답 */
|
||||
export interface StatsInputStatusApproveResponse {
|
||||
exceptionCnt: number;
|
||||
message: string;
|
||||
resultCode: string;
|
||||
updatedStts: string;
|
||||
}
|
||||
|
||||
export interface SubmitVerifyExceptionItem {
|
||||
vrfcSn: number;
|
||||
prcsOpnnExpln: string;
|
||||
@@ -400,6 +436,32 @@ export interface ReviewerInfoResponse {
|
||||
}
|
||||
}
|
||||
|
||||
export interface StatiscicsManagementReviewHistoryRequest {
|
||||
statsYr: string;
|
||||
sewerBzmnCd?: string;
|
||||
ctpvNm?: string;
|
||||
statsCd?: string;
|
||||
}
|
||||
|
||||
/** 통계관리 검토 이력 조회 API `data` 배열 요소 */
|
||||
export interface StatiscicsManagementReviewHistoryItem {
|
||||
statsYr: string;
|
||||
ctpvNm: string;
|
||||
sggNm: string;
|
||||
sewerBzmnCd: string;
|
||||
statsCd: string;
|
||||
menuNm: string;
|
||||
wrterOpinionSm: string | null;
|
||||
chckerOpinionSm: string | null;
|
||||
returnOpinionSm: string | null;
|
||||
}
|
||||
|
||||
export interface StatiscicsManagementReviewHistoryResponse {
|
||||
status: string;
|
||||
message?: string;
|
||||
data: StatiscicsManagementReviewHistoryItem[];
|
||||
}
|
||||
|
||||
export interface StatisticsService {
|
||||
getSidoList(params?: { instSeCd?: string }): Promise<ApiResponse<SearchCondition>>;
|
||||
getSggList(sidoName: string, params?: { instSeCd?: string; gugunSkipYn?: "Y" | "N" }): Promise<ApiResponse<Sgg[]>>;
|
||||
@@ -416,10 +478,16 @@ export interface StatisticsService {
|
||||
saveReviewOpinion(param: ReviewOpinionSaveRequest): Promise<ReviewOpinionSaveResponse>;
|
||||
getReviewOpinionDetail(param: getReviewOpinionDetailRequest): Promise<getReviewOpinionDetailResponse>;
|
||||
saveReviewReturn(param: ReviewReturnSaveRequest): Promise<ReviewReturnSaveResponse>;
|
||||
saveInputReturn(items: ReviewInputSaveRequest[]): Promise<ReviewReturnSaveResponse>;
|
||||
approveStatsInputStatus(
|
||||
param: StatsInputStatusApproveBatchRequest,
|
||||
type?: StatsInputStatusApproveKind,
|
||||
): Promise<StatsInputStatusApproveResponse>;
|
||||
submitReview(param: ReviewSubmitRequest): Promise<ReviewSubmitResponse>;
|
||||
getVerificationResultList(param: VerificationResultListRequest): Promise<VerificationResultListResponse>;
|
||||
getImrStatus(param: string): Promise<ImrStatusResponse>;
|
||||
SubmitVerifyException(param: SubmitVerifyExceptionRequest): Promise<SubmitVerifyExceptionResponse>;
|
||||
getColumnGuides(param: string): Promise<StatisticsColumnGuideListResponse>;
|
||||
getReviewerInfo(param: ReviewerInfoRequest): Promise<ReviewerInfoResponse>;
|
||||
getStatiscicsManagementReviewHistory(param: StatiscicsManagementReviewHistoryRequest): Promise<StatiscicsManagementReviewHistoryResponse>;
|
||||
}
|
||||
+14
-94
@@ -102,99 +102,7 @@ export interface SewagePipeFactInstallStatusResponse {
|
||||
|
||||
/** ST00020003 합계 — `GET .../sewer-pipe/pipe-type-facility-status` */
|
||||
export interface SewagePipePipeTypeFacilityStatusItem {
|
||||
pipeByPrstWhol: number;
|
||||
lyngPrlg: number;
|
||||
dmltnPrlg: number;
|
||||
yy1PrlgWhol: number;
|
||||
yy1LyngPrlg: number;
|
||||
yy1DmltnPrlg: number;
|
||||
yy2PrlgWhol: number;
|
||||
yy2LyngPrlg: number;
|
||||
yy2DmltnPrlg: number;
|
||||
yy3PrlgWhol: number;
|
||||
yy3LyngPrlg: number;
|
||||
yy3DmltnPrlg: number;
|
||||
yy4PrlgWhol: number;
|
||||
yy4LyngPrlg: number;
|
||||
yy4DmltnPrlg: number;
|
||||
yy5PrlgWhol: number;
|
||||
yy5LyngPrlg: number;
|
||||
yy5DmltnPrlg: number;
|
||||
yy6PrlgWhol: number;
|
||||
yy6LyngPrlg: number;
|
||||
yy6DmltnPrlg: number;
|
||||
yy7PrlgWhol: number;
|
||||
yy7LyngPrlg: number;
|
||||
yy7DmltnPrlg: number;
|
||||
yy8PrlgWhol: number;
|
||||
yy8LyngPrlg: number;
|
||||
yy8DmltnPrlg: number;
|
||||
yy9PrlgWhol: number;
|
||||
yy9LyngPrlg: number;
|
||||
yy9DmltnPrlg: number;
|
||||
yy10PrlgWhol: number;
|
||||
yy10LyngPrlg: number;
|
||||
yy10DmltnPrlg: number;
|
||||
yy11PrlgWhol: number;
|
||||
yy11LyngPrlg: number;
|
||||
yy11DmltnPrlg: number;
|
||||
yy12PrlgWhol: number;
|
||||
yy12LyngPrlg: number;
|
||||
yy12DmltnPrlg: number;
|
||||
yy13PrlgWhol: number;
|
||||
yy13LyngPrlg: number;
|
||||
yy13DmltnPrlg: number;
|
||||
yy14PrlgWhol: number;
|
||||
yy14LyngPrlg: number;
|
||||
yy14DmltnPrlg: number;
|
||||
yy15PrlgWhol: number;
|
||||
yy15LyngPrlg: number;
|
||||
yy15DmltnPrlg: number;
|
||||
yy16PrlgWhol: number;
|
||||
yy16LyngPrlg: number;
|
||||
yy16DmltnPrlg: number;
|
||||
yy17PrlgWhol: number;
|
||||
yy17LyngPrlg: number;
|
||||
yy17DmltnPrlg: number;
|
||||
yy18PrlgWhol: number;
|
||||
yy18LyngPrlg: number;
|
||||
yy18DmltnPrlg: number;
|
||||
yy19PrlgWhol: number;
|
||||
yy19LyngPrlg: number;
|
||||
yy19DmltnPrlg: number;
|
||||
yy20PrlgWhol: number;
|
||||
yy20LyngPrlg: number;
|
||||
yy20DmltnPrlg: number;
|
||||
yy21PrlgWhol: number;
|
||||
yy21LyngPrlg: number;
|
||||
yy21DmltnPrlg: number;
|
||||
yy22PrlgWhol: number;
|
||||
yy22LyngPrlg: number;
|
||||
yy22DmltnPrlg: number;
|
||||
yy23PrlgWhol: number;
|
||||
yy23LyngPrlg: number;
|
||||
yy23DmltnPrlg: number;
|
||||
yy24PrlgWhol: number;
|
||||
yy24LyngPrlg: number;
|
||||
yy24DmltnPrlg: number;
|
||||
yy25PrlgWhol: number;
|
||||
yy25LyngPrlg: number;
|
||||
yy25DmltnPrlg: number;
|
||||
yy26PrlgWhol: number;
|
||||
yy26LyngPrlg: number;
|
||||
yy26DmltnPrlg: number;
|
||||
yy27PrlgWhol: number;
|
||||
yy27LyngPrlg: number;
|
||||
yy27DmltnPrlg: number;
|
||||
yy28PrlgWhol: number;
|
||||
yy28LyngPrlg: number;
|
||||
yy28DmltnPrlg: number;
|
||||
yy29PrlgWhol: number;
|
||||
yy29LyngPrlg: number;
|
||||
yy29DmltnPrlg: number;
|
||||
yy30PrlgWhol: number;
|
||||
yy30LyngPrlg: number;
|
||||
yy30DmltnPrlg: number;
|
||||
// 고정 필드
|
||||
ctpvNm: string;
|
||||
sggNm: string | null;
|
||||
admdstCd: string;
|
||||
@@ -203,7 +111,19 @@ export interface SewagePipePipeTypeFacilityStatusItem {
|
||||
statsYr: string;
|
||||
rowType: string;
|
||||
rmrk: string | null;
|
||||
}
|
||||
|
||||
// 총계 필드
|
||||
pipeByPrstWhol: number;
|
||||
lyngPrlg: number;
|
||||
dmltnPrlg: number;
|
||||
|
||||
/**
|
||||
* 연도별 동적 데이터 필드
|
||||
"prlg_whol_1995", "lyng_prlg_1995", "dmltn_prlg_1995",
|
||||
|
||||
*/
|
||||
[key: string]: string | number | null;
|
||||
}
|
||||
|
||||
export interface SewagePipePipeTypeFacilityStatusResponse {
|
||||
status: string;
|
||||
|
||||
+15
-3
@@ -9,12 +9,14 @@ export const statisticsVerificationReportColumnInfo: ColumnInfo = {
|
||||
fieldName: "ctpvNm",
|
||||
header: { text: "시도" },
|
||||
styleName: READ_ONLY_STYLE,
|
||||
editable: false,
|
||||
},
|
||||
{
|
||||
name: "sggNm",
|
||||
fieldName: "sggNm",
|
||||
header: { text: "시군구" },
|
||||
styleName: READ_ONLY_STYLE,
|
||||
editable: false,
|
||||
},
|
||||
{
|
||||
name: "menuTabName",
|
||||
@@ -22,6 +24,7 @@ export const statisticsVerificationReportColumnInfo: ColumnInfo = {
|
||||
header: { text: "구분" },
|
||||
width: 150,
|
||||
styleName: READ_ONLY_STYLE,
|
||||
editable: false,
|
||||
},
|
||||
{
|
||||
name: "locgStatusNm",
|
||||
@@ -29,12 +32,14 @@ export const statisticsVerificationReportColumnInfo: ColumnInfo = {
|
||||
header: { text: "진행상태" },
|
||||
width: 120,
|
||||
styleName: READ_ONLY_STYLE,
|
||||
editable: false,
|
||||
},
|
||||
{
|
||||
name: "laePicNm",
|
||||
fieldName: "laePicNm",
|
||||
header: { text: "작성자" },
|
||||
styleName: READ_ONLY_STYLE,
|
||||
editable: false,
|
||||
},
|
||||
{
|
||||
name: "laePicTelNo",
|
||||
@@ -42,36 +47,42 @@ export const statisticsVerificationReportColumnInfo: ColumnInfo = {
|
||||
header: { text: "작성자연락처" },
|
||||
width: 130,
|
||||
styleName: READ_ONLY_STYLE,
|
||||
editable: false,
|
||||
},
|
||||
{
|
||||
name: "laeKbrdrDeptNm",
|
||||
fieldName: "laeKbrdrDeptNm",
|
||||
header: { text: "부서" },
|
||||
styleName: READ_ONLY_STYLE,
|
||||
editable: false,
|
||||
},
|
||||
{
|
||||
name: "laeKbrdrJbgdNm",
|
||||
fieldName: "laeKbrdrJbgdNm",
|
||||
header: { text: "직급" },
|
||||
styleName: READ_ONLY_STYLE,
|
||||
editable: false,
|
||||
},
|
||||
{
|
||||
name: "laeIdfrNm",
|
||||
fieldName: "laeIdfrNm",
|
||||
header: { text: "승인자" },
|
||||
styleName: READ_ONLY_STYLE,
|
||||
editable: false,
|
||||
},
|
||||
{
|
||||
name: "laeIdfrDeptNm",
|
||||
fieldName: "laeIdfrDeptNm",
|
||||
header: { text: "부서" },
|
||||
styleName: READ_ONLY_STYLE,
|
||||
editable: false,
|
||||
},
|
||||
{
|
||||
name: "laeIdfrJbgdNm",
|
||||
fieldName: "laeIdfrJbgdNm",
|
||||
header: { text: "직급" },
|
||||
styleName: READ_ONLY_STYLE,
|
||||
editable: false,
|
||||
},
|
||||
{
|
||||
name: "rjctOpnnCn",
|
||||
@@ -79,6 +90,7 @@ export const statisticsVerificationReportColumnInfo: ColumnInfo = {
|
||||
header: { text: "반려사유" },
|
||||
width: 220,
|
||||
styleName: READ_ONLY_STYLE,
|
||||
editable: false,
|
||||
},
|
||||
{
|
||||
name: "sewerBzmnCd",
|
||||
@@ -176,8 +188,8 @@ export const statisticsVerificationResultColumnInfo: ColumnInfo = {
|
||||
editable: false,
|
||||
},
|
||||
{
|
||||
name: "prcsYn",
|
||||
fieldName: "prcsYn",
|
||||
name: "prcsYnNm",
|
||||
fieldName: "prcsYnNm",
|
||||
header: { text: "상태" },
|
||||
width: 90,
|
||||
styleName: READ_ONLY_STYLE,
|
||||
@@ -223,7 +235,7 @@ export const statisticsVerificationResultColumnInfo: ColumnInfo = {
|
||||
"rsnExpln",
|
||||
"nowVlCn",
|
||||
"compVlCn",
|
||||
"prcsYn",
|
||||
"prcsYnNm",
|
||||
"prcsOpnnExpln",
|
||||
"rjctOpnnCn",
|
||||
"pbcpAprvYn",
|
||||
|
||||
@@ -5,5 +5,9 @@ export { useDataTable } from "./use-data-table";
|
||||
export { useGlobalProgressStore } from "./use-global-progress-store";
|
||||
export { useMenuStore } from "./use-menu-store";
|
||||
export { useUserStore } from "./use-user-store";
|
||||
export {
|
||||
useStatisticsInputStatusConfirmGroupGate,
|
||||
useStatisticsInputToolbarGroupGate,
|
||||
} from "./use-statistics-input-toolbar-group-gate";
|
||||
export { usePrompt } from "./use-prompt";
|
||||
export { useSelectPrompt } from "./use-select-prompt";
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import {
|
||||
checkStatisticsInputStatusConfirmGroupMembership,
|
||||
checkStatisticsInputToolbarGroupMembership,
|
||||
} from "@/entities/group-user/lib/check-statistics-input-toolbar-group-membership";
|
||||
|
||||
import { useUserStore } from "./use-user-store";
|
||||
|
||||
/** 통계 입력 상단 툴바(저장·제출·검증결과 등) — 그룹 멤버십 만족 시에만 true */
|
||||
export function useStatisticsInputToolbarGroupGate(): boolean {
|
||||
const userInfo = useUserStore((s) => s.userInfo);
|
||||
const [allowed, setAllowed] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
const name = userInfo?.userName?.trim() ?? "";
|
||||
const uid = userInfo?.userUnqId?.trim() ?? "";
|
||||
if (!name || !uid) {
|
||||
setAllowed(false);
|
||||
return;
|
||||
}
|
||||
void (async () => {
|
||||
try {
|
||||
const ok = await checkStatisticsInputToolbarGroupMembership(name, uid);
|
||||
if (!cancelled) setAllowed(ok);
|
||||
} catch {
|
||||
if (!cancelled) setAllowed(false);
|
||||
}
|
||||
})();
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, [userInfo?.userName, userInfo?.userUnqId]);
|
||||
|
||||
return allowed;
|
||||
}
|
||||
|
||||
/** 통계 입력 현황 — `GRP_ST_CONFIRM` / `GRP_ADMIN` 멤버일 때만 true */
|
||||
export function useStatisticsInputStatusConfirmGroupGate(): boolean {
|
||||
const userInfo = useUserStore((s) => s.userInfo);
|
||||
const [allowed, setAllowed] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
const name = userInfo?.userName?.trim() ?? "";
|
||||
const uid = userInfo?.userUnqId?.trim() ?? "";
|
||||
if (!name || !uid) {
|
||||
setAllowed(false);
|
||||
return;
|
||||
}
|
||||
void (async () => {
|
||||
try {
|
||||
const ok = await checkStatisticsInputStatusConfirmGroupMembership(name, uid);
|
||||
if (!cancelled) setAllowed(ok);
|
||||
} catch {
|
||||
if (!cancelled) setAllowed(false);
|
||||
}
|
||||
})();
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, [userInfo?.userName, userInfo?.userUnqId]);
|
||||
|
||||
return allowed;
|
||||
}
|
||||
@@ -70,6 +70,10 @@ function Gis({
|
||||
viewExtent,
|
||||
viewMinZoom,
|
||||
showZoomLevel = false,
|
||||
zoomGuide,
|
||||
showFloatingSearchButton = true,
|
||||
treeTogglePosition = "center",
|
||||
showZoomScaleInfo = false,
|
||||
}) {
|
||||
const mapRef = useRef();
|
||||
const [mapObject, setMapObject] = useState({});
|
||||
@@ -311,6 +315,7 @@ function Gis({
|
||||
onProgressChange={handleProgressChange}
|
||||
layerSettingView={LayerSettingView}
|
||||
inlineLayerSettingView={inlineLayerSettingView}
|
||||
toggleButtonPosition={treeTogglePosition}
|
||||
/>
|
||||
|
||||
{typeof WaterDepth === "function" && (
|
||||
@@ -345,13 +350,15 @@ function Gis({
|
||||
</div>
|
||||
)}
|
||||
<GisToolBar />
|
||||
{showZoomLevel && <GisZoomLevel />}
|
||||
{showZoomLevel && (
|
||||
<GisZoomLevel zoomGuide={zoomGuide} showZoomScaleInfo={showZoomScaleInfo} />
|
||||
)}
|
||||
<GisMapToggle />
|
||||
<GisSelect onFeatureSelect={handleFeatureSelect} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{isSearch && (
|
||||
{isSearch && showFloatingSearchButton && (
|
||||
<div className="absolute right-8 top-[248px] z-20">
|
||||
<button
|
||||
onClick={() => setIsSearchModalOpen(true)}
|
||||
|
||||
@@ -46,6 +46,7 @@ export default React.memo(function GisTree({
|
||||
layerSettingView: LayerSettingView = null,
|
||||
layerIconVisible,
|
||||
inlineLayerSettingView,
|
||||
toggleButtonPosition = "center",
|
||||
}) {
|
||||
const { gisCore, treeData } = useGisContext();
|
||||
|
||||
@@ -510,6 +511,9 @@ export default React.memo(function GisTree({
|
||||
|
||||
if (!treeData || treeData.length === 0) return null;
|
||||
|
||||
const toggleButtonPositionClass =
|
||||
toggleButtonPosition === "top" ? "top-[5.5rem]" : "top-1/2 -translate-y-1/2";
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* 사이드 패널 */}
|
||||
@@ -538,6 +542,8 @@ export default React.memo(function GisTree({
|
||||
(child) =>
|
||||
child.parent === node.id && child.data.exprsYn === "Y"
|
||||
);
|
||||
const showLayerActionButton = layerIconVisible?.(node);
|
||||
const showLayerActionIcon = depth > 0 && imageVisible;
|
||||
|
||||
const inlineLayerSetting = inlineLayerSettingView?.(node);
|
||||
|
||||
@@ -569,8 +575,24 @@ export default React.memo(function GisTree({
|
||||
<span className="text-[1.3rem] font-medium text-label">
|
||||
{node.text}
|
||||
</span>
|
||||
{((depth > 0 && imageVisible) || layerIconVisible?.(node)) && (
|
||||
<span>
|
||||
{showLayerActionButton && (
|
||||
<button
|
||||
type="button"
|
||||
className="ml-1 shrink-0 rounded-sm border border-[#9cc6f0] bg-white px-2 py-[1px] text-[1.1rem] font-medium leading-5 text-[#2c6fb7] transition-colors hover:bg-[#eef6ff]"
|
||||
onClick={() =>
|
||||
handleLayerImgClick(
|
||||
node.data.lyrTyNm,
|
||||
node.id,
|
||||
node
|
||||
)
|
||||
}
|
||||
title={`${node.text} 목록보기`}
|
||||
>
|
||||
목록보기
|
||||
</button>
|
||||
)}
|
||||
{!showLayerActionButton && showLayerActionIcon && (
|
||||
<span className="shrink-0">
|
||||
<img
|
||||
className="h-5 w-5 cursor-pointer"
|
||||
src="/images/map/layericon/Layer_Select_BTN.png"
|
||||
@@ -611,7 +633,7 @@ export default React.memo(function GisTree({
|
||||
)}
|
||||
<button
|
||||
onClick={() => setVisible(false)}
|
||||
className="absolute right-[-3px] top-1/2 z-50 -translate-y-1/2 transform rounded-l-none rounded-r border border-l border-gray-300 bg-white px-1 py-2 shadow-sm"
|
||||
className={`absolute right-[-3px] z-50 transform rounded-l-none rounded-r border border-l border-gray-300 bg-white px-1 py-2 shadow-sm ${toggleButtonPositionClass}`}
|
||||
>
|
||||
<ChevronLeft size={16} />
|
||||
</button>
|
||||
@@ -619,7 +641,7 @@ export default React.memo(function GisTree({
|
||||
{!visible && (
|
||||
<button
|
||||
onClick={() => setVisible(true)}
|
||||
className="absolute left-[-3px] top-1/2 z-50 -translate-y-1/2 transform rounded-r border border-r border-gray-300 bg-white px-1 py-2 shadow-sm"
|
||||
className={`absolute left-[-3px] z-50 transform rounded-r border border-r border-gray-300 bg-white px-1 py-2 shadow-sm ${toggleButtonPositionClass}`}
|
||||
>
|
||||
<ChevronRight size={16} />
|
||||
</button>
|
||||
|
||||
@@ -1,13 +1,22 @@
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import { useGisContext } from './Gis';
|
||||
|
||||
export default React.memo(function GisZoomLevel() {
|
||||
const DPI = 25.4 / 0.28;
|
||||
const INCHES_PER_METER = 39.37;
|
||||
|
||||
const formatScaleValue = scale => {
|
||||
if (!Number.isFinite(scale) || scale <= 0) return '-';
|
||||
return `1:${Math.round(scale).toLocaleString()}`;
|
||||
};
|
||||
|
||||
export default React.memo(function GisZoomLevel({ zoomGuide, showZoomScaleInfo = false }) {
|
||||
const { gisMap } = useGisContext();
|
||||
const trackRef = useRef(null);
|
||||
const [zoomInfo, setZoomInfo] = useState({
|
||||
zoom: 0,
|
||||
minZoom: 0,
|
||||
maxZoom: 0,
|
||||
scale: 0,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
@@ -17,10 +26,16 @@ export default React.memo(function GisZoomLevel() {
|
||||
if (!view) return undefined;
|
||||
|
||||
const updateZoomInfo = () => {
|
||||
const resolution = view.getResolution?.() ?? 0;
|
||||
const projection = view.getProjection?.();
|
||||
const metersPerUnit = projection?.getMetersPerUnit?.() ?? 1;
|
||||
const scale = resolution * metersPerUnit * INCHES_PER_METER * DPI;
|
||||
|
||||
setZoomInfo({
|
||||
zoom: view.getZoom() ?? 0,
|
||||
minZoom: view.getMinZoom?.() ?? 0,
|
||||
maxZoom: view.getMaxZoom?.() ?? 20,
|
||||
scale,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -34,11 +49,30 @@ export default React.memo(function GisZoomLevel() {
|
||||
|
||||
if (!gisMap) return <></>;
|
||||
|
||||
const { zoom, minZoom, maxZoom } = zoomInfo;
|
||||
const { zoom, minZoom, maxZoom, scale } = zoomInfo;
|
||||
const range = Math.max(maxZoom - minZoom, 1);
|
||||
const normalized = Math.min(Math.max((zoom - minZoom) / range, 0), 1);
|
||||
const fillHeight = `${normalized * 100}%`;
|
||||
const thumbBottom = `calc(${fillHeight} - 1px)`;
|
||||
const guideZoom = Number(zoomGuide?.zoom);
|
||||
const hasGuide =
|
||||
Boolean(zoomGuide?.label) &&
|
||||
Number.isFinite(guideZoom) &&
|
||||
zoomGuide?.visible !== false;
|
||||
const guideNormalized = hasGuide
|
||||
? Math.min(Math.max((guideZoom - minZoom) / range, 0), 1)
|
||||
: 0;
|
||||
const guideBottom = `calc(${guideNormalized * 100}% - 1px)`;
|
||||
const isGuideActive = hasGuide ? zoom >= guideZoom : false;
|
||||
const titleParts = [`현재 줌 레벨 ${zoom.toFixed(1)}`];
|
||||
|
||||
if (hasGuide) {
|
||||
titleParts.push(
|
||||
`${zoomGuide.label} 줌 ${guideZoom}${isGuideActive ? ' 이상' : ' 미만'}`,
|
||||
);
|
||||
}
|
||||
|
||||
const controlTitle = titleParts.join(' / ');
|
||||
|
||||
const updateZoomFromClientY = clientY => {
|
||||
if (!gisMap || !trackRef.current) return;
|
||||
@@ -89,7 +123,22 @@ export default React.memo(function GisZoomLevel() {
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="zoom-level-control" title={`현재 줌 레벨 ${zoom.toFixed(1)}`}>
|
||||
<div
|
||||
className={`zoom-level-control ${hasGuide ? 'has-zoom-guide' : ''}`}
|
||||
title={controlTitle}
|
||||
>
|
||||
{showZoomScaleInfo && (
|
||||
<div className="zoom-level-summary" aria-live="polite">
|
||||
<div className="zoom-level-summary-row">
|
||||
<span className="zoom-level-summary-label">줌레벨</span>
|
||||
<span className="zoom-level-summary-value">{zoom.toFixed(1)}</span>
|
||||
</div>
|
||||
<div className="zoom-level-summary-row">
|
||||
<span className="zoom-level-summary-label">축척</span>
|
||||
<span className="zoom-level-summary-value">{formatScaleValue(scale)}</span>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<div className="zoom-level-panel">
|
||||
<button type="button" className="zoom-level-btn" onClick={zoomIn} aria-label="확대">
|
||||
+
|
||||
@@ -100,6 +149,16 @@ export default React.memo(function GisZoomLevel() {
|
||||
className="zoom-level-track"
|
||||
onPointerDown={handleTrackPointerDown}
|
||||
>
|
||||
{hasGuide && (
|
||||
<div
|
||||
className={`zoom-level-guide ${isGuideActive ? 'is-active' : 'is-inactive'}`}
|
||||
style={{ bottom: guideBottom }}
|
||||
aria-hidden="true"
|
||||
>
|
||||
<span className="zoom-level-guide-label">{zoomGuide.label}</span>
|
||||
<span className="zoom-level-guide-dot" />
|
||||
</div>
|
||||
)}
|
||||
<div className="zoom-level-fill" style={{ height: fillHeight }} />
|
||||
<div className="zoom-level-thumb" style={{ bottom: thumbBottom }} />
|
||||
</div>
|
||||
|
||||
@@ -180,8 +180,44 @@
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.zoom-level-summary {
|
||||
position: absolute;
|
||||
right: 56px;
|
||||
bottom: 6px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
min-width: 126px;
|
||||
padding: 7px 10px;
|
||||
border: 1px solid #9aa7b8;
|
||||
border-radius: 6px;
|
||||
background: rgba(255, 255, 255, 0.96);
|
||||
box-shadow: 0 0 5px #999;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.zoom-level-summary-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
font-size: 11px;
|
||||
line-height: 1.2;
|
||||
color: #334155;
|
||||
}
|
||||
|
||||
.zoom-level-summary-label {
|
||||
font-weight: 700;
|
||||
color: #1d4f91;
|
||||
}
|
||||
|
||||
.zoom-level-summary-value {
|
||||
font-weight: 600;
|
||||
color: #334155;
|
||||
}
|
||||
|
||||
.zoom-level-panel {
|
||||
overflow: hidden;
|
||||
overflow: visible;
|
||||
width: 40px;
|
||||
background: #fff;
|
||||
border: 1px solid #9aa7b8;
|
||||
@@ -217,12 +253,14 @@
|
||||
}
|
||||
|
||||
.zoom-level-gauge {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 40px;
|
||||
height: 128px;
|
||||
background: #fff;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.zoom-level-track {
|
||||
@@ -232,6 +270,7 @@
|
||||
border-radius: 6px;
|
||||
cursor: ns-resize;
|
||||
touch-action: none;
|
||||
overflow: visible;
|
||||
background:
|
||||
linear-gradient(to top, #b8b8b8, #b8b8b8) center / 4px 100% no-repeat,
|
||||
repeating-linear-gradient(
|
||||
@@ -267,6 +306,61 @@
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
|
||||
}
|
||||
|
||||
.zoom-level-guide {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
transform: translate(calc(-100% - 10px), 50%);
|
||||
pointer-events: none;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.zoom-level-guide::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: -10px;
|
||||
width: 10px;
|
||||
height: 2px;
|
||||
background: currentColor;
|
||||
transform: translateY(-50%);
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.zoom-level-guide-label {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
height: 20px;
|
||||
padding: 0 8px;
|
||||
border: 1px solid currentColor;
|
||||
border-radius: 999px;
|
||||
background: rgba(255, 255, 255, 0.96);
|
||||
box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.zoom-level-guide-dot {
|
||||
display: inline-block;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 999px;
|
||||
background: currentColor;
|
||||
box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.94);
|
||||
}
|
||||
|
||||
.zoom-level-guide.is-active {
|
||||
color: #d9363e;
|
||||
}
|
||||
|
||||
.zoom-level-guide.is-inactive {
|
||||
color: #9ca3af;
|
||||
}
|
||||
|
||||
.ol-scale-line {
|
||||
background: rgba(0, 60, 136, 0.3);
|
||||
border-radius: 4px;
|
||||
|
||||
@@ -16,13 +16,18 @@ const FACILITY_TYPE_URL_MAP: Record<string, string> = {
|
||||
interface SearchBarProps {
|
||||
gisMaps: React.RefObject<any>;
|
||||
facilityTypes: { text: string; val: string }[];
|
||||
sidoSearchZoom?: number;
|
||||
}
|
||||
|
||||
interface CenterSelectDataType extends SelectDataType {
|
||||
center?: [number, number]; // 좌표 중심 위치
|
||||
}
|
||||
|
||||
export const ProcSearchBar = ({ gisMaps, facilityTypes }: SearchBarProps) => {
|
||||
export const ProcSearchBar = ({
|
||||
gisMaps,
|
||||
facilityTypes,
|
||||
sidoSearchZoom = 11,
|
||||
}: SearchBarProps) => {
|
||||
const [sidoValue, setSidoValue] = useState("0");
|
||||
const [sigunValue, setSigunValue] = useState("0");
|
||||
const [sidoData, setSidoData] = useState<CenterSelectDataType[]>([
|
||||
@@ -271,8 +276,8 @@ export const ProcSearchBar = ({ gisMaps, facilityTypes }: SearchBarProps) => {
|
||||
}
|
||||
}
|
||||
|
||||
moveMapToCenter(gisMaps, selectedSido.center, 11);
|
||||
}, [gisMaps, sidoValue, sigunValue, sidoData, filteredSigunData, sigunData]);
|
||||
moveMapToCenter(gisMaps, selectedSido.center, sidoSearchZoom);
|
||||
}, [gisMaps, sidoValue, sigunValue, sidoData, filteredSigunData, sigunData, sidoSearchZoom]);
|
||||
|
||||
const handleFeatureFocus = (data: any) => {
|
||||
const map = gisMaps.current;
|
||||
|
||||
Reference in New Issue
Block a user