feat: Add BOM management features and enhance BOM tree component
- Integrated BOM routes into the backend for managing BOM history and versions. - Enhanced the V2BomTreeConfigPanel to include options for history and version table management. - Updated the BomTreeComponent to support viewing BOM data in both tree and level formats, with modals for editing BOM details, viewing history, and managing versions. - Improved user interaction with new buttons for accessing BOM history and version management directly from the BOM tree view.
This commit is contained in:
@@ -95,6 +95,9 @@ interface BomTreeConfig {
|
||||
foreignKey?: string;
|
||||
parentKey?: string;
|
||||
|
||||
historyTable?: string;
|
||||
versionTable?: string;
|
||||
|
||||
dataSource?: {
|
||||
sourceTable?: string;
|
||||
foreignKey?: string;
|
||||
@@ -109,6 +112,8 @@ interface BomTreeConfig {
|
||||
showHeader?: boolean;
|
||||
showQuantity?: boolean;
|
||||
showLossRate?: boolean;
|
||||
showHistory?: boolean;
|
||||
showVersion?: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -661,6 +666,140 @@ export function V2BomTreeConfigPanel({
|
||||
|
||||
<Separator />
|
||||
|
||||
{/* 이력/버전 테이블 설정 */}
|
||||
<div className="space-y-2">
|
||||
<Label className="text-xs font-medium">이력/버전 관리</Label>
|
||||
<p className="text-muted-foreground text-[10px]">
|
||||
BOM 변경 이력과 버전 관리에 사용할 테이블을 선택하세요
|
||||
</p>
|
||||
|
||||
<div className="space-y-2">
|
||||
<div className="space-y-1">
|
||||
<div className="flex items-center gap-2">
|
||||
<Checkbox
|
||||
id="tree-showHistory"
|
||||
checked={config.features?.showHistory ?? true}
|
||||
onCheckedChange={(checked) => updateFeatures("showHistory", !!checked)}
|
||||
/>
|
||||
<Label htmlFor="tree-showHistory" className="text-[10px]">이력 관리 사용</Label>
|
||||
</div>
|
||||
{(config.features?.showHistory ?? true) && (
|
||||
<Popover>
|
||||
<PopoverTrigger asChild>
|
||||
<Button
|
||||
variant="outline"
|
||||
role="combobox"
|
||||
disabled={loadingTables}
|
||||
className="h-8 w-full justify-between text-xs"
|
||||
>
|
||||
{config.historyTable
|
||||
? allTables.find((t) => t.tableName === config.historyTable)?.displayName || config.historyTable
|
||||
: "이력 테이블 선택..."}
|
||||
<ChevronsUpDown className="ml-2 h-3 w-3 shrink-0 opacity-50" />
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent
|
||||
className="p-0"
|
||||
style={{ width: "var(--radix-popover-trigger-width)" }}
|
||||
align="start"
|
||||
>
|
||||
<Command>
|
||||
<CommandInput placeholder="테이블 검색..." className="text-xs" />
|
||||
<CommandList className="max-h-48">
|
||||
<CommandEmpty className="py-3 text-center text-xs">
|
||||
테이블을 찾을 수 없습니다.
|
||||
</CommandEmpty>
|
||||
<CommandGroup>
|
||||
{allTables.map((table) => (
|
||||
<CommandItem
|
||||
key={table.tableName}
|
||||
value={`${table.tableName} ${table.displayName}`}
|
||||
onSelect={() => updateConfig({ historyTable: table.tableName })}
|
||||
className="text-xs"
|
||||
>
|
||||
<Check
|
||||
className={cn(
|
||||
"mr-2 h-3 w-3",
|
||||
config.historyTable === table.tableName ? "opacity-100" : "opacity-0",
|
||||
)}
|
||||
/>
|
||||
<Database className="mr-2 h-3 w-3 text-gray-400" />
|
||||
<span>{table.displayName}</span>
|
||||
</CommandItem>
|
||||
))}
|
||||
</CommandGroup>
|
||||
</CommandList>
|
||||
</Command>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="space-y-1">
|
||||
<div className="flex items-center gap-2">
|
||||
<Checkbox
|
||||
id="tree-showVersion"
|
||||
checked={config.features?.showVersion ?? true}
|
||||
onCheckedChange={(checked) => updateFeatures("showVersion", !!checked)}
|
||||
/>
|
||||
<Label htmlFor="tree-showVersion" className="text-[10px]">버전 관리 사용</Label>
|
||||
</div>
|
||||
{(config.features?.showVersion ?? true) && (
|
||||
<Popover>
|
||||
<PopoverTrigger asChild>
|
||||
<Button
|
||||
variant="outline"
|
||||
role="combobox"
|
||||
disabled={loadingTables}
|
||||
className="h-8 w-full justify-between text-xs"
|
||||
>
|
||||
{config.versionTable
|
||||
? allTables.find((t) => t.tableName === config.versionTable)?.displayName || config.versionTable
|
||||
: "버전 테이블 선택..."}
|
||||
<ChevronsUpDown className="ml-2 h-3 w-3 shrink-0 opacity-50" />
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent
|
||||
className="p-0"
|
||||
style={{ width: "var(--radix-popover-trigger-width)" }}
|
||||
align="start"
|
||||
>
|
||||
<Command>
|
||||
<CommandInput placeholder="테이블 검색..." className="text-xs" />
|
||||
<CommandList className="max-h-48">
|
||||
<CommandEmpty className="py-3 text-center text-xs">
|
||||
테이블을 찾을 수 없습니다.
|
||||
</CommandEmpty>
|
||||
<CommandGroup>
|
||||
{allTables.map((table) => (
|
||||
<CommandItem
|
||||
key={table.tableName}
|
||||
value={`${table.tableName} ${table.displayName}`}
|
||||
onSelect={() => updateConfig({ versionTable: table.tableName })}
|
||||
className="text-xs"
|
||||
>
|
||||
<Check
|
||||
className={cn(
|
||||
"mr-2 h-3 w-3",
|
||||
config.versionTable === table.tableName ? "opacity-100" : "opacity-0",
|
||||
)}
|
||||
/>
|
||||
<Database className="mr-2 h-3 w-3 text-gray-400" />
|
||||
<span>{table.displayName}</span>
|
||||
</CommandItem>
|
||||
))}
|
||||
</CommandGroup>
|
||||
</CommandList>
|
||||
</Command>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Separator />
|
||||
|
||||
{/* 표시 옵션 */}
|
||||
<div className="space-y-3">
|
||||
<Label className="text-xs font-medium">표시 옵션</Label>
|
||||
|
||||
Reference in New Issue
Block a user