feat: 코드 컴포넌트에 메뉴 스코프 적용
- useCodeOptions 훅에 menuObjid 파라미터 추가 - commonCodeApi.codes.getList에 menuObjid 전달 - SelectBasicComponent에서 menuObjid 받아서 useCodeOptions로 전달 - InteractiveScreenViewer에서 DynamicWebTypeRenderer로 menuObjid 전달 - 화면 페이지에서 RealtimePreview로 menuObjid 전달 이제 코드 위젯도 카테고리처럼 형제 메뉴별로 격리됩니다.
This commit is contained in:
@@ -51,14 +51,19 @@ export function useTableCodeCategory(tableName?: string, columnName?: string) {
|
||||
}
|
||||
|
||||
// 코드 옵션 조회 (select용)
|
||||
export function useCodeOptions(codeCategory?: string, enabled: boolean = true) {
|
||||
export function useCodeOptions(codeCategory?: string, enabled: boolean = true, menuObjid?: number) {
|
||||
const query = useQuery({
|
||||
queryKey: queryKeys.codes.options(codeCategory || ""),
|
||||
queryKey: menuObjid
|
||||
? [...queryKeys.codes.options(codeCategory || ""), 'menu', menuObjid]
|
||||
: queryKeys.codes.options(codeCategory || ""),
|
||||
queryFn: async () => {
|
||||
if (!codeCategory || codeCategory === "none") return [];
|
||||
|
||||
console.log(`🔍 [React Query] 코드 옵션 조회: ${codeCategory}`);
|
||||
const response = await commonCodeApi.codes.getList(codeCategory, { isActive: true });
|
||||
console.log(`🔍 [React Query] 코드 옵션 조회: ${codeCategory} (menuObjid: ${menuObjid})`);
|
||||
const response = await commonCodeApi.codes.getList(codeCategory, {
|
||||
isActive: true,
|
||||
menuObjid
|
||||
});
|
||||
|
||||
if (response.success && response.data) {
|
||||
const options = response.data.map((code: any) => {
|
||||
@@ -73,7 +78,7 @@ export function useCodeOptions(codeCategory?: string, enabled: boolean = true) {
|
||||
};
|
||||
});
|
||||
|
||||
console.log(`✅ [React Query] 코드 옵션 결과: ${codeCategory} (${options.length}개)`);
|
||||
console.log(`✅ [React Query] 코드 옵션 결과: ${codeCategory} (${options.length}개, menuObjid: ${menuObjid})`);
|
||||
return options;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user