준설관리 개발완료

This commit is contained in:
2026-08-07 15:28:33 +09:00
parent 29f2a9169e
commit 3f4e3581dd
25 changed files with 2588 additions and 999 deletions
@@ -29,6 +29,7 @@ const clamp = (value: number, min: number, max: number) => {
const buildPopupFeatures = ({
width,
height,
maximize = false,
placement = "center",
alignTop = false,
offsetLeft = 0,
@@ -36,7 +37,9 @@ const buildPopupFeatures = ({
}: Pick<
WindowPopupDefinition,
"width" | "height" | "placement" | "alignTop" | "offsetLeft" | "offsetTop"
>) => {
> & {
maximize?: boolean;
}) => {
const screenLeft = window.screenX ?? window.screenLeft ?? 0;
const screenTop = window.screenY ?? window.screenTop ?? 0;
const outerWidth = window.outerWidth || window.screen.width;
@@ -49,27 +52,34 @@ const buildPopupFeatures = ({
const availableTop = screen.availTop ?? 0;
const availableWidth = window.screen.availWidth || outerWidth;
const availableHeight = window.screen.availHeight || outerHeight;
const safeWidth = Math.min(width, Math.max(360, availableWidth - 48));
const safeHeight = Math.min(height, Math.max(420, availableHeight - 72));
const safeWidth = maximize
? availableWidth
: Math.min(width, Math.max(360, availableWidth - 48));
const safeHeight = maximize
? availableHeight
: Math.min(height, Math.max(420, availableHeight - 72));
const minLeft = availableLeft;
const minTop = availableTop + 24;
const maxLeft = availableLeft + availableWidth - safeWidth - 16;
const maxTop = availableTop + availableHeight - safeHeight - 24;
const left =
placement === "browser-left"
const left = maximize
? availableLeft
: placement === "browser-left"
? clamp(screenLeft + offsetLeft, minLeft, maxLeft)
: clamp(
screenLeft + Math.round((outerWidth - safeWidth) / 2) + offsetLeft,
availableLeft + 16,
maxLeft,
);
const top = clamp(
alignTop
? screenTop + 24 + offsetTop
: screenTop + Math.round((outerHeight - safeHeight) / 2) + offsetTop,
minTop,
maxTop,
);
const top = maximize
? availableTop
: clamp(
alignTop
? screenTop + 24 + offsetTop
: screenTop + Math.round((outerHeight - safeHeight) / 2) + offsetTop,
minTop,
maxTop,
);
return [
`width=${safeWidth}`,
@@ -99,6 +109,7 @@ export const openWindowPopup = (
...definition,
width: options?.width ?? definition.width,
height: options?.height ?? definition.height,
maximize: options?.maximize,
});
const popupWindow = window.open(
popupUrl,
@@ -106,6 +117,20 @@ export const openWindowPopup = (
popupFeatures,
);
if (popupWindow && options?.maximize) {
const screen = window.screen as Screen & {
availLeft?: number;
availTop?: number;
};
try {
// 브라우저가 window.open의 최대 크기를 제한하더라도 가용 화면 전체로 한 번 더 맞춘다.
popupWindow.moveTo(screen.availLeft ?? 0, screen.availTop ?? 0);
popupWindow.resizeTo(screen.availWidth, screen.availHeight);
} catch {
// 브라우저 정책이 이동·크기 변경을 막으면 window.open feature의 최대 크기를 유지한다.
}
}
popupWindow?.focus();
return popupWindow;
@@ -27,6 +27,20 @@ export const windowPopupDefinitions = {
width: 1280,
height: 900,
},
dredgingDetail: {
key: "dredgingDetail",
title: "준설결과 상세",
width: 1280,
height: 900,
requiredParams: ["dredgingJobSn", "pipeFid", "longitude", "latitude"],
},
dredgingEdit: {
key: "dredgingEdit",
title: "준설결과 수정",
width: 1280,
height: 900,
requiredParams: ["dredgingJobSn", "pipeFid", "longitude", "latitude"],
},
exmnPipeReport: {
key: "exmnPipeReport",
title: "관로 조사보고서",
@@ -30,16 +30,19 @@ export type OpenWindowPopupParams = Record<
string | number | boolean | null | undefined
>;
/** 팝업별 기본 정의를 유지하면서 호출 화면에서 필요한 크기만 재정의한다. */
/** 팝업별 기본 정의를 유지하면서 호출 화면에서 필요한 크기와 최대화 여부를 재정의한다. */
export type OpenWindowPopupOptions = Partial<
Pick<WindowPopupDefinition, "width" | "height">
>;
> & {
maximize?: boolean;
};
export const WINDOW_POPUP_MESSAGE_TYPE = {
EXMN_BUSINESS_CREATED: "sn:popup:exmnBusinessCreated",
EXMN_BUSINESS_UPDATED: "sn:popup:exmnBusinessUpdated",
EXMN_RESULT_COMMITTED: "sn:popup:exmnResultCommitted",
DREDGING_REGISTERED: "sn:popup:dredgingRegistered",
DREDGING_UPDATED: "sn:popup:dredgingUpdated",
OLD_PP_UPLOAD_COMPLETED: "sn:popup:oldPpUploadCompleted",
FLOOD_PRE_UPLOAD_COMPLETED: "sn:popup:floodPreUploadCompleted",
MAP_SEARCH_SELECT_FEATURE: "sn:popup:mapSearchSelectFeature",
@@ -50,8 +53,10 @@ export const WINDOW_POPUP_MESSAGE_TYPE = {
GIS_EDIT_SESSION_SYNC: "sn:popup:gisEditSessionSync",
GIS_EDIT_SESSION_SHOW_INLINE: "sn:popup:gisEditSessionShowInline",
GIS_EDIT_SESSION_FOCUS_CHANGE: "sn:popup:gisEditSessionFocusChange",
GIS_EDIT_SESSION_REMOVE_FOCUSED_CHANGE: "sn:popup:gisEditSessionRemoveFocusedChange",
GIS_EDIT_SESSION_REMOVE_LAST_CHANGE: "sn:popup:gisEditSessionRemoveLastChange",
GIS_EDIT_SESSION_REMOVE_FOCUSED_CHANGE:
"sn:popup:gisEditSessionRemoveFocusedChange",
GIS_EDIT_SESSION_REMOVE_LAST_CHANGE:
"sn:popup:gisEditSessionRemoveLastChange",
GIS_EDIT_SESSION_CLEAR_CHANGES: "sn:popup:gisEditSessionClearChanges",
GIS_UPLOAD_COMPLETED: "sn:popup:gisUploadCompleted",
WATER_RISK_READY: "sn:popup:waterRiskReady",
+20 -3
View File
@@ -1,8 +1,13 @@
import { windowPopupDefinitions, type WindowPopupKey } from "./model/popupDefinitions";
import {
windowPopupDefinitions,
type WindowPopupKey,
} from "./model/popupDefinitions";
import type { WindowPopupRegistryItem } from "./model/types";
import AgedPipePopupContent from "./ui/AgedPipePopupContent";
import AgedPipeStatusByCtpvPopupContent from "./ui/AgedPipeStatusByCtpvPopupContent";
import DredgingRegisterPopupContent from "./ui/DredgingRegisterPopupContent";
import DredgingDetailPopupContent from "./ui/DredgingDetailPopupContent";
import DredgingEditPopupContent from "./ui/DredgingEditPopupContent";
import ExmnBusinessRegisterPopupContent from "./ui/ExmnBusinessRegisterPopupContent";
import ExmnPipeReportPopupContent from "./ui/ExmnPipeReportPopupContent";
import ExmnResultRegisterPopupContent from "./ui/ExmnResultRegisterPopupContent";
@@ -31,14 +36,18 @@ import PipeAnalysisPopupContent from "./ui/PipeAnalysisPopupContent";
import PipeAnalysisDetailPopupContent from "./ui/PipeAnalysisDetailPopupContent";
import WaterRiskPopupContent from "./ui/WaterRiskPopupContent";
const FloodPredictionPlaceholderPopupContent = (_props: WindowPopupContentProps) => (
const FloodPredictionPlaceholderPopupContent = (
_props: WindowPopupContentProps,
) => (
<FeaturePlaceholderPopupContent
title={windowPopupDefinitions.floodPredictionMapPopup.title}
/>
);
const GisEditPopupContent = (_props: WindowPopupContentProps) => (
<FeaturePlaceholderPopupContent title={windowPopupDefinitions.gisEditPopup.title} />
<FeaturePlaceholderPopupContent
title={windowPopupDefinitions.gisEditPopup.title}
/>
);
export const windowPopupRegistry = {
@@ -58,6 +67,14 @@ export const windowPopupRegistry = {
...windowPopupDefinitions.dredgingRegister,
component: DredgingRegisterPopupContent,
},
dredgingDetail: {
...windowPopupDefinitions.dredgingDetail,
component: DredgingDetailPopupContent,
},
dredgingEdit: {
...windowPopupDefinitions.dredgingEdit,
component: DredgingEditPopupContent,
},
exmnPipeReport: {
...windowPopupDefinitions.exmnPipeReport,
component: ExmnPipeReportPopupContent,
@@ -0,0 +1,58 @@
"use client";
import DredgingDetailPopupPage from "@/app/(with-base-layout)/oper/dredging/components/DredgingDetailPopupPage";
import type { DredgingRecord } from "@/app/(with-base-layout)/oper/dredging/lib/types";
import type { WindowPopupContentProps } from "../model/types";
const getParam = (value: string | string[] | undefined) =>
Array.isArray(value) ? (value[0] ?? "") : (value ?? "");
const getNumber = (value: string | string[] | undefined) => {
const parsed = Number(getParam(value));
return Number.isFinite(parsed) ? parsed : 0;
};
const getNullableNumber = (value: string | string[] | undefined) => {
const raw = getParam(value);
if (!raw) return null;
const parsed = Number(raw);
return Number.isFinite(parsed) ? parsed : null;
};
/** 목록 행의 직렬화된 값을 준설 상세 화면 모델로 복원한다. */
export const buildDredgingPopupRecord = (
searchParams: WindowPopupContentProps["searchParams"],
): DredgingRecord => ({
id: getParam(searchParams.id),
dredgingJobSn: getParam(searchParams.dredgingJobSn),
pipeFid: getParam(searchParams.pipeFid),
mngInstCd: getParam(searchParams.mngInstCd),
ctpv: getParam(searchParams.ctpv),
sgg: getParam(searchParams.sgg),
treatmentZone: getParam(searchParams.treatmentZone),
fcltMngNo: getParam(searchParams.fcltMngNo),
pipeDiameterMm: getNumber(searchParams.pipeDiameterMm),
pipeLengthM: getNumber(searchParams.pipeLengthM),
pipeMaterial: getParam(searchParams.pipeMaterial),
installationYear: getNullableNumber(searchParams.installationYear),
dredgingDate: getParam(searchParams.dredgingDate),
photoCount: getNumber(searchParams.photoCount),
registeredDate: getParam(searchParams.registeredDate),
longitude: getNumber(searchParams.longitude),
latitude: getNumber(searchParams.latitude),
snappedLongitude: getNumber(searchParams.snappedLongitude),
snappedLatitude: getNumber(searchParams.snappedLatitude),
registrationSource:
getParam(searchParams.registrationSource) === "MANUAL" ? "MANUAL" : "EXIF",
matchDistanceMeters: getNumber(searchParams.matchDistanceMeters),
isMock: getParam(searchParams.isMock) === "true",
});
export default function DredgingDetailPopupContent({
searchParams,
}: WindowPopupContentProps) {
return (
<DredgingDetailPopupPage record={buildDredgingPopupRecord(searchParams)} />
);
}
@@ -0,0 +1,27 @@
"use client";
import DredgingDetailPopupPage from "@/app/(with-base-layout)/oper/dredging/components/DredgingDetailPopupPage";
import { postPopupMessage } from "../lib/popupMessage";
import { WINDOW_POPUP_MESSAGE_TYPE } from "../model/types";
import type { WindowPopupContentProps } from "../model/types";
import { buildDredgingPopupRecord } from "./DredgingDetailPopupContent";
/** 상세 화면과 같은 구조에서 선택 관로의 사진·위치·준설일자를 수정한다. */
export default function DredgingEditPopupContent({
searchParams,
}: WindowPopupContentProps) {
return (
<DredgingDetailPopupPage
mode="edit"
record={buildDredgingPopupRecord(searchParams)}
onUpdated={() => {
postPopupMessage(WINDOW_POPUP_MESSAGE_TYPE.DREDGING_UPDATED, {
dredgingJobSn: Array.isArray(searchParams.dredgingJobSn)
? (searchParams.dredgingJobSn[0] ?? "")
: (searchParams.dredgingJobSn ?? ""),
});
}}
/>
);
}
@@ -1,6 +1,6 @@
"use client";
import DredgingRegisterPopupPage from "@/app/(with-base-layout)/oper/dredging/_components/DredgingRegisterPopupPage";
import DredgingRegisterPopupPage from "@/app/(with-base-layout)/oper/dredging/components/DredgingRegisterPopupPage";
import { useEffect, useState } from "react";
/** 준설결과 등록 화면을 공통 WindowPopup 레이아웃에 연결한다. */