Compare commits

...

4 Commits

Author SHA1 Message Date
SeongHyun Kim e14e0bd029 Merge remote-tracking branch 'origin/main' into ksh 2026-01-21 18:07:28 +09:00
hjlee c3379ec4c2 Merge pull request 'lhj' (#376) from lhj into main
Reviewed-on: http://39.117.244.52:3000/kjs/ERP-node/pulls/376
2026-01-21 17:15:47 +09:00
SeongHyun Kim 3fd7fdcb58 fix(backend): 테이블 설정 변경 시 screen_layouts의 webType 동기화 누락 수정
테이블 설정에서 input_type을 변경할 때 screen_layouts의
componentConfig.webType이 업데이트되지 않는 버그 수정

문제:
- syncScreenLayoutsInputType 함수에서 widgetType, inputType은 업데이트하지만
  componentConfig.webType은 누락되어 기존 값(예: "text")이 유지됨
- 프론트엔드 SelectBasicComponent는 webType을 기준으로 카테고리 로딩 여부를
  판단하므로, input_type을 category로 변경해도 옵션이 표시되지 않음

수정:
- componentConfig 업데이트 시 webType도 inputType과 동일하게 설정
- 로그 메시지에 webType 정보 추가

품목정보에서 동일하게 발생하는 문제
화면 레이아웃(screen_layouts)의 componentConfig.webType이 text로 설정되어 있어서 카테고리 API를 호출하지 않습니다
2026-01-21 16:47:40 +09:00
SeongHyun Kim 055094308d feat: 모달에서 카테고리 조회 시 menuObjid 전달 기능 추가
카테고리 값을 메뉴별로 다르게 설정할 수 있도록 menuObjid를 모달 체인 전체에 전달합니다.

변경 내용:
- InteractiveDataTable: 등록/수정 모달 열 때 menuObjid를 이벤트에 포함
- EditModal: menuObjid를 state에 저장하고 하위 컴포넌트에 전달
- SaveModal: menuObjid props를 받아서 DynamicComponentRenderer에 전달
- SelectBasicComponent: getCategoryValues API 호출 시 menuObjid 파라미터 전달

이를 통해 같은 테이블/컬럼이라도 메뉴에 따라 다른 카테고리 옵션을 표시할 수 있습니다.

카테고리 API를 호출할 때 menuObjid를 전달하여 메뉴별 필터링 적용 가능하게 변경
2026-01-21 16:42:11 +09:00
5 changed files with 21 additions and 6 deletions

View File

@ -921,11 +921,12 @@ export class TableManagementService {
...layout.properties,
widgetType: inputType,
inputType: inputType,
// componentConfig 내부의 type 업데이트
// componentConfig 내부의 type, inputType, webType 모두 업데이트
componentConfig: {
...layout.properties?.componentConfig,
type: newComponentType,
inputType: inputType,
webType: inputType, // 프론트엔드 SelectBasicComponent에서 카테고리 로딩 여부 판단에 사용
},
};
@ -941,7 +942,7 @@ export class TableManagementService {
);
logger.info(
`화면 레이아웃 업데이트: screen_id=${layout.screen_id}, component_id=${layout.component_id}, widgetType=${inputType}, componentType=${newComponentType}`
`화면 레이아웃 업데이트: screen_id=${layout.screen_id}, component_id=${layout.component_id}, widgetType=${inputType}, webType=${inputType}, componentType=${newComponentType}`
);
}

View File

@ -33,6 +33,7 @@ interface EditModalState {
dataflowConfig?: any;
dataflowTiming?: string;
}; // 🆕 모달 내부 저장 버튼의 제어로직 설정
menuObjid?: number; // 🆕 메뉴 OBJID (카테고리 스코프용)
}
interface EditModalProps {
@ -91,6 +92,7 @@ export const EditModal: React.FC<EditModalProps> = ({ className }) => {
buttonConfig: undefined,
buttonContext: undefined,
saveButtonConfig: undefined,
menuObjid: undefined,
});
const [screenData, setScreenData] = useState<{
@ -234,7 +236,7 @@ export const EditModal: React.FC<EditModalProps> = ({ className }) => {
// 전역 모달 이벤트 리스너
useEffect(() => {
const handleOpenEditModal = async (event: CustomEvent) => {
const { screenId, title, description, modalSize, editData, onSave, groupByColumns, tableName, isCreateMode, buttonConfig, buttonContext } = event.detail;
const { screenId, title, description, modalSize, editData, onSave, groupByColumns, tableName, isCreateMode, buttonConfig, buttonContext, menuObjid } = event.detail;
// 🆕 모달 내부 저장 버튼의 제어로직 설정 조회
let saveButtonConfig: EditModalState["saveButtonConfig"] = undefined;
@ -258,6 +260,7 @@ export const EditModal: React.FC<EditModalProps> = ({ className }) => {
buttonConfig, // 🆕 버튼 설정
buttonContext, // 🆕 버튼 컨텍스트
saveButtonConfig, // 🆕 모달 내부 저장 버튼의 제어로직 설정
menuObjid, // 🆕 메뉴 OBJID (카테고리 스코프용)
});
// 편집 데이터로 폼 데이터 초기화
@ -1079,6 +1082,8 @@ export const EditModal: React.FC<EditModalProps> = ({ className }) => {
id: modalState.screenId!,
tableName: screenData.screenInfo?.tableName,
}}
// 🆕 메뉴 OBJID 전달 (카테고리 스코프용)
menuObjid={modalState.menuObjid}
// 🆕 그룹 데이터가 있거나 UniversalFormModal이 없으면 EditModal.handleSave 사용
// groupData가 있으면 일괄 저장을 위해 반드시 EditModal.handleSave 사용
onSave={shouldUseEditModalSave ? handleSave : undefined}

View File

@ -1213,13 +1213,14 @@ export const InteractiveDataTable: React.FC<InteractiveDataTableProps> = ({
description: editModalDescription,
modalSize: "lg",
editData: initialData,
menuObjid, // 🆕 메뉴 OBJID 전달 (카테고리 스코프용)
onSave: () => {
loadData(); // 테이블 데이터 새로고침
},
},
});
window.dispatchEvent(event);
}, [selectedRows, data, getDisplayColumns, component.addModalConfig, component.editModalConfig, loadData]);
}, [selectedRows, data, getDisplayColumns, component.addModalConfig, component.editModalConfig, loadData, menuObjid]);
// 수정 폼 데이터 변경 핸들러
const handleEditFormChange = useCallback((columnName: string, value: any) => {
@ -2720,6 +2721,7 @@ export const InteractiveDataTable: React.FC<InteractiveDataTableProps> = ({
screenId={saveModalScreenId}
modalSize={component.addModalConfig?.modalSize || "lg"}
initialData={saveModalData}
menuObjid={menuObjid} // 🆕 메뉴 OBJID 전달 (카테고리 스코프용)
onSaveSuccess={() => {
// 저장 성공 시 테이블 새로고침
loadData(currentPage, searchValues); // 현재 페이지로 다시 로드

View File

@ -19,6 +19,7 @@ interface SaveModalProps {
modalSize?: "sm" | "md" | "lg" | "xl" | "full";
initialData?: any; // 수정 모드일 때 기존 데이터
onSaveSuccess?: () => void; // 저장 성공 시 콜백 (테이블 새로고침용)
menuObjid?: number; // 🆕 메뉴 OBJID (카테고리 스코프용)
}
/**
@ -33,6 +34,7 @@ export const SaveModal: React.FC<SaveModalProps> = ({
modalSize = "lg",
initialData,
onSaveSuccess,
menuObjid,
}) => {
const { user, userName } = useAuth(); // 현재 사용자 정보 가져오기
const [formData, setFormData] = useState<Record<string, any>>(initialData || {});
@ -373,6 +375,7 @@ export const SaveModal: React.FC<SaveModalProps> = ({
}));
}}
hideLabel={false}
menuObjid={menuObjid} // 🆕 메뉴 OBJID 전달 (카테고리 스코프용)
/>
) : (
<DynamicComponentRenderer
@ -385,6 +388,7 @@ export const SaveModal: React.FC<SaveModalProps> = ({
}}
screenId={screenId}
tableName={screenData.tableName}
menuObjid={menuObjid} // 🆕 메뉴 OBJID 전달 (카테고리 스코프용)
userId={user?.userId} // ✅ 사용자 ID 전달
userName={user?.userName} // ✅ 사용자 이름 전달
companyCode={user?.companyCode} // ✅ 회사 코드 전달

View File

@ -299,12 +299,14 @@ const SelectBasicComponent: React.FC<SelectBasicComponentProps> = ({
tableName: component.tableName,
columnName: component.columnName,
webType,
menuObjid, // 🆕 menuObjid 로깅 추가
});
setIsLoadingCategories(true);
import("@/lib/api/tableCategoryValue").then(({ getCategoryValues }) => {
getCategoryValues(component.tableName!, component.columnName!)
// 🆕 menuObjid를 4번째 파라미터로 전달 (카테고리 스코프 적용)
getCategoryValues(component.tableName!, component.columnName!, false, menuObjid)
.then((response) => {
console.log("🔍 [SelectBasic] 카테고리 API 응답:", response);
@ -324,6 +326,7 @@ const SelectBasicComponent: React.FC<SelectBasicComponentProps> = ({
activeValuesCount: activeValues.length,
options,
sampleOption: options[0],
menuObjid, // 🆕 menuObjid 로깅 추가
});
setCategoryOptions(options);
@ -339,7 +342,7 @@ const SelectBasicComponent: React.FC<SelectBasicComponentProps> = ({
});
});
}
}, [webType, component.tableName, component.columnName]);
}, [webType, component.tableName, component.columnName, menuObjid]); // 🆕 menuObjid 의존성 추가
// 디버깅: menuObjid가 제대로 전달되는지 확인
useEffect(() => {