From 8a2c13bba8f9a2d0fcf9cde5e0b852fd53e9e0ed Mon Sep 17 00:00:00 2001 From: kjs Date: Tue, 27 Jan 2026 11:14:41 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=A0=89=20=EA=B5=AC=EC=A1=B0=20?= =?UTF-8?q?=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20v2=20=EC=A7=80=EC=9B=90?= =?UTF-8?q?=20=EB=B0=8F=20=EB=B6=88=ED=95=84=EC=9A=94=ED=95=9C=20=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 렉 구조 컴포넌트에서 v2-rack-structure를 지원하도록 수정하였습니다. 기존의 rack-structure 컴포넌트는 deprecated 처리되었습니다. - 불필요한 콘솔 로그 메시지를 제거하여 코드의 가독성을 향상시켰습니다. - 관련된 컴포넌트에서 v2 구조에 맞게 변경 사항을 반영하였습니다. --- .../screen/InteractiveScreenViewer.tsx | 16 ++------ .../RackStructureComponent.tsx | 38 ------------------- .../RackStructureRenderer.tsx | 1 - frontend/lib/utils/buttonActions.ts | 8 ++-- 4 files changed, 8 insertions(+), 55 deletions(-) diff --git a/frontend/components/screen/InteractiveScreenViewer.tsx b/frontend/components/screen/InteractiveScreenViewer.tsx index 6456ac17..30399409 100644 --- a/frontend/components/screen/InteractiveScreenViewer.tsx +++ b/frontend/components/screen/InteractiveScreenViewer.tsx @@ -535,21 +535,14 @@ export const InteractiveScreenViewer: React.FC = ( ); } - // 🆕 렉 구조 컴포넌트 처리 - if (comp.type === "component" && componentType === "rack-structure") { - const { RackStructureComponent } = require("@/lib/registry/components/rack-structure/RackStructureComponent"); + // 🆕 렉 구조 컴포넌트 처리 (v1, v2 모두 지원) + if (comp.type === "component" && (componentType === "rack-structure" || componentType === "v2-rack-structure")) { + // v2 컴포넌트 사용 (v1은 deprecated) + const { RackStructureComponent } = require("@/lib/registry/components/v2-rack-structure/RackStructureComponent"); const componentConfig = (comp as any).componentConfig || {}; // config가 중첩되어 있을 수 있음: componentConfig.config 또는 componentConfig 직접 const rackConfig = componentConfig.config || componentConfig; - console.log("🏗️ 렉 구조 컴포넌트 렌더링:", { - componentType, - componentConfig, - rackConfig, - fieldMapping: rackConfig.fieldMapping, - formData, - }); - return (
= ( formData={formData} tableName={tableName} onChange={(locations: any[]) => { - console.log("📦 렉 구조 위치 데이터 변경:", locations.length, "개"); // 컴포넌트의 columnName을 키로 사용 const fieldKey = (comp as any).columnName || "_rackStructureLocations"; updateFormData(fieldKey, locations); diff --git a/frontend/lib/registry/components/v2-rack-structure/RackStructureComponent.tsx b/frontend/lib/registry/components/v2-rack-structure/RackStructureComponent.tsx index ea946531..d670c25c 100644 --- a/frontend/lib/registry/components/v2-rack-structure/RackStructureComponent.tsx +++ b/frontend/lib/registry/components/v2-rack-structure/RackStructureComponent.tsx @@ -240,7 +240,6 @@ export const RackStructureComponent: React.FC = ({ // 카테고리 코드로 라벨 일괄 조회 const response = await getCategoryLabelsByCodes(valuesToLookup); if (response.success && response.data) { - console.log("✅ 카테고리 라벨 조회 완료:", response.data); setCategoryLabels((prev) => ({ ...prev, ...response.data })); } } catch (error) { @@ -286,12 +285,6 @@ export const RackStructureComponent: React.FC = ({ status: getCategoryLabel(rawStatus), }; - console.log("🏗️ [RackStructure] context 생성:", { - fieldMapping, - rawValues: { rawFloor, rawZone, rawLocationType, rawStatus }, - context: ctx, - }); - return ctx; }, [propContext, formData, fieldMapping, getCategoryLabel]); @@ -384,16 +377,9 @@ export const RackStructureComponent: React.FC = ({ // 기존 데이터 조회 (창고/층/구역이 변경될 때마다) useEffect(() => { const loadExistingLocations = async () => { - console.log("🏗️ [RackStructure] 기존 데이터 조회 체크:", { - warehouseCode: warehouseCodeForQuery, - floor: floorForQuery, - zone: zoneForQuery, - }); - // 필수 조건이 충족되지 않으면 기존 데이터 초기화 // DB에는 라벨 값(예: "1층", "A구역")으로 저장되어 있으므로 라벨 값 사용 if (!warehouseCodeForQuery || !floorForQuery || !zoneForQuery) { - console.log("⚠️ [RackStructure] 필수 조건 미충족 - 조회 스킵"); setExistingLocations([]); setDuplicateErrors([]); return; @@ -409,7 +395,6 @@ export const RackStructureComponent: React.FC = ({ floor: { value: floorForQuery, operator: "equals" }, zone: { value: zoneForQuery, operator: "equals" }, }; - console.log("🔍 기존 위치 데이터 조회 시작 (정확한 일치):", searchParams); // 직접 apiClient 사용하여 정확한 형식으로 요청 // 백엔드는 search를 객체로 받아서 각 필드를 WHERE 조건으로 처리 @@ -421,8 +406,6 @@ export const RackStructureComponent: React.FC = ({ autoFilter: true, // 회사별 데이터 필터링 (멀티테넌시) }); - console.log("🔍 기존 위치 데이터 응답:", response.data); - // API 응답 구조: { success: true, data: { data: [...], total, ... } } const responseData = response.data?.data || response.data; const dataArray = Array.isArray(responseData) ? responseData : responseData?.data || []; @@ -434,9 +417,7 @@ export const RackStructureComponent: React.FC = ({ location_code: item.location_code, })); setExistingLocations(existing); - console.log("✅ 기존 위치 데이터 조회 완료:", existing.length, "개", existing); } else { - console.log("⚠️ 기존 위치 데이터 없음 또는 조회 실패"); setExistingLocations([]); } } catch (error) { @@ -533,14 +514,6 @@ export const RackStructureComponent: React.FC = ({ // 미리보기 생성 const generatePreview = useCallback(() => { - console.log("🔍 [generatePreview] 검증 시작:", { - missingFields, - hasRowOverlap, - hasDuplicateWithExisting, - duplicateErrorsCount: duplicateErrors.length, - existingLocationsCount: existingLocations.length, - }); - // 필수 필드 검증 if (missingFields.length > 0) { alert(`다음 필드를 먼저 입력해주세요: ${missingFields.join(", ")}`); @@ -607,17 +580,6 @@ export const RackStructureComponent: React.FC = ({ setPreviewData(locations); setIsPreviewGenerated(true); - console.log("🏗️ [RackStructure] 생성된 위치 데이터:", { - locationsCount: locations.length, - firstLocation: locations[0], - context: { - warehouseCode: context?.warehouseCode, - warehouseName: context?.warehouseName, - floor: context?.floor, - zone: context?.zone, - }, - }); - onChange?.(locations); }, [ conditions, diff --git a/frontend/lib/registry/components/v2-rack-structure/RackStructureRenderer.tsx b/frontend/lib/registry/components/v2-rack-structure/RackStructureRenderer.tsx index 594f5a53..16fe7188 100644 --- a/frontend/lib/registry/components/v2-rack-structure/RackStructureRenderer.tsx +++ b/frontend/lib/registry/components/v2-rack-structure/RackStructureRenderer.tsx @@ -45,7 +45,6 @@ export class RackStructureRenderer extends AutoRegisteringComponentRenderer { // formData에도 저장하여 저장 액션에서 감지할 수 있도록 함 if (onFormDataChange) { - console.log("📦 [RackStructure] 미리보기 데이터를 formData에 저장:", locations.length, "개"); onFormDataChange("_rackStructureLocations", locations); } }; diff --git a/frontend/lib/utils/buttonActions.ts b/frontend/lib/utils/buttonActions.ts index 4e6d2ac4..bc0ea0fe 100644 --- a/frontend/lib/utils/buttonActions.ts +++ b/frontend/lib/utils/buttonActions.ts @@ -547,13 +547,11 @@ export class ButtonActionExecutor { ); if (hasTableSectionData) { - } // 🆕 EditModal 등에서 전달된 onSave 콜백이 있으면 우선 사용 // 단, _tableSection_ 데이터가 있으면 건너뛰기 (handleUniversalFormModalTableSectionSave가 처리) if (onSave && !hasTableSectionData) { - try { await onSave(); return true; @@ -594,10 +592,12 @@ export class ButtonActionExecutor { } } else if (value.length === 0 && key.startsWith("comp_")) { // comp_로 시작하는 빈 배열은 렉 구조 컴포넌트일 가능성 있음 - // allComponents에서 확인 + // allComponents에서 확인 (v1, v2 모두 지원) const rackStructureComponentInLayout = context.allComponents?.find( (comp: any) => - comp.type === "component" && comp.componentId === "rack-structure" && comp.columnName === key, + comp.type === "component" && + (comp.componentId === "rack-structure" || comp.componentId === "v2-rack-structure") && + comp.columnName === key, ); if (rackStructureComponentInLayout) { hasEmptyRackStructureField = true;