Compare commits
2 Commits
147d187901
...
7039cca1cf
| Author | SHA1 | Date |
|---|---|---|
|
|
7039cca1cf | |
|
|
447bf937de |
|
|
@ -1418,7 +1418,7 @@ export const SplitPanelLayoutComponent: React.FC<SplitPanelLayoutComponentProps>
|
||||||
|
|
||||||
// 수정 버튼 핸들러
|
// 수정 버튼 핸들러
|
||||||
const handleEditClick = useCallback(
|
const handleEditClick = useCallback(
|
||||||
(panel: "left" | "right", item: any) => {
|
async (panel: "left" | "right", item: any) => {
|
||||||
// 🆕 우측 패널 수정 버튼 설정 확인
|
// 🆕 우측 패널 수정 버튼 설정 확인
|
||||||
if (panel === "right" && componentConfig.rightPanel?.editButton?.mode === "modal") {
|
if (panel === "right" && componentConfig.rightPanel?.editButton?.mode === "modal") {
|
||||||
const modalScreenId = componentConfig.rightPanel?.editButton?.modalScreenId;
|
const modalScreenId = componentConfig.rightPanel?.editButton?.modalScreenId;
|
||||||
|
|
@ -1427,18 +1427,40 @@ export const SplitPanelLayoutComponent: React.FC<SplitPanelLayoutComponentProps>
|
||||||
// 커스텀 모달 화면 열기
|
// 커스텀 모달 화면 열기
|
||||||
const rightTableName = componentConfig.rightPanel?.tableName || "";
|
const rightTableName = componentConfig.rightPanel?.tableName || "";
|
||||||
|
|
||||||
// Primary Key 찾기 (우선순위: id > ID > 첫 번째 필드)
|
// Primary Key 찾기: 테이블 메타데이터에서 실제 PK 컬럼 조회
|
||||||
let primaryKeyName = "id";
|
let primaryKeyName = "id";
|
||||||
let primaryKeyValue: any;
|
let primaryKeyValue: any;
|
||||||
|
|
||||||
if (item.id !== undefined && item.id !== null) {
|
// 1. 테이블 컬럼 메타데이터에서 실제 PK 찾기
|
||||||
|
let pkColumn = rightTableColumns.find(
|
||||||
|
(col) => col.isPrimaryKey === true || col.is_primary_key === true || col.is_primary_key === "YES"
|
||||||
|
);
|
||||||
|
|
||||||
|
// 2. rightTableColumns가 비어있으면 API로 직접 조회
|
||||||
|
if (!pkColumn && rightTableColumns.length === 0 && rightTableName) {
|
||||||
|
try {
|
||||||
|
const columnsResponse = await tableTypeApi.getColumns(rightTableName);
|
||||||
|
pkColumn = columnsResponse?.find(
|
||||||
|
(col: any) => col.isPrimaryKey === true || col.is_primary_key === true || col.is_primary_key === "YES"
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("PK 컬럼 조회 실패:", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pkColumn) {
|
||||||
|
const pkName = pkColumn.columnName || pkColumn.column_name;
|
||||||
|
primaryKeyName = pkName;
|
||||||
|
primaryKeyValue = item[pkName];
|
||||||
|
} else if (item.id !== undefined && item.id !== null) {
|
||||||
|
// 3. 폴백: id 컬럼
|
||||||
primaryKeyName = "id";
|
primaryKeyName = "id";
|
||||||
primaryKeyValue = item.id;
|
primaryKeyValue = item.id;
|
||||||
} else if (item.ID !== undefined && item.ID !== null) {
|
} else if (item.ID !== undefined && item.ID !== null) {
|
||||||
primaryKeyName = "ID";
|
primaryKeyName = "ID";
|
||||||
primaryKeyValue = item.ID;
|
primaryKeyValue = item.ID;
|
||||||
} else {
|
} else {
|
||||||
// 첫 번째 필드를 Primary Key로 간주
|
// 4. 최후의 폴백: 첫 번째 필드
|
||||||
const firstKey = Object.keys(item)[0];
|
const firstKey = Object.keys(item)[0];
|
||||||
primaryKeyName = firstKey;
|
primaryKeyName = firstKey;
|
||||||
primaryKeyValue = item[firstKey];
|
primaryKeyValue = item[firstKey];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue