jskim-node #420

Merged
kjs merged 16 commits from jskim-node into main 2026-03-17 21:09:11 +09:00
1 changed files with 36 additions and 43 deletions
Showing only changes of commit 837e0aca41 - Show all commits

View File

@ -1707,71 +1707,66 @@ export class DynamicFormService {
try {
console.log(`🎯 제어관리 설정 확인 중... (screenId: ${screenId})`);
// 화면의 저장 버튼에서 제어관리 설정 조회
const screenLayouts = await query<{
component_id: string;
properties: any;
// V2 레이아웃에서 layout_data jsonb 조회
const v2Layouts = await query<{
layout_id: number;
layout_data: any;
}>(
`SELECT component_id, properties
FROM screen_layouts
WHERE screen_id = $1
AND component_type IN ('component', 'v2-button-primary')`,
[screenId]
`SELECT layout_id, layout_data
FROM screen_layouts_v2
WHERE screen_id = $1 AND company_code = $2`,
[screenId, companyCode]
);
console.log(`📋 화면 컴포넌트 조회 결과:`, screenLayouts.length);
if (v2Layouts.length === 0) {
console.log(` V2 레이아웃이 없습니다. (화면 ID: ${screenId}, company: ${companyCode})`);
return;
}
// layout_data.components 배열에서 버튼 컴포넌트 추출
const layoutData = v2Layouts[0].layout_data;
const components: any[] = layoutData?.components || [];
console.log(`📋 V2 컴포넌트 조회 결과: ${components.length}`);
// 저장 버튼 중에서 제어관리가 활성화된 것 찾기
let controlConfigFound = false;
for (const layout of screenLayouts) {
const properties = layout.properties as any;
for (const comp of components) {
const overrides = comp?.overrides || {};
// 디버깅: 모든 컴포넌트 정보 출력
console.log(`🔍 컴포넌트 검사:`, {
componentId: layout.component_id,
componentType: properties?.componentType,
actionType: properties?.componentConfig?.action?.type,
enableDataflowControl:
properties?.webTypeConfig?.enableDataflowControl,
hasDataflowConfig: !!properties?.webTypeConfig?.dataflowConfig,
hasDiagramId:
!!properties?.webTypeConfig?.dataflowConfig?.selectedDiagramId,
hasFlowControls:
!!properties?.webTypeConfig?.dataflowConfig?.flowControls,
});
const isButtonComponent =
overrides?.type === "v2-button-primary" ||
(comp?.url || "").includes("v2-button-primary");
// 버튼 컴포넌트이고 제어관리가 활성화된 경우
// triggerType에 맞는 액션 타입 매칭: insert/update -> save, delete -> delete
const buttonActionType = properties?.componentConfig?.action?.type;
const buttonActionType = overrides?.action?.type;
const isMatchingAction =
(triggerType === "delete" && buttonActionType === "delete") ||
((triggerType === "insert" || triggerType === "update") && buttonActionType === "save");
const isButtonComponent =
properties?.componentType === "button-primary" ||
properties?.componentType === "v2-button-primary";
console.log(`🔍 V2 컴포넌트 검사:`, {
componentId: comp?.id,
type: overrides?.type,
actionType: buttonActionType,
enableDataflowControl: overrides?.enableDataflowControl,
hasDataflowConfig: !!overrides?.dataflowConfig,
});
if (
isButtonComponent &&
isMatchingAction &&
properties?.webTypeConfig?.enableDataflowControl === true
overrides?.enableDataflowControl === true
) {
const dataflowConfig = properties?.webTypeConfig?.dataflowConfig;
// 다중 제어 설정 확인 (flowControls 배열)
const dataflowConfig = overrides?.dataflowConfig;
const flowControls = dataflowConfig?.flowControls || [];
// flowControls가 있으면 다중 제어 실행, 없으면 기존 단일 제어 실행
if (flowControls.length > 0) {
controlConfigFound = true;
console.log(`🎯 다중 제어관리 설정 발견: ${flowControls.length}`);
// 순서대로 정렬
const sortedControls = [...flowControls].sort(
(a: any, b: any) => (a.order || 0) - (b.order || 0)
);
// 다중 제어 순차 실행
await this.executeMultipleFlowControls(
sortedControls,
savedData,
@ -1782,13 +1777,12 @@ export class DynamicFormService {
companyCode
);
} else if (dataflowConfig?.selectedDiagramId) {
// 기존 단일 제어 실행 (하위 호환성)
controlConfigFound = true;
const diagramId = dataflowConfig.selectedDiagramId;
const relationshipId = dataflowConfig.selectedRelationshipId;
console.log(`🎯 단일 제어관리 설정 발견:`, {
componentId: layout.component_id,
componentId: comp?.id,
diagramId,
relationshipId,
triggerType,
@ -1806,7 +1800,6 @@ export class DynamicFormService {
);
}
// 첫 번째 설정된 버튼의 제어관리만 실행
break;
}
}