fix: 수주관리 수정 저장 시 조인 컬럼 필터링 추가

- entityJoinApi 조회 데이터의 조인 컬럼(material_label 등) 필터링
- dynamicFormService.ts: 병합 모드에서 columnInfo 기반 유효 컬럼만 저장
- sales_order_mng 테이블에 존재하지 않는 컬럼 INSERT 방지
- "column does not exist" PostgreSQL 에러 해결

영향: 수주관리 그룹 편집 저장 정상 동작
This commit is contained in:
SeongHyun Kim 2025-11-24 15:38:41 +09:00
parent 3e414b8530
commit 2f3d5f993a
3 changed files with 35 additions and 24 deletions

View File

@ -496,16 +496,27 @@ export class DynamicFormService {
for (const repeater of mergedRepeaterData) {
for (const item of repeater.data) {
// 헤더 + 품목을 병합
const mergedData = { ...dataToInsert, ...item };
const rawMergedData = { ...dataToInsert, ...item };
// 타입 변환
Object.keys(mergedData).forEach((columnName) => {
const column = columnInfo.find((col) => col.column_name === columnName);
if (column) {
mergedData[columnName] = this.convertValueForPostgreSQL(
mergedData[columnName],
column.data_type
);
// 🆕 실제 테이블 컬럼만 필터링 (조인/계산 컬럼 제외)
const validColumnNames = columnInfo.map((col) => col.column_name);
const mergedData: Record<string, any> = {};
Object.keys(rawMergedData).forEach((columnName) => {
// 실제 테이블 컬럼인지 확인
if (validColumnNames.includes(columnName)) {
const column = columnInfo.find((col) => col.column_name === columnName);
if (column) {
// 타입 변환
mergedData[columnName] = this.convertValueForPostgreSQL(
rawMergedData[columnName],
column.data_type
);
} else {
mergedData[columnName] = rawMergedData[columnName];
}
} else {
console.log(`⚠️ 조인/계산 컬럼 제외: ${columnName} (값: ${rawMergedData[columnName]})`);
}
});

View File

@ -323,7 +323,7 @@ export const EditModal: React.FC<EditModalProps> = ({ className }) => {
continue;
}
// 변경된 필드만 추출
// 변경된 필드만 추출
const changedData: Record<string, any> = {};
// 🆕 sales_order_mng 테이블의 실제 컬럼만 포함 (조인된 컬럼 제외)
@ -572,10 +572,10 @@ export const EditModal: React.FC<EditModalProps> = ({ className }) => {
);
}
} else {
setFormData((prev) => ({
...prev,
[fieldName]: value,
}));
setFormData((prev) => ({
...prev,
[fieldName]: value,
}));
}
}}
screenInfo={{

View File

@ -142,7 +142,7 @@ export function ConditionalSectionViewer({
return (
<div
key={component.id}
key={component.id}
className="absolute"
style={{
left: position.x || 0,
@ -153,17 +153,17 @@ export function ConditionalSectionViewer({
}}
>
<DynamicComponentRenderer
component={component}
component={component}
isInteractive={true}
screenId={screenInfo?.id}
tableName={screenInfo?.tableName}
userId={userId}
userName={userName}
companyCode={user?.companyCode}
formData={formData}
onFormDataChange={onFormDataChange}
screenId={screenInfo?.id}
tableName={screenInfo?.tableName}
userId={userId}
userName={userName}
companyCode={user?.companyCode}
formData={formData}
onFormDataChange={onFormDataChange}
groupedData={groupedData}
/>
/>
</div>
);
})}