From 54724fc578e0e8ce6dbfa1de459bec83087c6239 Mon Sep 17 00:00:00 2001 From: kjs Date: Wed, 12 Nov 2025 15:25:21 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EA=B7=B8=EB=A3=B9=20=EC=84=A4=EC=A0=95?= =?UTF-8?q?=20=EA=B8=B0=EB=8A=A5=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20?= =?UTF-8?q?=EC=B9=B4=ED=85=8C=EA=B3=A0=EB=A6=AC=20=EA=B0=92=20=ED=91=9C?= =?UTF-8?q?=EC=8B=9C=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - TableListComponent: grouping 상태 변경 시 groupByColumns 자동 업데이트 - 그룹화 시 카테고리/엔티티/코드 타입 컬럼은 _name 필드 사용 - 그룹 키 생성 시 실제 이름 표시 (코드 대신) 예시: - 이전: 상태:CATEGORY_159712 > 품번:SLI-2025-0001 - 이후: 상태:완제품 > 품번:SLI-2025-0001 --- .../table-list/TableListComponent.tsx | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/frontend/lib/registry/components/table-list/TableListComponent.tsx b/frontend/lib/registry/components/table-list/TableListComponent.tsx index 6344f3e8..cc304fb0 100644 --- a/frontend/lib/registry/components/table-list/TableListComponent.tsx +++ b/frontend/lib/registry/components/table-list/TableListComponent.tsx @@ -274,6 +274,11 @@ export const TableListComponent: React.FC = ({ setCurrentPage(1); // 필터 변경 시 첫 페이지로 }, [filters]); + // grouping이 변경되면 groupByColumns 업데이트 + useEffect(() => { + setGroupByColumns(grouping); + }, [grouping]); + // 초기 로드 시 localStorage에서 저장된 설정 불러오기 useEffect(() => { if (tableConfig.selectedTable && currentUserId) { @@ -1652,9 +1657,20 @@ export const TableListComponent: React.FC = ({ data.forEach((item) => { // 그룹 키 생성: "통화:KRW > 단위:EA" const keyParts = groupByColumns.map((col) => { - const value = item[col]; + // 카테고리/엔티티 타입인 경우 _name 필드 사용 + const inputType = columnMeta?.[col]?.inputType; + let displayValue = item[col]; + + if (inputType === 'category' || inputType === 'entity' || inputType === 'code') { + // _name 필드가 있으면 사용 (예: division_name, writer_name) + const nameField = `${col}_name`; + if (item[nameField] !== undefined && item[nameField] !== null) { + displayValue = item[nameField]; + } + } + const label = columnLabels[col] || col; - return `${label}:${value !== null && value !== undefined ? value : "-"}`; + return `${label}:${displayValue !== null && displayValue !== undefined ? displayValue : "-"}`; }); const groupKey = keyParts.join(" > "); @@ -1677,7 +1693,7 @@ export const TableListComponent: React.FC = ({ count: items.length, }; }); - }, [data, groupByColumns, columnLabels]); + }, [data, groupByColumns, columnLabels, columnMeta]); // 저장된 그룹 설정 불러오기 useEffect(() => {