Merge remote-tracking branch 'origin/main' into ksh
This commit is contained in:
commit
e747162058
|
|
@ -5931,6 +5931,69 @@ export class ButtonActionExecutor {
|
|||
return false;
|
||||
}
|
||||
|
||||
// ✅ allComponents가 있으면 기존 필수 항목 검증 수행
|
||||
if (context.allComponents && context.allComponents.length > 0) {
|
||||
console.log("🔍 [handleQuickInsert] 필수 항목 검증 시작:", {
|
||||
hasAllComponents: !!context.allComponents,
|
||||
allComponentsLength: context.allComponents?.length || 0,
|
||||
});
|
||||
const requiredValidation = this.validateRequiredFields(context);
|
||||
if (!requiredValidation.isValid) {
|
||||
console.log("❌ [handleQuickInsert] 필수 항목 누락:", requiredValidation.missingFields);
|
||||
toast.error(`필수 항목을 입력해주세요: ${requiredValidation.missingFields.join(", ")}`);
|
||||
return false;
|
||||
}
|
||||
console.log("✅ [handleQuickInsert] 필수 항목 검증 통과");
|
||||
}
|
||||
|
||||
// ✅ quickInsert 전용 검증: component 타입 매핑에서 값이 비어있는지 확인
|
||||
const mappingsForValidation = quickInsertConfig.columnMappings || [];
|
||||
const missingMappingFields: string[] = [];
|
||||
|
||||
for (const mapping of mappingsForValidation) {
|
||||
// component 타입 매핑은 필수 입력으로 간주
|
||||
if (mapping.sourceType === "component" && mapping.sourceComponentId) {
|
||||
let value: any = undefined;
|
||||
|
||||
// 값 가져오기 (formData에서)
|
||||
if (mapping.sourceColumnName) {
|
||||
value = context.formData?.[mapping.sourceColumnName];
|
||||
}
|
||||
if (value === undefined || value === null) {
|
||||
value = context.formData?.[mapping.sourceComponentId];
|
||||
}
|
||||
// allComponents에서 컴포넌트 찾아서 columnName으로 시도
|
||||
if ((value === undefined || value === null) && context.allComponents) {
|
||||
const comp = context.allComponents.find((c: any) => c.id === mapping.sourceComponentId);
|
||||
if (comp?.columnName) {
|
||||
value = context.formData?.[comp.columnName];
|
||||
}
|
||||
}
|
||||
// targetColumn으로 폴백
|
||||
if ((value === undefined || value === null) && mapping.targetColumn) {
|
||||
value = context.formData?.[mapping.targetColumn];
|
||||
}
|
||||
|
||||
// 값이 비어있으면 필수 누락으로 처리
|
||||
if (value === undefined || value === null || (typeof value === "string" && value.trim() === "")) {
|
||||
console.log("❌ [handleQuickInsert] component 매핑 값 누락:", {
|
||||
targetColumn: mapping.targetColumn,
|
||||
sourceComponentId: mapping.sourceComponentId,
|
||||
sourceColumnName: mapping.sourceColumnName,
|
||||
value,
|
||||
});
|
||||
missingMappingFields.push(mapping.targetColumn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (missingMappingFields.length > 0) {
|
||||
console.log("❌ [handleQuickInsert] 필수 입력 항목 누락:", missingMappingFields);
|
||||
toast.error(`다음 항목을 입력해주세요: ${missingMappingFields.join(", ")}`);
|
||||
return false;
|
||||
}
|
||||
console.log("✅ [handleQuickInsert] quickInsert 매핑 검증 통과");
|
||||
|
||||
const { formData, splitPanelContext, userId, userName, companyCode } = context;
|
||||
|
||||
console.log("⚡ Quick Insert 상세 정보:", {
|
||||
|
|
|
|||
Loading…
Reference in New Issue