fix: 수주 등록 시 재질 컬럼 저장 오류 수정
- ModalRepeaterTableComponent의 저장 필터링 로직 개선 - columnMappings에 정의된 필드는 sourceColumns에 있어도 저장 - mappedFields 우선순위로 필터링 순서 변경 - 조인 전용 컬럼과 복사 저장 컬럼 구분 가능
This commit is contained in:
@@ -312,18 +312,32 @@ export function ModalRepeaterTableComponent({
|
||||
}
|
||||
|
||||
// sourceColumns에 포함된 컬럼 제외 (조인된 컬럼 제거)
|
||||
// 단, columnMappings에 정의된 컬럼은 저장해야 하므로 제외하지 않음
|
||||
const mappedFields = columns
|
||||
.filter(col => col.mapping?.type === "source" && col.mapping?.sourceField)
|
||||
.map(col => col.field);
|
||||
|
||||
const filteredData = value.map((item: any) => {
|
||||
const filtered: Record<string, any> = {};
|
||||
|
||||
Object.keys(item).forEach((key) => {
|
||||
// sourceColumns에 포함된 컬럼은 제외 (item_info 테이블의 컬럼)
|
||||
if (sourceColumns.includes(key)) {
|
||||
return;
|
||||
}
|
||||
// 메타데이터 필드도 제외
|
||||
// 메타데이터 필드 제외
|
||||
if (key.startsWith("_")) {
|
||||
return;
|
||||
}
|
||||
|
||||
// sourceColumns에 포함되어 있지만 columnMappings에도 정의된 경우 → 저장함
|
||||
if (mappedFields.includes(key)) {
|
||||
filtered[key] = item[key];
|
||||
return;
|
||||
}
|
||||
|
||||
// sourceColumns에만 있고 매핑 안 된 경우 → 제외 (조인 전용)
|
||||
if (sourceColumns.includes(key)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 나머지는 모두 저장
|
||||
filtered[key] = item[key];
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user