feat: 렉 구조 컴포넌트 v2 지원 및 불필요한 로그 제거

- 렉 구조 컴포넌트에서 v2-rack-structure를 지원하도록 수정하였습니다. 기존의 rack-structure 컴포넌트는 deprecated 처리되었습니다.
- 불필요한 콘솔 로그 메시지를 제거하여 코드의 가독성을 향상시켰습니다.
- 관련된 컴포넌트에서 v2 구조에 맞게 변경 사항을 반영하였습니다.
This commit is contained in:
kjs 2026-01-27 11:14:41 +09:00
parent 042488d51b
commit 8a2c13bba8
4 changed files with 8 additions and 55 deletions

View File

@ -535,21 +535,14 @@ export const InteractiveScreenViewer: React.FC<InteractiveScreenViewerProps> = (
);
}
// 🆕 렉 구조 컴포넌트 처리
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 (
<div className="h-full w-full overflow-auto">
<RackStructureComponent
@ -557,7 +550,6 @@ export const InteractiveScreenViewer: React.FC<InteractiveScreenViewerProps> = (
formData={formData}
tableName={tableName}
onChange={(locations: any[]) => {
console.log("📦 렉 구조 위치 데이터 변경:", locations.length, "개");
// 컴포넌트의 columnName을 키로 사용
const fieldKey = (comp as any).columnName || "_rackStructureLocations";
updateFormData(fieldKey, locations);

View File

@ -240,7 +240,6 @@ export const RackStructureComponent: React.FC<RackStructureComponentProps> = ({
// 카테고리 코드로 라벨 일괄 조회
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<RackStructureComponentProps> = ({
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<RackStructureComponentProps> = ({
// 기존 데이터 조회 (창고/층/구역이 변경될 때마다)
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<RackStructureComponentProps> = ({
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<RackStructureComponentProps> = ({
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<RackStructureComponentProps> = ({
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<RackStructureComponentProps> = ({
// 미리보기 생성
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<RackStructureComponentProps> = ({
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,

View File

@ -45,7 +45,6 @@ export class RackStructureRenderer extends AutoRegisteringComponentRenderer {
// formData에도 저장하여 저장 액션에서 감지할 수 있도록 함
if (onFormDataChange) {
console.log("📦 [RackStructure] 미리보기 데이터를 formData에 저장:", locations.length, "개");
onFormDataChange("_rackStructureLocations", locations);
}
};

View File

@ -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;