Compare commits

..

No commits in common. "65e1c1a9958c452576bef9582691fb8567f91c99" and "583c6c8c79097e7e2ad31c5e1b8c0e0d85a178fa" have entirely different histories.

1 changed files with 30 additions and 9 deletions

View File

@ -1451,8 +1451,27 @@ export const SplitPanelLayoutComponent: React.FC<SplitPanelLayoutComponentProps>
// 커스텀 모달 화면 열기 // 커스텀 모달 화면 열기
const rightTableName = componentConfig.rightPanel?.tableName || ""; const rightTableName = componentConfig.rightPanel?.tableName || "";
// Primary Key 찾기 (우선순위: id > ID > 첫 번째 필드)
let primaryKeyName = "id";
let primaryKeyValue: any;
if (item.id !== undefined && item.id !== null) {
primaryKeyName = "id";
primaryKeyValue = item.id;
} else if (item.ID !== undefined && item.ID !== null) {
primaryKeyName = "ID";
primaryKeyValue = item.ID;
} else {
// 첫 번째 필드를 Primary Key로 간주
const firstKey = Object.keys(item)[0];
primaryKeyName = firstKey;
primaryKeyValue = item[firstKey];
}
console.log("✅ 수정 모달 열기:", { console.log("✅ 수정 모달 열기:", {
tableName: rightTableName, tableName: rightTableName,
primaryKeyName,
primaryKeyValue,
screenId: modalScreenId, screenId: modalScreenId,
fullItem: item, fullItem: item,
}); });
@ -1471,25 +1490,27 @@ export const SplitPanelLayoutComponent: React.FC<SplitPanelLayoutComponentProps>
hasGroupByColumns: groupByColumns.length > 0, hasGroupByColumns: groupByColumns.length > 0,
}); });
// 🔧 수정: URL 파라미터 대신 editData로 직접 전달 // ScreenModal 열기 이벤트 발생 (URL 파라미터로 ID + groupByColumns 전달)
// 이렇게 하면 테이블의 Primary Key가 무엇이든 상관없이 데이터가 정확히 전달됨
window.dispatchEvent( window.dispatchEvent(
new CustomEvent("openScreenModal", { new CustomEvent("openScreenModal", {
detail: { detail: {
screenId: modalScreenId, screenId: modalScreenId,
editData: item, // 전체 데이터를 직접 전달
...(groupByColumns.length > 0 && {
urlParams: { urlParams: {
mode: "edit",
editId: primaryKeyValue,
tableName: rightTableName,
...(groupByColumns.length > 0 && {
groupByColumns: JSON.stringify(groupByColumns), groupByColumns: JSON.stringify(groupByColumns),
},
}), }),
}, },
},
}), }),
); );
console.log("✅ [SplitPanel] openScreenModal 이벤트 발생 (editData 직접 전달):", { console.log("✅ [SplitPanel] openScreenModal 이벤트 발생:", {
screenId: modalScreenId, screenId: modalScreenId,
editData: item, editId: primaryKeyValue,
tableName: rightTableName,
groupByColumns: groupByColumns.length > 0 ? JSON.stringify(groupByColumns) : "없음", groupByColumns: groupByColumns.length > 0 ? JSON.stringify(groupByColumns) : "없음",
}); });