조사결과 관로·맨홀 지도 레이어와 보고서 조회 연동

This commit is contained in:
kiminchan
2026-08-03 10:11:48 +09:00
parent bcf5d3caec
commit c9d85a8ce4
22 changed files with 1538 additions and 56 deletions
@@ -17,6 +17,7 @@ type LayerComponentProps = {
chmbrYdnts: string;
gisObject?: Record<string, any>; // GIS 객체 추가
rawFeatureData?: any;
surveyResultContent?: React.ReactNode;
};
type LayerContentMap = {
[key: string]: {
@@ -0,0 +1,81 @@
"use client";
import type { ExmnMapFilters, ExmnMapJobType } from "./exmnMapTypes";
type Props = {
jobType: ExmnMapJobType;
filters: ExmnMapFilters;
onFiltersChange: (filters: ExmnMapFilters) => void;
};
const GRADE_OPTIONS = ["", "1", "2", "3", "4", "5"];
/** 조사결과 레이어의 세 가지 자동 적용 필터다. */
export default function ExmnLayerSettingPanel({
jobType,
filters,
onFiltersChange,
}: Props) {
const updateFilter = (key: keyof ExmnMapFilters, value: string) => {
onFiltersChange({
...filters,
[key]: value.replace(/[^0-9]/g, ""),
});
};
const selectClass =
"h-[24px] w-[54px] rounded-[4px] border border-[#ccd6df] bg-white px-2 text-[1rem] text-[#222] outline-none focus:border-primary";
const labelClass = "shrink-0 text-[1.05rem] font-medium text-slate-700";
return (
<div className="w-full rounded-[6px] border border-[#dbe7f5] bg-white px-2 py-[9px] shadow-[0_2px_8px_rgba(15,23,42,0.05)]">
<div className="mb-2 flex items-center gap-1">
<span className={`h-2 w-2 rounded-full ${jobType === "PPL" ? "bg-[#facc15]" : "bg-[#8b5cf6]"}`} />
<span className="text-[1.1rem] font-semibold text-slate-700">
{jobType === "PPL" ? "관로조사" : "맨홀조사"}
</span>
</div>
<div className="space-y-1.5">
<label className="flex min-h-[25px] items-center justify-between gap-2">
<span className={labelClass}>사업차수</span>
<input
className={selectClass}
type="text"
inputMode="numeric"
maxLength={10}
placeholder="전체"
value={filters.bizCycl}
onChange={(event) => updateFilter("bizCycl", event.target.value)}
/>
</label>
<label className="flex min-h-[25px] items-center justify-between gap-2">
<span className={labelClass}>구조적 상태등급</span>
<select
className={selectClass}
value={filters.structuralGrade}
onChange={(event) => updateFilter("structuralGrade", event.target.value)}
>
{GRADE_OPTIONS.map((grade) => (
<option key={grade || "all"} value={grade}>
{grade || "전체"}
</option>
))}
</select>
</label>
<label className="flex min-h-[25px] items-center justify-between gap-2">
<span className={labelClass}>운영적 상태등급</span>
<select
className={selectClass}
value={filters.operationalGrade}
onChange={(event) => updateFilter("operationalGrade", event.target.value)}
>
{GRADE_OPTIONS.map((grade) => (
<option key={grade || "all"} value={grade}>
{grade || "전체"}
</option>
))}
</select>
</label>
</div>
</div>
);
}
@@ -0,0 +1,134 @@
"use client";
import {
Button,
Table,
TableBody,
TableCell,
TableRow,
} from "@common/components";
import { getExmnPipeReportAvailability } from "@/features/exmn";
import { openWindowPopup } from "@/features/windowPopup/lib/openWindowPopup";
type ExmnSurveyResultSectionProps = {
featureData: any;
};
const readRawFeatureProperty = (featureData: any, keys: string[]) => {
for (const key of keys) {
const value =
featureData?.get?.(key) ??
featureData?.values_?.[key] ??
featureData?.[key];
if (value !== undefined && value !== null) return value;
}
return undefined;
};
const readFeatureProperty = (featureData: any, keys: string[]) =>
String(readRawFeatureProperty(featureData, keys) ?? "").trim();
const readBooleanFeatureProperty = (featureData: any, keys: string[]) => {
const value = readRawFeatureProperty(featureData, keys);
return value === true || String(value ?? "").trim().toLowerCase() === "true";
};
const displayValue = (value: string) => value || "-";
export default function ExmnSurveyResultSection({
featureData,
}: ExmnSurveyResultSectionProps) {
const exmnBizId = readFeatureProperty(featureData, ["exmnBizId"]);
const jobType = readFeatureProperty(featureData, ["jobType"]);
const pipeNumber = readFeatureProperty(featureData, [
"gisManagementNo",
"fclt_mng_no",
"fcltMngNo",
]);
const reportAvailable = readBooleanFeatureProperty(featureData, [
"reportAvailable",
]);
const canOpenPipeReport = jobType === "PPL" && Boolean(exmnBizId && pipeNumber);
const openPipeReport = async () => {
if (!canOpenPipeReport) return;
if (!reportAvailable) {
alert("등록된 관로 조사보고서가 없습니다.");
return;
}
try {
const availability = await getExmnPipeReportAvailability(
exmnBizId,
pipeNumber,
);
if (!availability.available) {
alert(
availability.message?.trim()
|| `선택한 관로번호의 조사보고서가 등록된 PDF에 없습니다: ${pipeNumber}`,
);
return;
}
const reportWindow = openWindowPopup("exmnPipeReport", {
exmnBizId,
pipeNumber,
reportNo: readFeatureProperty(featureData, ["reportNo"]),
});
if (!reportWindow) {
alert("팝업이 차단되었습니다. 브라우저의 팝업 허용 설정을 확인해주세요.");
}
} catch (error) {
alert(
error instanceof Error && error.message
? error.message
: "관로 조사보고서 열람 가능 여부를 확인하지 못했습니다.",
);
}
};
const rows = [
["사업명", readFeatureProperty(featureData, ["bizNm"])],
["사업차수", readFeatureProperty(featureData, ["bizCycl"])],
["처리분구", readFeatureProperty(featureData, ["trtdstNm"])],
["조사유형", jobType === "MNHL" ? "맨홀조사" : "관로조사"],
["보고서번호", readFeatureProperty(featureData, ["reportNo"])],
["구조적결함 등급", readFeatureProperty(featureData, ["structuralGrade"])],
["운영적결함 등급", readFeatureProperty(featureData, ["operationalGrade"])],
];
return (
<section className="border-b border-[#d9e2ec] bg-white">
<div className="card-header flex items-center justify-between">
<h3 className="text-2xl mx-3 font-medium text-label">조사 결과</h3>
{jobType === "PPL" && (
<Button
onClick={openPipeReport}
disabled={!canOpenPipeReport}
className="px-4 mr-3 py-2 bg-[#16c784] text-white rounded-sm text-sm font-medium hover:bg-[#12ad72] disabled:cursor-not-allowed disabled:bg-[#a7d9c6]"
>
조사보고서 보기
</Button>
)}
</div>
<div className="card !m-[1.2rem] !p-0">
<Table variant="secondary">
<TableBody className="text-center">
{rows.map(([label, value]) => (
<TableRow key={label}>
<TableCell className="w-[120px] whitespace-nowrap bg-blue-100 text-xs font-bold">
{label}
</TableCell>
<TableCell className="break-all text-left text-xs">
{displayValue(value)}
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</div>
</section>
);
}
@@ -0,0 +1,25 @@
import { getRawJson } from "../../../../components/lib/api";
import type { ExmnMapFilters, ExmnMapJobType } from "./exmnMapTypes";
type ExmnLayerScope = {
sggCd?: string;
ctpvNm?: string;
sggNm?: string;
};
/** 사업차수·구조등급·운영등급 AND 조건으로 조사결과 GeoJSON을 조회한다. */
export const getExmnMapLayer = async (
jobType: ExmnMapJobType,
filters: ExmnMapFilters,
scope: ExmnLayerScope,
) => {
const query = new URLSearchParams({ jobType });
if (scope.sggCd?.trim()) query.set("sggCd", scope.sggCd.trim());
if (scope.ctpvNm?.trim()) query.set("ctpvNm", scope.ctpvNm.trim());
if (scope.sggNm?.trim()) query.set("sggNm", scope.sggNm.trim());
if (filters.bizCycl) query.set("bizCycl", filters.bizCycl);
if (filters.structuralGrade) query.set("structuralGrade", filters.structuralGrade);
if (filters.operationalGrade) query.set("operationalGrade", filters.operationalGrade);
return getRawJson(`/sewerage-service/api/v1/exmnMap/layers?${query.toString()}`);
};
@@ -0,0 +1,298 @@
export const EXMN_RESULT_ROOT_NODE_ID = "SN_EXMN_RESULT";
export const EXMN_RESULT_PPL_NODE_ID = "SN_EXMN_RESULT_PPL";
export const EXMN_RESULT_MNHL_NODE_ID = "SN_EXMN_RESULT_MNHL";
export const EXMN_RESULT_PPL_LAYER_ID = "SN_EXMN_RESULT_PPL_LAYER";
export const EXMN_RESULT_MNHL_LAYER_ID = "SN_EXMN_RESULT_MNHL_LAYER";
export const EXMN_RESULT_ROOT_LAYER_TYPE = "sn_exmn_result_group";
export const EXMN_RESULT_PPL_LAYER_TYPE = "sn_exmn_result_ppl";
export const EXMN_RESULT_MNHL_LAYER_TYPE = "sn_exmn_result_mnhl";
// 레이어 트리에서 조사 관로와 기존 맨홀 분류 심볼을 즉시 구분하기 위한 전용 범례 스타일이다.
export const EXMN_RESULT_PPL_LEGEND_COLOR = "#facc15";
export const EXMN_RESULT_MNHL_LEGEND_ICON = "SN_EXMN_MANHOLE_PURPLE.png?v=3";
export type ExmnMapJobType = "PPL" | "MNHL";
export type ExmnMapFilters = {
bizCycl: string;
structuralGrade: string;
operationalGrade: string;
};
export type ExmnMapEntryContext = {
exmnBizId: string;
ctpvNm: string;
sggNm: string;
bizCycl: string;
jobType: ExmnMapJobType | null;
};
export const EMPTY_EXMN_MAP_FILTERS: ExmnMapFilters = {
bizCycl: "",
structuralGrade: "",
operationalGrade: "",
};
const buildControlNode = (
id: string,
name: string,
upperId: string | number | null,
layerType: string,
initialVisible: boolean,
) => {
const isPipeNode = layerType === EXMN_RESULT_PPL_LAYER_TYPE;
const isManholeNode = layerType === EXMN_RESULT_MNHL_LAYER_TYPE;
return {
lyrSn: id,
id,
lyrNm: name,
upperLyrSn: upperId,
upId: upperId,
sortOrdr: upperId ? (id === EXMN_RESULT_PPL_NODE_ID ? "1" : "2") : "5",
drawOrdr: null,
flterSql: null,
gobjTy: isPipeNode ? "line" : "",
lyrTyNm: layerType,
useYn: "Y",
minViewSize: null,
iconNm: isManholeNode ? EXMN_RESULT_MNHL_LEGEND_ICON : null,
iconSize: null,
lblAtrbNm: null,
fontNm: null,
fontIntnColor: null,
fontExtnColor: null,
fontExtnWdth: null,
lnWdth: null,
lnColor: isPipeNode ? EXMN_RESULT_PPL_LEGEND_COLOR : null,
polgnColor: null,
initEprssYn: initialVisible ? "Y" : "N",
clickPsblYn: "N",
exprsYn: "Y",
cmncNm: "all",
srvcNm: "api",
actlLyrYn: "N",
clckZoom: null,
children: null,
};
};
const resolveNodeData = (node: any) => node?.data ?? node ?? {};
const resolveNodeId = (node: any) => {
const nodeData = resolveNodeData(node);
return nodeData?.lyrSn ?? nodeData?.id ?? "";
};
const resolveNodeParentId = (node: any) => {
const nodeData = resolveNodeData(node);
return nodeData?.upperLyrSn ?? nodeData?.upId ?? "";
};
const resolveNodeLayerType = (node: any) => {
const nodeData = resolveNodeData(node);
return String(
nodeData?.lyrTyNm ??
nodeData?.lyrTypeNm ??
nodeData?.lyr_type_nm ??
"",
).trim();
};
const resolveNodeName = (node: any) => {
const nodeData = resolveNodeData(node);
return String(nodeData?.lyrNm ?? nodeData?.name ?? "").trim();
};
const sameNodeId = (left: unknown, right: unknown) =>
String(left ?? "") === String(right ?? "");
const isNodeType = (node: any, layerType: string) =>
resolveNodeLayerType(node) === layerType;
const normalizeControlNode = (
node: any,
fallbackId: string,
fallbackName: string,
upperId: string | number | null,
layerType: string,
initialVisible: boolean,
) => {
const nodeId = resolveNodeId(node) || fallbackId;
const isPipeNode = layerType === EXMN_RESULT_PPL_LAYER_TYPE;
const isManholeNode = layerType === EXMN_RESULT_MNHL_LAYER_TYPE;
return {
...node,
lyrSn: nodeId,
id: nodeId,
// DB에 저장된 과거 명칭과 무관하게 조사관리 표준 화면 명칭으로 표시한다.
lyrNm: fallbackName,
upperLyrSn: upperId,
upId: upperId,
lyrTyNm: layerType,
gobjTy: isPipeNode ? "line" : "",
iconNm: isManholeNode ? EXMN_RESULT_MNHL_LEGEND_ICON : null,
lnColor: isPipeNode ? EXMN_RESULT_PPL_LEGEND_COLOR : null,
initEprssYn: initialVisible ? "Y" : "N",
clickPsblYn: "N",
srvcNm: "api",
actlLyrYn: "N",
};
};
/**
* 서버 레이어 설정의 조사결과 노드를 우선 사용한다.
* DB 설정이 아직 배포되지 않았거나 일부만 등록된 환경에서는 누락 노드만 가상 노드로 보완한다.
*/
export const appendExmnResultControlNodes = (
data: unknown[],
initialJobType: ExmnMapJobType | null,
) => {
if (!Array.isArray(data)) return data;
const rootNode =
data.find((item: any) => isNodeType(item, EXMN_RESULT_ROOT_LAYER_TYPE)) ??
data.find((item: any) =>
sameNodeId(resolveNodeId(item), EXMN_RESULT_ROOT_NODE_ID),
) ??
data.find(
(item: any) =>
resolveNodeName(item) === "조사결과" && !resolveNodeParentId(item),
);
const rootId = resolveNodeId(rootNode) || EXMN_RESULT_ROOT_NODE_ID;
const pplNode =
data.find((item: any) => isNodeType(item, EXMN_RESULT_PPL_LAYER_TYPE)) ??
data.find((item: any) =>
sameNodeId(resolveNodeId(item), EXMN_RESULT_PPL_NODE_ID),
) ??
data.find(
(item: any) =>
["관로조사", "CCTV조사"].includes(resolveNodeName(item)) &&
sameNodeId(resolveNodeParentId(item), rootId),
);
const mnhlNode =
data.find((item: any) => isNodeType(item, EXMN_RESULT_MNHL_LAYER_TYPE)) ??
data.find((item: any) =>
sameNodeId(resolveNodeId(item), EXMN_RESULT_MNHL_NODE_ID),
) ??
data.find(
(item: any) =>
resolveNodeName(item) === "맨홀조사" &&
sameNodeId(resolveNodeParentId(item), rootId),
);
const normalizedPplNode = pplNode
? normalizeControlNode(
pplNode,
EXMN_RESULT_PPL_NODE_ID,
"관로조사",
rootId,
EXMN_RESULT_PPL_LAYER_TYPE,
initialJobType === "PPL",
)
: buildControlNode(
EXMN_RESULT_PPL_NODE_ID,
"관로조사",
rootId,
EXMN_RESULT_PPL_LAYER_TYPE,
initialJobType === "PPL",
);
const normalizedMnhlNode = mnhlNode
? normalizeControlNode(
mnhlNode,
EXMN_RESULT_MNHL_NODE_ID,
"맨홀조사",
rootId,
EXMN_RESULT_MNHL_LAYER_TYPE,
initialJobType === "MNHL",
)
: buildControlNode(
EXMN_RESULT_MNHL_NODE_ID,
"맨홀조사",
rootId,
EXMN_RESULT_MNHL_LAYER_TYPE,
initialJobType === "MNHL",
);
const childIds = [
resolveNodeId(normalizedPplNode),
resolveNodeId(normalizedMnhlNode),
];
const previousChildren = Array.isArray((rootNode as any)?.children)
? (rootNode as any).children
: [];
const normalizedRootNode = {
...(rootNode
? normalizeControlNode(
rootNode,
EXMN_RESULT_ROOT_NODE_ID,
"조사결과",
null,
EXMN_RESULT_ROOT_LAYER_TYPE,
false,
)
: buildControlNode(
EXMN_RESULT_ROOT_NODE_ID,
"조사결과",
null,
EXMN_RESULT_ROOT_LAYER_TYPE,
false,
)),
children: [...previousChildren, ...childIds].filter(
(childId, index, children) =>
childId !== "" &&
children.findIndex((candidate) => sameNodeId(candidate, childId)) ===
index,
),
};
const recognizedIds = new Set(
[
EXMN_RESULT_ROOT_NODE_ID,
EXMN_RESULT_PPL_NODE_ID,
EXMN_RESULT_MNHL_NODE_ID,
resolveNodeId(rootNode),
resolveNodeId(pplNode),
resolveNodeId(mnhlNode),
]
.filter((id) => id !== "")
.map((id) => String(id)),
);
const filtered = data.filter((item: any) => {
const nodeId = String(resolveNodeId(item));
return (
!recognizedIds.has(nodeId) &&
!isNodeType(item, EXMN_RESULT_ROOT_LAYER_TYPE) &&
!isNodeType(item, EXMN_RESULT_PPL_LAYER_TYPE) &&
!isNodeType(item, EXMN_RESULT_MNHL_LAYER_TYPE)
);
});
return [
...filtered,
normalizedRootNode,
normalizedPplNode,
normalizedMnhlNode,
];
};
export const isExmnResultPplNode = (node: any) =>
sameNodeId(resolveNodeId(node), EXMN_RESULT_PPL_NODE_ID) ||
isNodeType(node, EXMN_RESULT_PPL_LAYER_TYPE);
export const isExmnResultMnhlNode = (node: any) =>
sameNodeId(resolveNodeId(node), EXMN_RESULT_MNHL_NODE_ID) ||
isNodeType(node, EXMN_RESULT_MNHL_LAYER_TYPE);
export const buildExmnMapEntryContext = (
searchParams: Pick<URLSearchParams, "get">,
): ExmnMapEntryContext => {
const rawJobType = String(searchParams.get("exmnJobType") ?? "").toUpperCase();
return {
exmnBizId: String(searchParams.get("exmnBizId") ?? "").trim(),
ctpvNm: String(searchParams.get("ctpvNm") ?? "").trim(),
sggNm: String(searchParams.get("sggNm") ?? "").trim(),
bizCycl: String(searchParams.get("bizCycl") ?? "").replace(/[^0-9]/g, ""),
jobType: rawJobType === "PPL" || rawJobType === "MNHL" ? rawJobType : null,
};
};
@@ -34,7 +34,15 @@ const inputColumn = [
type operationDataType = { year: string; type: string, bizInfoNm: string, bizType: string };
const MsSwagePpl = ({ featureData, onSaveClick }: { featureData: any, onSaveClick?: () => void }) => {
const MsSwagePpl = ({
featureData,
onSaveClick,
surveyResultContent,
}: {
featureData: any;
onSaveClick?: () => void;
surveyResultContent?: React.ReactNode;
}) => {
const [formData, setFormData] = useState<any>({});
const [repairData, setRepairData] = useState<operationDataType[]>([]);
const [cleaningData, setCleaningData] = useState<operationDataType[]>([]);
@@ -48,6 +56,8 @@ const MsSwagePpl = ({ featureData, onSaveClick }: { featureData: any, onSaveClic
const { BIZ_SE_CD, BIZ_TY_CD } = useStore();
const requestMngInstCd = String(featureData?.mng_inst_cd ?? featureData?.mngInstCd ?? "").trim();
const requestFcltMngNo = String(featureData?.fclt_mng_no ?? featureData?.fcltMngNo ?? "").trim();
// 조사관리 전용 탭은 기본·입력정보와 조사결과만 표시하고 일반 시설 유지관리 이력은 숨긴다.
const showOperationSections = !surveyResultContent;
// 마운트 및 업데이트 시 API 호출
@@ -58,7 +68,7 @@ const MsSwagePpl = ({ featureData, onSaveClick }: { featureData: any, onSaveClic
}, [featureData]);
useEffect(() => {
if (!requestMngInstCd || !requestFcltMngNo) {
if (!showOperationSections || !requestMngInstCd || !requestFcltMngNo) {
setInspectionData([]);
setCleaningData([]);
setRepairData([]);
@@ -121,7 +131,7 @@ const MsSwagePpl = ({ featureData, onSaveClick }: { featureData: any, onSaveClic
setCleaningData([]);
setRepairData([]);
});
}, [BIZ_SE_CD, BIZ_TY_CD, requestFcltMngNo, requestMngInstCd]);
}, [BIZ_SE_CD, BIZ_TY_CD, requestFcltMngNo, requestMngInstCd, showOperationSections]);
// 폼 데이터가 변경될 때 호출될 핸들러
const handleFormDataChange = (newFormData: any) => {
@@ -154,24 +164,29 @@ const MsSwagePpl = ({ featureData, onSaveClick }: { featureData: any, onSaveClic
onSaveClick={handleSaveClick}
onFormDataChange={handleFormDataChange} // 폼 데이터 변경 콜백 추가
/>
<InputSection
title="보수 및 갱신"
data={repairData}
sectionKey="repair"
onInputChange={(section, index, field, value) => handleInputChange(section, index, field, value, dataMap)}
/>
<InputSection
title="청소 및 준설"
data={cleaningData}
sectionKey="cleaning"
onInputChange={(section, index, field, value) => handleInputChange(section, index, field, value, dataMap)}
/>
<InputSection
title="점검 및 진단"
data={inspectionData}
sectionKey="inspection"
onInputChange={(section, index, field, value) => handleInputChange(section, index, field, value, dataMap)}
/>
{surveyResultContent}
{showOperationSections && (
<>
<InputSection
title="보수 및 갱신"
data={repairData}
sectionKey="repair"
onInputChange={(section, index, field, value) => handleInputChange(section, index, field, value, dataMap)}
/>
<InputSection
title="청소 및 준설"
data={cleaningData}
sectionKey="cleaning"
onInputChange={(section, index, field, value) => handleInputChange(section, index, field, value, dataMap)}
/>
<InputSection
title="점검 및 진단"
data={inspectionData}
sectionKey="inspection"
onInputChange={(section, index, field, value) => handleInputChange(section, index, field, value, dataMap)}
/>
</>
)}
</>
)
}
@@ -49,6 +49,7 @@ import { searchUpperPpls } from "./smh";
import { getElapsedYearsDisplayText, isInvalidInstallYmd } from "../agedPipe/agedPipeUtils";
import { openWindowPopup } from '@/features/windowPopup/lib/openWindowPopup';
import useStore from "@/store/useStore";
import ExmnSurveyResultSection from "../exmn/ExmnSurveyResultSection";
const linkedFacilityHighlightStyle = new Style({
image: new CircleStyle({
@@ -121,7 +122,15 @@ type MngInstOption = {
lwrInstNm: string;
};
const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, featureData: any }) => {
const FeatureClickEventPopup = ({
onClose,
featureData,
surveyMode = false,
}: {
onClose: () => void;
featureData: any;
surveyMode?: boolean;
}) => {
const { gisMap } = useGisContext() as unknown as { checkedLayerIds: React.MutableRefObject<number[]>; treeData: { lyrSn: number }[] | null; gisCore: any; gisMap: any; };
const [layerNm, setLayerNm] = useState<string>(""); // 레이어 이름 상태
const [layerSpecificNm, setLayerSpecificNm] = useState<string>(""); // 레이어 이름 상태
@@ -774,7 +783,18 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void,
<LoadingOverlay isLoading={isLoading} />
<div className="card-header bg-primary flex items-center justify-between relative p-4">
<div className="flex items-center space-x-4 flex-1">
<h3 className="text-2xl font-medium text-white text-label whitespace-nowrap">{layerNm}
{surveyMode && (
<h3 className="text-2xl font-medium text-white text-label whitespace-nowrap">
조사관리 <br />
관로번호 : {
featureData?.get?.("gisManagementNo")
?? featureData?.values_?.gisManagementNo
?? featureData?.gisManagementNo
?? layerSpecificNm
}
</h3>
)}
<h3 className={`${surveyMode ? "hidden" : ""} text-2xl font-medium text-white text-label whitespace-nowrap`}>{layerNm}
{tableData?.usg_cd && (
<>
({tableData.usg_cd})
@@ -872,6 +892,11 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void,
chmbrYdnts={chmbrYdnts}
gisObject={featureData?.values_ ?? featureData}
rawFeatureData={featureData}
surveyResultContent={
surveyMode
? <ExmnSurveyResultSection featureData={featureData} />
: undefined
}
/>
}
</div>
@@ -13,7 +13,7 @@
* - 상류관로 조회: GET /api/v1/fcltmhl/upperPpls/{fcltMngNo} (sewerage-service)
*/
import { VerticalTable } from '@/components/ui/verticalTable';
import { useEffect, useState } from 'react';
import { type ReactNode, useEffect, useState } from 'react';
import GisApp from "@common/business_components/ui/map/lib/gis.core";
import { getData } from '@/components/lib/api';
@@ -80,7 +80,15 @@ const inputColumn = [
{ id: "mltvDtdvNm", title: "배수분구", type: "input" },
{ id: "layCd", title: "매설위치", type: "select", options: ["도로", "하상"] },
];
const Smh = ({ featureData, onSaveClick }: { featureData: any, onSaveClick?: () => void }) => {
const Smh = ({
featureData,
onSaveClick,
surveyResultContent,
}: {
featureData: any;
onSaveClick?: () => void;
surveyResultContent?: ReactNode;
}) => {
const [formData, setFormData] = useState<any>({});
// featureData가 변경될 때 formData 초기화
@@ -104,6 +112,7 @@ const Smh = ({ featureData, onSaveClick }: { featureData: any, onSaveClick?: ()
};
return (
<>
<VerticalTable
headName='입력정보'
tableData={featureData ? [formData] : []}
@@ -120,6 +129,8 @@ const Smh = ({ featureData, onSaveClick }: { featureData: any, onSaveClick?: ()
onSaveClick={handleSaveClick}
onFormDataChange={handleFormDataChange} // 폼 데이터 변경 콜백 추가
/>
{surveyResultContent}
</>
)
}
+425 -10
View File
@@ -18,7 +18,16 @@
"use client";
import dynamic from "next/dynamic";
import { Fragment, useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from "react";
import {
Fragment,
useCallback,
useEffect,
useMemo,
useRef,
useState,
type ReactNode,
type UIEvent,
} from "react";
import { usePathname, useSearchParams } from "next/navigation";
import Collection from "ol/Collection.js";
@@ -29,6 +38,7 @@ import Draw from "ol/interaction/Draw.js";
import Snap from "ol/interaction/Snap.js";
import Translate from "ol/interaction/Translate.js";
import Fill from "ol/style/Fill.js";
import Icon from "ol/style/Icon.js";
import LineString from "ol/geom/LineString.js";
import Point from "ol/geom/Point.js";
import Polygon from "ol/geom/Polygon.js";
@@ -84,6 +94,19 @@ import { useRdiiResultMap } from "./components/rdiiResult/useRdiiResultMap";
import SinkholeDetailPanel from "./components/sinkhole/SinkholeDetailPanel";
import SinkholeLayerSettingPanel from "./components/sinkhole/SinkholeLayerSettingPanel";
import FldngHstryDetailPanel from "./components/fldngHstry/FldngHstryDetailPanel";
import ExmnLayerSettingPanel from "./components/exmn/ExmnLayerSettingPanel";
import { getExmnMapLayer } from "./components/exmn/exmnMapApi";
import {
EMPTY_EXMN_MAP_FILTERS,
EXMN_RESULT_MNHL_LAYER_ID,
EXMN_RESULT_PPL_LAYER_ID,
appendExmnResultControlNodes,
buildExmnMapEntryContext,
isExmnResultMnhlNode,
isExmnResultPplNode,
type ExmnMapFilters,
type ExmnMapJobType,
} from "./components/exmn/exmnMapTypes";
import {
buildSinkholeDefaultYearRange,
buildSinkholeFiltersFromYearRange,
@@ -147,6 +170,7 @@ const AGED_PIPE_ROW_SELECT_MESSAGE = "SN_AGED_PIPE_ROW_SELECT";
const AGED_PIPE_POPUP_MINIMIZE_MESSAGE = "SN_AGED_PIPE_POPUP_MINIMIZE";
const AGED_PIPE_FILTER_SYNC_MESSAGE = "SN_AGED_PIPE_FILTER_SYNC";
const SINKHOLE_DEFAULT_POINT_LIMIT = 2000;
const EXMN_PROC_SEARCH_EVENT = "SN_INFTWT_PROC_SEARCH";
// 지반침하 지도 포인트와 같은 파란 계열의 기존 레이어 트리 심볼 자산을 재사용한다.
const SINKHOLE_TREE_ICON_NAME = "SN_SINKHOLE_SPOT_BLUE.png";
const SOUTH_KOREA_VIEW_EXTENT: [number, number, number, number] = [
@@ -156,6 +180,40 @@ const SOUTH_KOREA_VIEW_EXTENT: [number, number, number, number] = [
2500000,
];
const EXMN_GRADE_COLORS: Record<number, string> = {
1: "#22c55e",
2: "#84cc16",
3: "#facc15",
4: "#f97316",
5: "#dc2626",
};
const EXMN_RESULT_MANHOLE_ICON_SRC =
"/images/map/layericon/SN_EXMN_MANHOLE_PURPLE.png?v=3";
const getExmnGradeColor = (feature: any) => {
const grade = Number(feature?.get?.("structuralGrade") ?? 0);
return EXMN_GRADE_COLORS[grade] ?? "#2563eb";
};
const createExmnPipeStyle = (feature: any) =>
new Style({
stroke: new Stroke({
color: getExmnGradeColor(feature),
width: 4,
}),
});
// 레이어 트리 범례와 지도 피처가 동일한 기존 맨홀 형태의 보라색 심볼을 사용한다.
const createExmnManholeStyle = () =>
new Style({
image: new Icon({
src: EXMN_RESULT_MANHOLE_ICON_SRC,
anchor: [0.5, 0.5],
anchorXUnits: "fraction",
anchorYUnits: "fraction",
}),
});
// 유하방향은 GeoServer WMS/WFS 레이어가 아니라 BE 보정 GeoJSON API로 그리는 가상 레이어이다.
const FLOW_DIRECTION_LAYER_TYPE = "tb_sn_swage_ppl_flow_direction";
const FLOW_DIRECTION_LAYER_NAME = "유하방향";
@@ -180,6 +238,7 @@ type RightPanelTabKind = "feature" | "sinkhole" | "gisEdit";
type RightPanelTabCategory =
| "sinkhole"
| "pipe"
| "exmnSurvey"
| "treatmentFacility"
| "treatmentZone"
| "defaultFeature"
@@ -190,6 +249,7 @@ type RightPanelTab = {
kind: RightPanelTabKind;
category: RightPanelTabCategory;
displayLabel: string;
surveyJobType?: ExmnMapJobType;
parentTabId?: string | null;
featureData: any;
sinkholeDetail?: SinkholeDetail | null;
@@ -223,6 +283,10 @@ const RIGHT_PANEL_TAB_STYLE_BY_CATEGORY: Record<
active: "border-[#2563eb] bg-[#2563eb] text-white",
inactive: "border-[#93c5fd] bg-[#eff6ff] text-[#1e40af] hover:bg-[#dbeafe]",
},
exmnSurvey: {
active: "border-[#0f766e] bg-[#0f766e] text-white",
inactive: "border-[#5eead4] bg-[#f0fdfa] text-[#115e59] hover:bg-[#ccfbf1]",
},
treatmentFacility: {
active: "border-[#15803d] bg-[#15803d] text-white",
inactive: "border-[#86efac] bg-[#f0fdf4] text-[#166534] hover:bg-[#dcfce7]",
@@ -241,6 +305,20 @@ const RIGHT_PANEL_TAB_STYLE_BY_CATEGORY: Record<
},
};
const RIGHT_PANEL_EXMN_TAB_STYLE_BY_JOB_TYPE: Record<
ExmnMapJobType,
RightPanelTabStyle
> = {
PPL: {
active: "border-[#eab308] bg-[#facc15] text-[#713f12]",
inactive: "border-[#fde68a] bg-[#fefce8] text-[#854d0e] hover:bg-[#fef9c3]",
},
MNHL: {
active: "border-[#8b5cf6] bg-[#8b5cf6] text-white",
inactive: "border-[#c4b5fd] bg-[#f5f3ff] text-[#5b21b6] hover:bg-[#ede9fe]",
},
};
// 공용 우측 탭은 유형과 활성 상태에 관계없이 먼저 열린 탭부터 제거한다.
const findRightPanelTabOverflowCandidate = (
tabs: RightPanelTab[],
@@ -268,7 +346,10 @@ const RightPanelBookmarkTabs = ({
<div className="pointer-events-auto absolute right-[350px] top-[92px] z-[70] flex w-[112px] flex-col items-end gap-2">
{tabs.map((tab) => {
const isActive = tab.id === activeTabId;
const style = RIGHT_PANEL_TAB_STYLE_BY_CATEGORY[tab.category];
const style =
tab.category === "exmnSurvey" && tab.surveyJobType
? RIGHT_PANEL_EXMN_TAB_STYLE_BY_JOB_TYPE[tab.surveyJobType]
: RIGHT_PANEL_TAB_STYLE_BY_CATEGORY[tab.category];
const parentTab = tab.parentTabId
? tabs.find((candidate) => candidate.id === tab.parentTabId)
: null;
@@ -937,6 +1018,8 @@ const getRightPanelFeatureProperty = (data: any, keys: string[]) => {
};
const getRightPanelTabCategory = (data: any): RightPanelTabCategory => {
const surveyOverlayType = getRightPanelFeatureProperty(data, ["surveyOverlayType"]);
if (surveyOverlayType === "EXMN_RESULT") return "exmnSurvey";
const layerTypeName = getSelectedFeatureLayerTypeName(data);
if (layerTypeName === "tb_ms_swage_ppl") return "pipe";
if (layerTypeName === "tb_il_swage_prcs_fclt") return "treatmentFacility";
@@ -945,6 +1028,16 @@ const getRightPanelTabCategory = (data: any): RightPanelTabCategory => {
};
const getRightPanelFeatureDisplayLabel = (data: any, category: RightPanelTabCategory) => {
if (category === "exmnSurvey") {
const managementNo =
getRightPanelFeatureProperty(data, ["gisManagementNo", "fclt_mng_no", "fcltMngNo"]) ||
"-";
const jobType = getRightPanelFeatureProperty(data, ["jobType"]);
const surveyLabel =
jobType === "PPL" ? "관로조사" : jobType === "MNHL" ? "맨홀조사" : "조사관리";
return `${surveyLabel}(${managementNo})`;
}
if (category === "pipe") {
const managementNo =
getRightPanelFeatureProperty(data, ["fclt_mng_no", "fcltMngNo", "pipeId", "fid"]) ||
@@ -2521,6 +2614,10 @@ const appendSinkholeControlNode = (data: any[]) => {
const Map = () => {
const searchParams = useSearchParams();
const pathname = usePathname();
const exmnMapEntryContext = useMemo(
() => buildExmnMapEntryContext(searchParams),
[searchParams],
);
const initialAnalysisPopupKey = useMemo(() => {
const popupKey = searchParams.get("analysisPopupKey");
if (!popupKey || !isWindowPopupKey(popupKey)) return null;
@@ -2549,6 +2646,16 @@ const Map = () => {
const [isAgedPipeChecked, setIsAgedPipeChecked] = useState(false);
const [isSinkholeChecked, setIsSinkholeChecked] = useState(false);
const [isFldngHstryChecked, setIsFldngHstryChecked] = useState(false);
const [isExmnPplChecked, setIsExmnPplChecked] = useState(false);
const [isExmnMnhlChecked, setIsExmnMnhlChecked] = useState(false);
const [exmnPplFilters, setExmnPplFilters] = useState<ExmnMapFilters>(() => ({
...EMPTY_EXMN_MAP_FILTERS,
bizCycl: exmnMapEntryContext.bizCycl,
}));
const [exmnMnhlFilters, setExmnMnhlFilters] = useState<ExmnMapFilters>(() => ({
...EMPTY_EXMN_MAP_FILTERS,
bizCycl: exmnMapEntryContext.bizCycl,
}));
const [swagePrcsFcltLayerMode, setSwagePrcsFcltLayerMode] = useState<SwagePrcsFcltLayerMode>("all");
const [activeLayerSettingOrder, setActiveLayerSettingOrder] = useState<string[]>([]);
const [draftAgedPipeFilters, setDraftAgedPipeFilters] =
@@ -2578,6 +2685,30 @@ const Map = () => {
const [agedPipeDownloadProgressText, setAgedPipeDownloadProgressText] = useState("");
const [isGisEditSaving, setIsGisEditSaving] = useState(false);
const { ctpv, sgg } = useStore();
// 조사시설 관로번호는 전국에서 중복될 수 있어 시군구코드 앞 5자리와 함께 GIS 원천을 조회한다.
const exmnMapRegionCodes = useMemo(() => {
const ctpvOption = ctpv.find(
(option) => String(option.text ?? "").trim() === exmnMapEntryContext.ctpvNm,
);
const ctpvCd = String(ctpvOption?.val ?? "0").trim() || "0";
const sggOption = sgg.find((option) => {
const code = String(option.val ?? "").trim();
return (
String(option.text ?? "").trim() === exmnMapEntryContext.sggNm &&
(ctpvCd === "0" || code.startsWith(ctpvCd.slice(0, 2)))
);
});
return {
ctpvCd,
sggCd: String(sggOption?.val ?? "0").trim() || "0",
};
}, [
ctpv,
exmnMapEntryContext.ctpvNm,
exmnMapEntryContext.sggNm,
sgg,
]);
// GIS 편집은 map/page.tsx 내부 기존 지도 상태를 재사용하되, 세부 상태와 payload 조립은 별도 hook으로 분리한다.
const gisEdit = useGisEdit(treeData);
// 침입수 분석결과 popup과 지도 highlight 흐름은 별도 hook으로 묶어 기존 지도 로직과 충돌을 줄인다.
@@ -2620,6 +2751,15 @@ const Map = () => {
const sinkholeSelectedSourceRef = useRef<VectorSource | null>(null);
const sinkholeFocusedPipeLayerRef = useRef<VectorLayer<any> | null>(null);
const sinkholeFocusedPipeSourceRef = useRef<VectorSource | null>(null);
const exmnPplLayerRef = useRef<VectorLayer<any> | null>(null);
const exmnPplSourceRef = useRef<VectorSource | null>(null);
const exmnMnhlLayerRef = useRef<VectorLayer<any> | null>(null);
const exmnMnhlSourceRef = useRef<VectorSource | null>(null);
const exmnPplRequestSeqRef = useRef(0);
const exmnMnhlRequestSeqRef = useRef(0);
const exmnInitialRegionAppliedRef = useRef(false);
// 조사관리에서 지도보기로 최초 진입했을 때만 조회된 대표 시설 한 건으로 지도를 맞춘다.
const exmnInitialFeatureFitAppliedRef = useRef(false);
// 유하방향 레이어 체크 여부를 React 렌더링 흐름에 반영하기 위한 state이다.
const [isFlowDirectionChecked, setIsFlowDirectionChecked] = useState(false);
// 체크된 유하방향 트리 노드의 레이어 설정을 보관해 API 조회와 vector layer 스타일에 사용한다.
@@ -2925,6 +3065,40 @@ const Map = () => {
fetchData();
}, []);
useEffect(() => {
if (
!mapReady ||
exmnInitialRegionAppliedRef.current ||
(!exmnMapEntryContext.ctpvNm && !exmnMapEntryContext.sggNm)
) {
return;
}
const { ctpvCd, sggCd } = exmnMapRegionCodes;
// 시군구가 전달된 진입에서는 시도만 먼저 적용해 버리지 않고 두 코드가 모두 준비될 때까지 기다린다.
if (
(exmnMapEntryContext.ctpvNm && ctpvCd === "0") ||
(exmnMapEntryContext.sggNm && sggCd === "0")
) {
return;
}
exmnInitialRegionAppliedRef.current = true;
window.dispatchEvent(
new CustomEvent(EXMN_PROC_SEARCH_EVENT, {
detail: {
ctpvCd,
sggCd,
},
}),
);
}, [
exmnMapEntryContext.ctpvNm,
exmnMapEntryContext.sggNm,
exmnMapRegionCodes,
mapReady,
]);
useEffect(() => {
setAppliedSinkholeFilters((currentFilters) => {
if (isSinkholePopupFilterActive) {
@@ -3076,10 +3250,13 @@ const Map = () => {
try {
const data = await getRawJson("/sewerage-service/api/v1/map/lyrStngs/SN_NETWORK");
setTreeData(
appendAgedPipeControlNode(
appendSinkholeControlNode(
normalizeTreeRowSpacing(normalizeFlowDirectionLayerInfos(data)),
appendExmnResultControlNodes(
appendAgedPipeControlNode(
appendSinkholeControlNode(
normalizeTreeRowSpacing(normalizeFlowDirectionLayerInfos(data)),
),
),
exmnMapEntryContext.jobType,
),
);
setLayerLoadError(null);
@@ -4096,6 +4273,138 @@ const Map = () => {
openAgedPipePopupWindow();
}, [openAgedPipePopupWindow]);
const removeExmnResultLayer = useCallback((jobType: ExmnMapJobType) => {
const layerId = jobType === "PPL"
? EXMN_RESULT_PPL_LAYER_ID
: EXMN_RESULT_MNHL_LAYER_ID;
const layerRef = jobType === "PPL" ? exmnPplLayerRef : exmnMnhlLayerRef;
const sourceRef = jobType === "PPL" ? exmnPplSourceRef : exmnMnhlSourceRef;
const requestSeqRef = jobType === "PPL"
? exmnPplRequestSeqRef
: exmnMnhlRequestSeqRef;
requestSeqRef.current += 1;
if (layerRef.current) {
(GisApp.Module.select as any)?.removeLayer?.(layerRef.current);
}
(GisApp.Module.core as any)?.deleteLayer?.(layerId);
layerRef.current = null;
sourceRef.current = null;
}, []);
const ensureExmnResultLayer = useCallback((jobType: ExmnMapJobType) => {
const map = gisMaps.current;
if (!map) return null;
const layerRef = jobType === "PPL" ? exmnPplLayerRef : exmnMnhlLayerRef;
const sourceRef = jobType === "PPL" ? exmnPplSourceRef : exmnMnhlSourceRef;
if (layerRef.current && sourceRef.current) return sourceRef.current;
const layerId = jobType === "PPL"
? EXMN_RESULT_PPL_LAYER_ID
: EXMN_RESULT_MNHL_LAYER_ID;
const source = new VectorSource();
const layer = new VectorLayer({
source,
zIndex: jobType === "PPL" ? 9988 : 9989,
style: jobType === "PPL" ? createExmnPipeStyle : createExmnManholeStyle,
updateWhileAnimating: false,
updateWhileInteracting: false,
});
layer.set("id", layerId);
layer.set("lyrNm", jobType === "PPL" ? "관로조사" : "맨홀조사");
layer.set("lyrTyNm", jobType === "PPL" ? "tb_ms_swage_ppl" : "tb_ms_swage_mhl");
layer.set("clickPsblYn", "Y");
layer.set("chcYn", "Y");
(GisApp.Module.core as any)?.deleteLayer?.(layerId);
map.addLayer(layer);
(GisApp.Module.select as any)?.addLayer?.(layer);
layerRef.current = layer;
sourceRef.current = source;
return source;
}, []);
const loadExmnResultLayer = useCallback(
async (jobType: ExmnMapJobType, filters: ExmnMapFilters) => {
const isChecked = jobType === "PPL" ? isExmnPplChecked : isExmnMnhlChecked;
if (!mapReady || !gisMaps.current || !isChecked) return;
const source = ensureExmnResultLayer(jobType);
if (!source) return;
const sggCodePrefix = exmnMapRegionCodes.sggCd
.replace(/[^0-9]/g, "")
.slice(0, 5);
// 공통 행정구역 코드가 준비되기 전에는 전국 중복 관로를 조회하지 않고 다음 상태 갱신을 기다린다.
if (sggCodePrefix.length !== 5) {
source.clear();
return;
}
const requestSeqRef = jobType === "PPL"
? exmnPplRequestSeqRef
: exmnMnhlRequestSeqRef;
const requestSeq = requestSeqRef.current + 1;
requestSeqRef.current = requestSeq;
try {
const response = await getExmnMapLayer(jobType, filters, {
sggCd: sggCodePrefix,
ctpvNm: exmnMapEntryContext.ctpvNm,
sggNm: exmnMapEntryContext.sggNm,
});
if (requestSeqRef.current !== requestSeq) return;
const featureCollection = response?.data?.type === "FeatureCollection"
? response.data
: response;
const features = new GeoJSON().readFeatures(featureCollection, {
dataProjection: "EPSG:5179",
featureProjection: GisApp.TO_PROJ,
});
source.clear();
source.addFeatures(features);
// 표본 데이터가 적은 현재 단계에서는 최초 조사유형의 첫 시설을 기준으로 한 번만 확대한다.
if (
!exmnInitialFeatureFitAppliedRef.current &&
exmnMapEntryContext.jobType === jobType &&
features.length > 0
) {
const geometry = features[0]?.getGeometry?.();
const extent = geometry?.getExtent?.();
if (
extent &&
extent.length === 4 &&
extent.every((coordinate: number) => Number.isFinite(coordinate))
) {
gisMaps.current?.getView?.().fit?.(extent, {
duration: 300,
padding: [80, 420, 80, 80],
maxZoom: 18,
constrainResolution: true,
nearest: true,
});
exmnInitialFeatureFitAppliedRef.current = true;
}
}
} catch (error) {
if (requestSeqRef.current !== requestSeq) return;
source.clear();
console.error(`${jobType === "PPL" ? "관로조사" : "맨홀조사"} 레이어 조회 실패:`, error);
}
},
[
ensureExmnResultLayer,
exmnMapEntryContext.ctpvNm,
exmnMapEntryContext.jobType,
exmnMapEntryContext.sggNm,
exmnMapRegionCodes.ctpvCd,
exmnMapRegionCodes.sggCd,
isExmnMnhlChecked,
isExmnPplChecked,
mapReady,
],
);
const removeSinkholeLayer = useCallback(() => {
const core = GisApp.Module.core as any;
core?.deleteLayer?.(SINKHOLE_LAYER_ID);
@@ -4756,17 +5065,25 @@ const Map = () => {
}
const category = getRightPanelTabCategory(data);
const surveyJobTypeValue = getRightPanelFeatureProperty(data, ["jobType"]);
const surveyJobType =
surveyJobTypeValue === "PPL" || surveyJobTypeValue === "MNHL"
? surveyJobTypeValue
: undefined;
const featureId = getRightPanelFeatureIdentifier(data) || `${layerTypeName || "feature"}:${now}`;
// Direct map selections accumulate per pipe; only a pipe with a sinkhole parent replaces the linked slot.
const pipeParentTabId = category === "pipe" ? pipeParentTabIdRef.current : null;
return {
id:
category === "pipe" && pipeParentTabId
category === "exmnSurvey"
? `exmnSurvey:${getRightPanelFeatureProperty(data, ["exmnFacilityId"])}:${getRightPanelFeatureProperty(data, ["manholePosition"])}`
: category === "pipe" && pipeParentTabId
? RIGHT_PANEL_SINKHOLE_PIPE_TAB_ID
: `feature:${layerTypeName || "unknown"}:${featureId}`,
kind: "feature",
category,
displayLabel: getRightPanelFeatureDisplayLabel(data, category),
surveyJobType,
parentTabId: pipeParentTabId,
featureData: data,
lastActiveAt: now,
@@ -5182,11 +5499,17 @@ const Map = () => {
}
const sinkholeChecked = checkedNodesData.some((node) => isSinkholeLayerNode(node));
setIsSinkholeChecked(sinkholeChecked);
const exmnPplChecked = checkedNodesData.some((node) => isExmnResultPplNode(node));
const exmnMnhlChecked = checkedNodesData.some((node) => isExmnResultMnhlNode(node));
setIsExmnPplChecked(exmnPplChecked);
setIsExmnMnhlChecked(exmnMnhlChecked);
setActiveLayerSettingOrder((currentOrder) => {
const activeKeys = [
waterDepthChecked ? "waterDepthLegend" : null,
sinkholeChecked ? "sinkhole" : null,
agedPipeChecked ? "agedPipe" : null,
exmnPplChecked ? "exmnPpl" : null,
exmnMnhlChecked ? "exmnMnhl" : null,
].filter((key): key is string => Boolean(key));
return [
@@ -5201,7 +5524,13 @@ const Map = () => {
removeSinkholeLayer();
closeSinkholeDetail();
}
}, [clearFldngHstrySelection, closeSinkholeDetail, handleWaterDepthVisibility, removeFlowDirectionLayer, removeSinkholeLayer, retainFlowDirectionUsageCodes]);
if (!exmnPplChecked) {
removeExmnResultLayer("PPL");
}
if (!exmnMnhlChecked) {
removeExmnResultLayer("MNHL");
}
}, [clearFldngHstrySelection, closeSinkholeDetail, handleWaterDepthVisibility, removeExmnResultLayer, removeFlowDirectionLayer, removeSinkholeLayer, retainFlowDirectionUsageCodes]);
const waterDepthLegendItems = useMemo(
() => extractWaterDepthLegendItems(checkedNodesDataRef.current ?? []),
@@ -5250,6 +5579,36 @@ const Map = () => {
return index >= 0 ? index : fallback;
};
if (isExmnPplChecked) {
nextItems.push({
key: "exmnPpl",
label: "관로조사",
order: resolveSettingOrder("exmnPpl", 9995),
content: (
<ExmnLayerSettingPanel
jobType="PPL"
filters={exmnPplFilters}
onFiltersChange={setExmnPplFilters}
/>
),
});
}
if (isExmnMnhlChecked) {
nextItems.push({
key: "exmnMnhl",
label: "맨홀조사",
order: resolveSettingOrder("exmnMnhl", 9996),
content: (
<ExmnLayerSettingPanel
jobType="MNHL"
filters={exmnMnhlFilters}
onFiltersChange={setExmnMnhlFilters}
/>
),
});
}
if (isSinkholeChecked) {
nextItems.push({
key: "sinkhole",
@@ -5326,8 +5685,12 @@ const Map = () => {
applySinkholeRadius,
applySinkholeYearRange,
draftAgedPipeFilters,
exmnMnhlFilters,
exmnPplFilters,
handleApplyAgedPipeFilters,
isAgedPipeChecked,
isExmnMnhlChecked,
isExmnPplChecked,
isSinkholeChecked,
isWaterDepthLayerActive,
lastSinkholeSyncSummary,
@@ -5337,12 +5700,27 @@ const Map = () => {
waterDepthLegendItems,
]);
// 설정값 변경으로 설정 컴포넌트가 다시 만들어져도 사용자가 보던 내부 스크롤 위치를 유지한다.
const activeLayerSettingScrollTopRef = useRef(0);
const handleActiveLayerSettingScroll = useCallback(
(event: UIEvent<HTMLDivElement>) => {
activeLayerSettingScrollTopRef.current = event.currentTarget.scrollTop;
},
[],
);
const restoreActiveLayerSettingScroll = useCallback((element: HTMLDivElement | null) => {
if (!element) return;
const maxScrollTop = Math.max(0, element.scrollHeight - element.clientHeight);
element.scrollTop = Math.min(activeLayerSettingScrollTopRef.current, maxScrollTop);
}, []);
// 선택된 설정이 있을 때만 하단 전용 섹션을 노출하고, 세로 공간이 부족하면 내부 스크롤로 처리한다.
const ActiveLayerSettingView = useCallback(() => {
if (activeLayerSettingItems.length === 0) return null;
return (
<div className="mt-3 overflow-hidden rounded-sm border border-border bg-background shadow-[0_4px_14px_rgba(15,23,42,0.08)]">
<div className="mt-3 flex h-[34vh] min-h-[24rem] max-h-[32rem] flex-col overflow-hidden rounded-sm border border-border bg-background shadow-[0_4px_14px_rgba(15,23,42,0.08)]">
<div className="border-b border-border bg-secondary px-3 py-2">
<div className="flex items-center justify-between gap-2">
<span className="text-[1.2rem] font-semibold text-label">선택 레이어 설정</span>
@@ -5359,7 +5737,11 @@ const Map = () => {
))}
</div>
</div>
<div className="max-h-[28vh] overflow-y-auto px-1 py-2 [scrollbar-width:thin] [&::-webkit-scrollbar]:w-[4px]">
<div
ref={restoreActiveLayerSettingScroll}
onScroll={handleActiveLayerSettingScroll}
className="min-h-0 flex-1 overflow-y-scroll px-1 py-2 [scrollbar-gutter:stable] [scrollbar-width:thin] [&::-webkit-scrollbar]:w-[4px]"
>
<div className="flex flex-col gap-2">
{activeLayerSettingItems.map((item) => (
<Fragment key={item.key}>{item.content}</Fragment>
@@ -5368,7 +5750,11 @@ const Map = () => {
</div>
</div>
);
}, [activeLayerSettingItems]);
}, [
activeLayerSettingItems,
handleActiveLayerSettingScroll,
restoreActiveLayerSettingScroll,
]);
useEffect(() => {
if (!mapReady || !gisMaps.current) return;
@@ -6115,6 +6501,7 @@ const Map = () => {
<FeatureClickEventPopup
{...props}
featureData={panelFeatureData}
surveyMode={activeRightPanelTab?.category === "exmnSurvey"}
onClose={() => {
setGisEditDetailChangeId(null);
closeActiveTab();
@@ -7113,6 +7500,34 @@ const Map = () => {
}
}, [gisEdit.activeTool, gisEdit.isEditMode, removeGisEditDrawInteraction]);
useEffect(() => {
if (!mapReady || !isExmnPplChecked) {
removeExmnResultLayer("PPL");
return;
}
void loadExmnResultLayer("PPL", exmnPplFilters);
}, [
exmnPplFilters,
isExmnPplChecked,
loadExmnResultLayer,
mapReady,
removeExmnResultLayer,
]);
useEffect(() => {
if (!mapReady || !isExmnMnhlChecked) {
removeExmnResultLayer("MNHL");
return;
}
void loadExmnResultLayer("MNHL", exmnMnhlFilters);
}, [
exmnMnhlFilters,
isExmnMnhlChecked,
loadExmnResultLayer,
mapReady,
removeExmnResultLayer,
]);
useEffect(() => {
if (!mapReady || !isSinkholeChecked) {
removeSinkholeLayer();