Merge pull request '데이터 증식하는 문제 해결' (#264) from lhj into main
Reviewed-on: http://39.117.244.52:3000/kjs/ERP-node/pulls/264
This commit is contained in:
commit
74da2cd97f
|
|
@ -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">
|
||||
|
|
|
|||
Loading…
Reference in New Issue