데이터 증식하는 문제 해결

This commit is contained in:
leeheejin 2025-12-09 16:54:47 +09:00
parent 0f8817835e
commit 36a7529da2
1 changed files with 80 additions and 76 deletions

View File

@ -585,21 +585,29 @@ export function SimpleRepeaterTableConfigPanel({
<div className="space-y-2">
<Label className="text-xs sm:text-sm"> </Label>
<Select
value={localConfig.initialDataConfig?.sourceTable || ""}
onValueChange={(value) =>
updateConfig({
initialDataConfig: {
...localConfig.initialDataConfig,
sourceTable: value,
},
})
}
value={localConfig.initialDataConfig?.sourceTable || "__none__"}
onValueChange={(value) => {
if (value === "__none__") {
// 선택 안 함: initialDataConfig 초기화
updateConfig({
initialDataConfig: undefined,
});
} else {
updateConfig({
initialDataConfig: {
...localConfig.initialDataConfig,
sourceTable: value,
},
});
}
}}
disabled={isLoadingTables}
>
<SelectTrigger className="h-10 text-sm w-full">
<SelectValue placeholder={isLoadingTables ? "로딩 중..." : "데이터를 가져올 테이블 선택"} />
<SelectValue placeholder={isLoadingTables ? "로딩 중..." : "선택 안 함 (빈 테이블로 시작)"} />
</SelectTrigger>
<SelectContent>
<SelectItem value="__none__"> ( )</SelectItem>
{allTables.map((table) => (
<SelectItem key={table.tableName} value={table.tableName}>
{table.displayName || table.tableName}
@ -608,7 +616,7 @@ export function SimpleRepeaterTableConfigPanel({
</SelectContent>
</Select>
<p className="text-xs text-muted-foreground">
(: sales_order_mng)
( )
</p>
</div>
@ -1079,48 +1087,71 @@ export function SimpleRepeaterTableConfigPanel({
)}
</div>
{/* 🆕 데이터 타겟 설정 (어디에 저장할지) */}
<div className="space-y-3 border-t pt-4">
<div className="flex items-center gap-2">
<div className="h-1 w-1 rounded-full bg-green-500"></div>
<Label className="text-xs font-semibold text-green-600"> ( ?)</Label>
{/* 🆕 데이터 타겟 설정 - 부모-자식 모드면 숨김 */}
{localConfig.parentChildConfig?.enabled ? (
// 부모-자식 모드: 간단한 안내만 표시
<div className="border-t pt-4">
<div className="p-3 bg-green-50 dark:bg-green-950 rounded-md border border-green-200 dark:border-green-800">
<p className="text-xs text-muted-foreground">
<strong className="text-green-700 dark:text-green-400">- </strong>
<br />
<code className="bg-green-100 dark:bg-green-900 px-1 rounded">{localConfig.parentChildConfig.childTable || "자식 테이블"}.{col.field || "필드명"}</code>
</p>
</div>
</div>
) : (
// 일반 모드: 타겟 설정 (선택사항)
<div className="space-y-3 border-t pt-4">
<div className="flex items-center gap-2">
<div className="h-1 w-1 rounded-full bg-gray-400"></div>
<Label className="text-xs font-semibold text-muted-foreground"> ()</Label>
</div>
<div className="space-y-2">
<Label className="text-xs"> </Label>
<Select
value={col.targetConfig?.targetTable || ""}
onValueChange={(value) => updateColumn(index, {
targetConfig: {
...col.targetConfig,
targetTable: value,
saveEnabled: true,
}
})}
>
<SelectTrigger className="h-8 text-xs sm:h-10 sm:text-sm">
<SelectValue placeholder="저장할 테이블 선택" />
</SelectTrigger>
<SelectContent>
{allTables.map((table) => (
<SelectItem key={table.tableName} value={table.tableName}>
{table.displayName || table.tableName}
</SelectItem>
))}
</SelectContent>
</Select>
<p className="text-xs text-muted-foreground">
</p>
</div>
<div className="space-y-2">
<Label className="text-xs"> </Label>
<Select
value={col.targetConfig?.targetTable && col.targetConfig.targetTable !== "" ? col.targetConfig.targetTable : "__none__"}
onValueChange={(value) => {
if (value === "__none__") {
// 선택 안 함: targetConfig 초기화
updateColumn(index, {
targetConfig: undefined
});
} else {
// 테이블 선택: targetConfig 설정
updateColumn(index, {
targetConfig: {
targetTable: value,
targetColumn: col.field || "",
saveEnabled: true,
}
});
}
}}
>
<SelectTrigger className="h-8 text-xs sm:h-10 sm:text-sm">
<SelectValue placeholder="선택 안 함" />
</SelectTrigger>
<SelectContent>
<SelectItem value="__none__"> </SelectItem>
{allTables.map((table) => (
<SelectItem key={table.tableName} value={table.tableName}>
{table.displayName || table.tableName}
</SelectItem>
))}
</SelectContent>
</Select>
<p className="text-xs text-muted-foreground">
</p>
</div>
{col.targetConfig?.targetTable && (
<>
{col.targetConfig?.targetTable && col.targetConfig.targetTable !== "" && (
<div className="space-y-2">
<Label className="text-xs"> </Label>
<SourceColumnSelector
sourceTable={col.targetConfig.targetTable}
value={col.targetConfig.targetColumn || ""}
value={col.targetConfig.targetColumn || col.field || ""}
onChange={(value) => updateColumn(index, {
targetConfig: {
...col.targetConfig,
@ -1129,37 +1160,10 @@ export function SimpleRepeaterTableConfigPanel({
})}
showTableName={true}
/>
<p className="text-xs text-muted-foreground">
</p>
</div>
<div className="space-y-2">
<div className="flex items-center justify-between">
<Label className="text-xs"> </Label>
<Switch
checked={col.targetConfig.saveEnabled ?? true}
onCheckedChange={(checked) => updateColumn(index, {
targetConfig: {
...col.targetConfig,
saveEnabled: checked
}
})}
/>
</div>
<p className="text-xs text-muted-foreground">
( )
</p>
</div>
{col.targetConfig.targetTable && col.targetConfig.targetColumn && (
<div className="p-2 bg-green-50 dark:bg-green-950 rounded text-[10px] font-mono border border-green-200 dark:border-green-800">
: {col.targetConfig.targetTable}.{col.targetConfig.targetColumn}
</div>
)}
</>
)}
</div>
)}
</div>
)}
{/* 편집 가능 여부 */}
<div className="space-y-2">