스타일 수정중

This commit is contained in:
kjs
2025-10-30 12:03:50 +09:00
parent 244f04a199
commit 556354219a
28 changed files with 3210 additions and 321 deletions

View File

@@ -35,6 +35,7 @@ export interface ButtonActionConfig {
// 모달/팝업 관련
modalTitle?: string;
modalDescription?: string;
modalSize?: "sm" | "md" | "lg" | "xl";
popupWidth?: number;
popupHeight?: number;
@@ -109,10 +110,10 @@ export class ButtonActionExecutor {
return this.handleNavigate(config, context);
case "modal":
return this.handleModal(config, context);
return await this.handleModal(config, context);
case "edit":
return this.handleEdit(config, context);
return await this.handleEdit(config, context);
case "control":
return this.handleControl(config, context);
@@ -175,14 +176,6 @@ export class ButtonActionExecutor {
// TODO: 실제 테이블에서 기본키로 레코드 존재 여부 확인하는 API 필요
const isUpdate = false; // 현재는 항상 INSERT로 처리
console.log("💾 저장 모드 판단 (DB 기반):", {
tableName,
formData,
primaryKeys,
primaryKeyValue,
isUpdate: isUpdate ? "UPDATE" : "INSERT",
});
let saveResult;
if (isUpdate) {
@@ -208,20 +201,11 @@ export class ButtonActionExecutor {
}
} else {
// INSERT 처리
console.log("🆕 INSERT 모드로 저장:", { formData });
// 🆕 자동으로 작성자 정보 추가
const writerValue = context.userId || context.userName || "unknown";
const companyCodeValue = context.companyCode || "";
console.log("🔍 [buttonActions] 사용자 정보 확인:", {
userId: context.userId,
userName: context.userName,
companyCode: context.companyCode,
writerValue,
companyCodeValue,
});
const dataWithUserInfo = {
...formData,
writer: writerValue,
@@ -230,8 +214,6 @@ export class ButtonActionExecutor {
company_code: companyCodeValue,
};
console.log("🔍 [buttonActions] 저장할 데이터:", dataWithUserInfo);
saveResult = await DynamicFormApi.saveFormData({
screenId,
tableName,
@@ -243,8 +225,6 @@ export class ButtonActionExecutor {
throw new Error(saveResult.message || "저장에 실패했습니다.");
}
console.log("✅ 저장 성공:", saveResult);
// 🔥 저장 성공 후 연결된 제어 실행 (dataflowTiming이 'after'인 경우)
if (config.enableDataflowControl && config.dataflowConfig) {
console.log("🎯 저장 후 제어 실행 시작:", config.dataflowConfig);
@@ -272,7 +252,6 @@ export class ButtonActionExecutor {
*/
private static extractPrimaryKeyValueFromDB(formData: Record<string, any>, primaryKeys: string[]): any {
if (!primaryKeys || primaryKeys.length === 0) {
console.log("🔍 DB에서 기본키를 찾을 수 없습니다. INSERT 모드로 처리됩니다.");
return null;
}
@@ -293,9 +272,6 @@ export class ButtonActionExecutor {
}
// 기본키 컬럼이 formData에 없는 경우
console.log(`❌ 기본키 컬럼 '${primaryKeyColumn}'이 formData에 없습니다. INSERT 모드로 처리됩니다.`);
console.log("📋 DB 기본키 컬럼들:", primaryKeys);
console.log("📋 사용 가능한 필드들:", Object.keys(formData));
return null;
}
@@ -329,8 +305,6 @@ export class ButtonActionExecutor {
}
// 기본 키를 찾지 못한 경우
console.log("🔍 추측 기반으로 기본 키를 찾을 수 없습니다. INSERT 모드로 처리됩니다.");
console.log("📋 사용 가능한 필드들:", Object.keys(formData));
return null;
}
@@ -529,7 +503,7 @@ export class ButtonActionExecutor {
/**
* 모달 액션 처리
*/
private static handleModal(config: ButtonActionConfig, context: ButtonActionContext): boolean {
private static async handleModal(config: ButtonActionConfig, context: ButtonActionContext): Promise<boolean> {
// 모달 열기 로직
console.log("모달 열기:", {
title: config.modalTitle,
@@ -538,11 +512,25 @@ export class ButtonActionExecutor {
});
if (config.targetScreenId) {
// 1. config에 modalDescription이 있으면 우선 사용
let description = config.modalDescription || "";
// 2. config에 없으면 화면 정보에서 가져오기
if (!description) {
try {
const screenInfo = await screenApi.getScreen(config.targetScreenId);
description = screenInfo?.description || "";
} catch (error) {
console.warn("화면 설명을 가져오지 못했습니다:", error);
}
}
// 전역 모달 상태 업데이트를 위한 이벤트 발생
const modalEvent = new CustomEvent("openScreenModal", {
detail: {
screenId: config.targetScreenId,
title: config.modalTitle || "화면",
description: description,
size: config.modalSize || "md",
},
});
@@ -644,7 +632,7 @@ export class ButtonActionExecutor {
/**
* 편집 액션 처리
*/
private static handleEdit(config: ButtonActionConfig, context: ButtonActionContext): boolean {
private static async handleEdit(config: ButtonActionConfig, context: ButtonActionContext): Promise<boolean> {
const { selectedRowsData, flowSelectedData } = context;
// 플로우 선택 데이터 우선 사용
@@ -681,7 +669,7 @@ export class ButtonActionExecutor {
const rowData = dataToEdit[0];
console.log("📝 단일 항목 편집:", rowData);
this.openEditForm(config, rowData, context);
await this.openEditForm(config, rowData, context);
} else {
// 다중 항목 편집 - 현재는 단일 편집만 지원
toast.error("현재 단일 항목 편집만 지원됩니다. 하나의 항목만 선택해주세요.");
@@ -698,13 +686,17 @@ export class ButtonActionExecutor {
/**
* 편집 폼 열기 (단일 항목)
*/
private static openEditForm(config: ButtonActionConfig, rowData: any, context: ButtonActionContext): void {
private static async openEditForm(
config: ButtonActionConfig,
rowData: any,
context: ButtonActionContext,
): Promise<void> {
const editMode = config.editMode || "modal";
switch (editMode) {
case "modal":
// 모달로 편집 폼 열기
this.openEditModal(config, rowData, context);
await this.openEditModal(config, rowData, context);
break;
case "navigate":
@@ -726,17 +718,36 @@ export class ButtonActionExecutor {
/**
* 편집 모달 열기
*/
private static openEditModal(config: ButtonActionConfig, rowData: any, context: ButtonActionContext): void {
private static async openEditModal(
config: ButtonActionConfig,
rowData: any,
context: ButtonActionContext,
): Promise<void> {
console.log("🎭 편집 모달 열기:", {
targetScreenId: config.targetScreenId,
modalSize: config.modalSize,
rowData,
});
// 1. config에 editModalDescription이 있으면 우선 사용
let description = config.editModalDescription || "";
// 2. config에 없으면 화면 정보에서 가져오기
if (!description && config.targetScreenId) {
try {
const screenInfo = await screenApi.getScreen(config.targetScreenId);
description = screenInfo?.description || "";
} catch (error) {
console.warn("화면 설명을 가져오지 못했습니다:", error);
}
}
// 모달 열기 이벤트 발생
const modalEvent = new CustomEvent("openEditModal", {
detail: {
screenId: config.targetScreenId,
title: config.editModalTitle || "데이터 수정",
description: description,
modalSize: config.modalSize || "lg",
editData: rowData,
onSave: () => {