refactor: SplitPanelLayout 하드코딩 제거 및 그룹 삭제 기능 구현

- 하드코딩 제거: 필드명 패턴을 동적으로 처리
- 민감한 필드(id, password, token, company_code)만 제외하고 모두 표시
- 그룹 삭제 기능: 중복 제거 활성화 시 관련된 모든 레코드 삭제
- URL 파라미터 초기화: 모달 닫을 때 자동으로 초기화
- 백엔드: deleteGroupRecords API 추가
- 프론트엔드: dataApi.deleteGroupRecords 클라이언트 추가
This commit is contained in:
kjs 2025-11-20 12:19:27 +09:00
parent e3b78309fa
commit 348c040e20
1 changed files with 17 additions and 5 deletions

View File

@ -60,6 +60,18 @@ export const SplitPanelLayoutComponent: React.FC<SplitPanelLayoutComponentProps>
const resizable = componentConfig.resizable ?? true;
const minLeftWidth = componentConfig.minLeftWidth || 200;
const minRightWidth = componentConfig.minRightWidth || 300;
// 필드 표시 유틸리티 (하드코딩 제거, 동적으로 작동)
const shouldShowField = (fieldName: string): boolean => {
const lower = fieldName.toLowerCase();
// 기본 제외: id, 비밀번호, 토큰, 회사코드
if (lower === "id" || lower === "company_code" || lower === "company_name") return false;
if (lower.includes("password") || lower.includes("token")) return false;
// 나머지는 모두 표시!
return true;
};
// TableOptions Context
const { registerTable, unregisterTable } = useTableOptions();
@ -1690,13 +1702,13 @@ export const SplitPanelLayoutComponent: React.FC<SplitPanelLayoutComponentProps>
value: item[leftColumn],
});
// 추가로 다른 의미있는 필드 1-2개 표시 (name, title 등)
// 추가로 다른 의미있는 필드 1-2개 표시 (동적)
const additionalKeys = Object.keys(item).filter(
(k) =>
k !== "id" &&
k !== "ID" &&
k !== leftColumn &&
(k.includes("name") || k.includes("title") || k.includes("desc")),
shouldShowField(k),
);
if (additionalKeys.length > 0) {
@ -1925,7 +1937,7 @@ export const SplitPanelLayoutComponent: React.FC<SplitPanelLayoutComponentProps>
label: rightColumnLabels[col.name] || col.label || col.name,
}))
: Object.keys(filteredData[0] || {})
.filter((key) => !key.toLowerCase().includes("password"))
.filter((key) => shouldShowField(key))
.slice(0, 5)
.map((key) => ({
name: key,
@ -2537,9 +2549,9 @@ export const SplitPanelLayoutComponent: React.FC<SplitPanelLayoutComponentProps>
</div>
));
} else {
// 설정이 없으면 모든 컬럼 표시 (company_code, company_name 제외)
// 설정이 없으면 모든 컬럼 표시 (민감한 필드 제외)
return Object.entries(editModalFormData)
.filter(([key]) => key !== "company_code" && key !== "company_name")
.filter(([key]) => shouldShowField(key))
.map(([key, value]) => (
<div key={key}>
<Label htmlFor={`edit-${key}`} className="text-xs sm:text-sm">