메뉴생성시 화면할당기능 구현

This commit is contained in:
kjs
2025-09-19 15:22:25 +09:00
parent d1e1c7964b
commit 84d4d49bd5
3 changed files with 962 additions and 10 deletions

View File

@@ -406,7 +406,32 @@ const SelectBasicComponent: React.FC<SelectBasicComponentProps> = ({
const options = getAllOptions();
const selectedOption = options.find((option) => option.value === selectedValue);
const newLabel = selectedOption?.label || "";
// 🎯 코드 타입의 경우 코드값과 코드명을 모두 고려하여 라벨 찾기
let newLabel = selectedOption?.label || "";
// selectedOption이 없고 selectedValue가 있다면, 코드명으로도 검색해보기
if (!selectedOption && selectedValue && codeOptions.length > 0) {
// 1) selectedValue가 코드명인 경우 (예: "국내")
const labelMatch = options.find((option) => option.label === selectedValue);
if (labelMatch) {
newLabel = labelMatch.label;
console.log(`🔍 [${component.id}] 코드명으로 매치 발견: "${selectedValue}" → "${newLabel}"`);
} else {
// 2) selectedValue가 코드값인 경우라면 원래 로직대로 라벨을 찾되, 없으면 원값 표시
newLabel = selectedValue; // 코드값 그대로 표시 (예: "555")
console.log(`🔍 [${component.id}] 코드값 원본 유지: "${selectedValue}"`);
}
}
console.log(`🏷️ [${component.id}] 라벨 업데이트:`, {
selectedValue,
selectedOption: selectedOption ? { value: selectedOption.value, label: selectedOption.label } : null,
newLabel,
optionsCount: options.length,
allOptionsValues: options.map((o) => o.value),
allOptionsLabels: options.map((o) => o.label),
});
if (newLabel !== selectedLabel) {
setSelectedLabel(newLabel);