From 76f6bd7f276090d8a633b0c779f4e50715b40025 Mon Sep 17 00:00:00 2001 From: leeheejin Date: Fri, 12 Dec 2025 15:45:57 +0900 Subject: [PATCH] =?UTF-8?q?=EC=84=A4=EC=A0=95=EB=93=A4=20=EA=B3=A0?= =?UTF-8?q?=EC=B9=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/components/admin/dashboard/types.ts | 2 + .../widget-sections/ListWidgetSection.tsx | 367 +++++++++++++----- .../admin/dashboard/widgets/ListWidget.tsx | 90 ++++- .../dashboard/widgets/ListTestWidget.tsx | 92 ++++- .../dashboard/widgets/MapTestWidgetV2.tsx | 20 +- 5 files changed, 433 insertions(+), 138 deletions(-) diff --git a/frontend/components/admin/dashboard/types.ts b/frontend/components/admin/dashboard/types.ts index 51f3bf7b..31287e1e 100644 --- a/frontend/components/admin/dashboard/types.ts +++ b/frontend/components/admin/dashboard/types.ts @@ -390,9 +390,11 @@ export interface RowDetailPopupConfig { // 추가 데이터 조회 설정 additionalQuery?: { enabled: boolean; + queryMode?: "table" | "custom"; // 조회 모드: table(테이블 조회), custom(커스텀 쿼리) tableName: string; // 조회할 테이블명 (예: vehicles) matchColumn: string; // 매칭할 컬럼 (예: id) sourceColumn?: string; // 클릭한 행에서 가져올 컬럼 (기본: matchColumn과 동일) + customQuery?: string; // 커스텀 쿼리 ({id}, {vehicle_number} 등 파라미터 사용) // 팝업에 표시할 컬럼 목록 (비어있으면 전체 표시) displayColumns?: DisplayColumnConfig[]; }; diff --git a/frontend/components/admin/dashboard/widget-sections/ListWidgetSection.tsx b/frontend/components/admin/dashboard/widget-sections/ListWidgetSection.tsx index b10057cf..a7186d50 100644 --- a/frontend/components/admin/dashboard/widget-sections/ListWidgetSection.tsx +++ b/frontend/components/admin/dashboard/widget-sections/ListWidgetSection.tsx @@ -158,7 +158,7 @@ export function ListWidgetSection({ queryResult, config, onConfigChange }: ListW checked={popupConfig.additionalQuery?.enabled || false} onCheckedChange={(enabled) => updatePopupConfig({ - additionalQuery: { ...popupConfig.additionalQuery, enabled, tableName: "", matchColumn: "" }, + additionalQuery: { ...popupConfig.additionalQuery, enabled, queryMode: "table", tableName: "", matchColumn: "" }, }) } aria-label="추가 데이터 조회 활성화" @@ -167,116 +167,230 @@ export function ListWidgetSection({ queryResult, config, onConfigChange }: ListW {popupConfig.additionalQuery?.enabled && (
+ {/* 조회 모드 선택 */}
- - + + - updatePopupConfig({ - additionalQuery: { ...popupConfig.additionalQuery!, matchColumn: e.target.value }, - }) - } - placeholder="id" - className="mt-1 h-8 text-xs" - /> -
-
- - - updatePopupConfig({ - additionalQuery: { ...popupConfig.additionalQuery!, sourceColumn: e.target.value }, - }) - } - placeholder="비워두면 매칭 컬럼과 동일" - className="mt-1 h-8 text-xs" - /> + > + + + + + 테이블 조회 + 커스텀 쿼리 + +
- {/* 표시할 컬럼 선택 (다중 선택 + 라벨 편집) */} + {/* 테이블 조회 모드 */} + {(popupConfig.additionalQuery?.queryMode || "table") === "table" && ( + <> +
+ + + updatePopupConfig({ + additionalQuery: { ...popupConfig.additionalQuery!, tableName: e.target.value }, + }) + } + placeholder="vehicles" + className="mt-1 h-8 text-xs" + /> +
+
+ + + updatePopupConfig({ + additionalQuery: { ...popupConfig.additionalQuery!, matchColumn: e.target.value }, + }) + } + placeholder="id" + className="mt-1 h-8 text-xs" + /> +
+
+ + + updatePopupConfig({ + additionalQuery: { ...popupConfig.additionalQuery!, sourceColumn: e.target.value }, + }) + } + placeholder="비워두면 매칭 컬럼과 동일" + className="mt-1 h-8 text-xs" + /> +
+ + )} + + {/* 커스텀 쿼리 모드 */} + {popupConfig.additionalQuery?.queryMode === "custom" && ( + <> +
+ + + updatePopupConfig({ + additionalQuery: { ...popupConfig.additionalQuery!, sourceColumn: e.target.value }, + }) + } + placeholder="id" + className="mt-1 h-8 text-xs" + /> +

쿼리에서 사용할 파라미터 컬럼

+
+
+ +