From b5c174429548a53e5c86a13bdbfc61516e5ee345 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Tue, 9 Dec 2025 03:04:05 +0000 Subject: (최겸) 구매 구매자서명 내 삼성중공업 정보 입력 추가 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../request-investigation-dialog.tsx | 48 +++++++++++++++++++++- .../pq-review-table-new/vendors-table-columns.tsx | 1 + .../vendors-table-toolbar-actions.tsx | 3 ++ 3 files changed, 51 insertions(+), 1 deletion(-) (limited to 'lib/pq/pq-review-table-new') diff --git a/lib/pq/pq-review-table-new/request-investigation-dialog.tsx b/lib/pq/pq-review-table-new/request-investigation-dialog.tsx index f5a7ff91..febc308c 100644 --- a/lib/pq/pq-review-table-new/request-investigation-dialog.tsx +++ b/lib/pq/pq-review-table-new/request-investigation-dialog.tsx @@ -83,6 +83,7 @@ interface RequestInvestigationDialogProps { investigationMethod?: string, investigationNotes?: string } + vendorCountry?: string | null } export function RequestInvestigationDialog({ @@ -91,7 +92,9 @@ export function RequestInvestigationDialog({ onSubmit, selectedCount, initialData, + vendorCountry, }: RequestInvestigationDialogProps) { + const isDomesticVendor = vendorCountry === "KR" || vendorCountry === "한국" const [isPending, setIsPending] = React.useState(false) const [qmManagers, setQMManagers] = React.useState([]) const [isLoadingManagers, setIsLoadingManagers] = React.useState(false) @@ -121,6 +124,36 @@ export function RequestInvestigationDialog({ } }, [isOpen, initialData, form]); + // 도로명 주소 검색 결과 수신 및 주소 포맷팅 + React.useEffect(() => { + if (!isOpen || !isDomesticVendor) return + + const handleMessage = (event: MessageEvent) => { + if (!event.data || event.data.type !== "JUSO_SELECTED") return + const { zipNo, roadAddrPart1, roadAddrPart2, addrDetail } = event.data.payload || {} + const road = [roadAddrPart1, roadAddrPart2].filter(Boolean).join(" ").trim() + const baseAddress = [zipNo ? `(${zipNo})` : "", road].filter(Boolean).join(" ").trim() + const detail = (addrDetail || "").trim() + const formatted = detail ? `${baseAddress}, ${detail}` : baseAddress + + if (formatted) { + form.setValue("investigationAddress", formatted, { shouldDirty: true }) + } + } + + window.addEventListener("message", handleMessage) + return () => window.removeEventListener("message", handleMessage) + }, [isOpen, isDomesticVendor, form]) + + const handleJusoSearch = () => { + if (!isDomesticVendor) return + window.open( + "/api/juso", + "jusoSearch", + "width=570,height=420,scrollbars=yes,resizable=yes" + ) + } + // Dialog가 열릴 때 QM 담당자 목록 로드 React.useEffect(() => { if (isOpen && qmManagers.length === 0) { @@ -227,7 +260,20 @@ export function RequestInvestigationDialog({ name="investigationAddress" render={({ field }) => ( - 실사 장소 +
+ 실사 장소 + {isDomesticVendor && ( + + )} +