불필요한 컴포넌트 제거
This commit is contained in:
@@ -141,12 +141,13 @@ export function ConditionalConfigPanel({
|
||||
setLoadingOptions(true);
|
||||
try {
|
||||
const { apiClient } = await import("@/lib/api/client");
|
||||
const response = await apiClient.get(`/common-codes/${selectedField.codeGroup}/items`);
|
||||
// 올바른 API 경로: /common-codes/categories/:categoryCode/options
|
||||
const response = await apiClient.get(`/common-codes/categories/${selectedField.codeGroup}/options`);
|
||||
if (response.data.success && response.data.data) {
|
||||
setDynamicOptions(
|
||||
response.data.data.map((item: { code: string; codeName: string }) => ({
|
||||
value: item.code,
|
||||
label: item.codeName,
|
||||
response.data.data.map((item: { value: string; label: string }) => ({
|
||||
value: item.value,
|
||||
label: item.label,
|
||||
}))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -547,13 +547,13 @@ export const UnifiedSelect = forwardRef<HTMLDivElement, UnifiedSelectProps>(
|
||||
}));
|
||||
}
|
||||
} else {
|
||||
// 일반 공통코드에서 로드
|
||||
const response = await apiClient.get(`/common-codes/${codeGroup}/items`);
|
||||
// 일반 공통코드에서 로드 (올바른 API 경로: /common-codes/categories/:categoryCode/options)
|
||||
const response = await apiClient.get(`/common-codes/categories/${codeGroup}/options`);
|
||||
const data = response.data;
|
||||
if (data.success && data.data) {
|
||||
fetchedOptions = data.data.map((item: { code: string; codeName: string }) => ({
|
||||
value: item.code,
|
||||
label: item.codeName,
|
||||
fetchedOptions = data.data.map((item: { value: string; label: string }) => ({
|
||||
value: item.value,
|
||||
label: item.label,
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,12 +23,17 @@ interface ColumnOption {
|
||||
interface UnifiedSelectConfigPanelProps {
|
||||
config: Record<string, any>;
|
||||
onChange: (config: Record<string, any>) => void;
|
||||
/** 컬럼의 inputType (entity 타입인 경우에만 엔티티 소스 표시) */
|
||||
inputType?: string;
|
||||
}
|
||||
|
||||
export const UnifiedSelectConfigPanel: React.FC<UnifiedSelectConfigPanelProps> = ({
|
||||
config,
|
||||
onChange,
|
||||
inputType,
|
||||
}) => {
|
||||
// 엔티티 타입인지 확인
|
||||
const isEntityType = inputType === "entity";
|
||||
// 엔티티 테이블의 컬럼 목록
|
||||
const [entityColumns, setEntityColumns] = useState<ColumnOption[]>([]);
|
||||
const [loadingColumns, setLoadingColumns] = useState(false);
|
||||
@@ -135,9 +140,8 @@ export const UnifiedSelectConfigPanel: React.FC<UnifiedSelectConfigPanelProps> =
|
||||
<SelectContent>
|
||||
<SelectItem value="static">정적 옵션</SelectItem>
|
||||
<SelectItem value="code">공통 코드</SelectItem>
|
||||
<SelectItem value="db">데이터베이스</SelectItem>
|
||||
<SelectItem value="api">API</SelectItem>
|
||||
<SelectItem value="entity">엔티티</SelectItem>
|
||||
{/* 엔티티 타입일 때만 엔티티 옵션 표시 */}
|
||||
{isEntityType && <SelectItem value="entity">엔티티</SelectItem>}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
@@ -193,66 +197,20 @@ export const UnifiedSelectConfigPanel: React.FC<UnifiedSelectConfigPanelProps> =
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 공통 코드 설정 */}
|
||||
{/* 공통 코드 설정 - 테이블 타입 관리에서 설정되므로 정보만 표시 */}
|
||||
{config.source === "code" && (
|
||||
<div className="space-y-2">
|
||||
<div className="space-y-1">
|
||||
<Label className="text-xs font-medium">코드 그룹</Label>
|
||||
<Input
|
||||
value={config.codeGroup || ""}
|
||||
onChange={(e) => updateConfig("codeGroup", e.target.value)}
|
||||
placeholder="공통 코드 그룹명"
|
||||
className="h-8 text-xs"
|
||||
/>
|
||||
{config.codeGroup ? (
|
||||
<p className="text-sm font-medium text-foreground">{config.codeGroup}</p>
|
||||
) : (
|
||||
<p className="text-xs text-amber-600">
|
||||
테이블 타입 관리에서 코드 그룹을 설정해주세요
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* DB 설정 */}
|
||||
{config.source === "db" && (
|
||||
<div className="space-y-2">
|
||||
<div className="space-y-2">
|
||||
<Label className="text-xs font-medium">테이블명</Label>
|
||||
<Input
|
||||
value={config.table || ""}
|
||||
onChange={(e) => updateConfig("table", e.target.value)}
|
||||
placeholder="테이블명"
|
||||
className="h-8 text-xs"
|
||||
/>
|
||||
</div>
|
||||
<div className="grid grid-cols-2 gap-2">
|
||||
<div className="space-y-2">
|
||||
<Label className="text-xs font-medium">값 컬럼</Label>
|
||||
<Input
|
||||
value={config.valueColumn || ""}
|
||||
onChange={(e) => updateConfig("valueColumn", e.target.value)}
|
||||
placeholder="id"
|
||||
className="h-8 text-xs"
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label className="text-xs font-medium">표시 컬럼</Label>
|
||||
<Input
|
||||
value={config.labelColumn || ""}
|
||||
onChange={(e) => updateConfig("labelColumn", e.target.value)}
|
||||
placeholder="name"
|
||||
className="h-8 text-xs"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* API 설정 */}
|
||||
{config.source === "api" && (
|
||||
<div className="space-y-2">
|
||||
<Label className="text-xs font-medium">API 엔드포인트</Label>
|
||||
<Input
|
||||
value={config.apiEndpoint || ""}
|
||||
onChange={(e) => updateConfig("apiEndpoint", e.target.value)}
|
||||
placeholder="/api/options"
|
||||
className="h-8 text-xs"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 엔티티(참조 테이블) 설정 */}
|
||||
{config.source === "entity" && (
|
||||
|
||||
Reference in New Issue
Block a user