삭제버튼 제어 동작하지 않던 오류 수정

This commit is contained in:
kjs
2026-01-09 13:43:14 +09:00
parent 80cf20e142
commit ee3a648917
9 changed files with 400 additions and 116 deletions

View File

@@ -1192,12 +1192,18 @@ export class DynamicFormService {
/**
* 폼 데이터 삭제 (실제 테이블에서 직접 삭제)
* @param id 삭제할 레코드 ID
* @param tableName 테이블명
* @param companyCode 회사 코드
* @param userId 사용자 ID
* @param screenId 화면 ID (제어관리 실행용, 선택사항)
*/
async deleteFormData(
id: string | number,
tableName: string,
companyCode?: string,
userId?: string
userId?: string,
screenId?: number
): Promise<void> {
try {
console.log("🗑️ 서비스: 실제 테이블에서 폼 데이터 삭제 시작:", {
@@ -1310,14 +1316,19 @@ export class DynamicFormService {
const recordCompanyCode =
deletedRecord?.company_code || companyCode || "*";
await this.executeDataflowControlIfConfigured(
0, // DELETE는 screenId를 알 수 없으므로 0으로 설정 (추후 개선 필요)
tableName,
deletedRecord,
"delete",
userId || "system",
recordCompanyCode
);
// screenId가 전달되지 않으면 제어관리를 실행하지 않음
if (screenId && screenId > 0) {
await this.executeDataflowControlIfConfigured(
screenId,
tableName,
deletedRecord,
"delete",
userId || "system",
recordCompanyCode
);
} else {
console.log(" screenId가 전달되지 않아 제어관리를 건너뜁니다. (screenId:", screenId, ")");
}
}
} catch (controlError) {
console.error("⚠️ 제어관리 실행 오류:", controlError);
@@ -1662,10 +1673,16 @@ export class DynamicFormService {
!!properties?.webTypeConfig?.dataflowConfig?.flowControls,
});
// 버튼 컴포넌트이고 저장 액션이며 제어관리가 활성화된 경우
// 버튼 컴포넌트이고 제어관리가 활성화된 경우
// triggerType에 맞는 액션 타입 매칭: insert/update -> save, delete -> delete
const buttonActionType = properties?.componentConfig?.action?.type;
const isMatchingAction =
(triggerType === "delete" && buttonActionType === "delete") ||
((triggerType === "insert" || triggerType === "update") && buttonActionType === "save");
if (
properties?.componentType === "button-primary" &&
properties?.componentConfig?.action?.type === "save" &&
isMatchingAction &&
properties?.webTypeConfig?.enableDataflowControl === true
) {
const dataflowConfig = properties?.webTypeConfig?.dataflowConfig;