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:
DDD1542
2026-02-25 14:50:51 +09:00
parent ed9e36c213
commit 18cf5e3269
9 changed files with 1311 additions and 21 deletions

View File

@@ -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>