diff --git a/frontend/app/(main)/admin/systemMng/tableMngList/page.tsx b/frontend/app/(main)/admin/systemMng/tableMngList/page.tsx index 73e5d282..17c52897 100644 --- a/frontend/app/(main)/admin/systemMng/tableMngList/page.tsx +++ b/frontend/app/(main)/admin/systemMng/tableMngList/page.tsx @@ -773,18 +773,81 @@ export default function TableManagementPage() { // 2. 모든 컬럼 설정 저장 if (columns.length > 0) { - const columnSettings = columns.map((column) => ({ - columnName: column.columnName, // 실제 DB 컬럼명 (변경 불가) - columnLabel: column.displayName, // 사용자가 입력한 표시명 - inputType: column.inputType || "text", - detailSettings: column.detailSettings || "", - description: column.description || "", - codeCategory: column.codeCategory || "", - codeValue: column.codeValue || "", - referenceTable: column.referenceTable || "", - referenceColumn: column.referenceColumn || "", - displayColumn: column.displayColumn || "", // 🎯 Entity 조인에서 표시할 컬럼명 - })); + const columnSettings = columns.map((column) => { + // detailSettings 계산 + let finalDetailSettings = column.detailSettings || ""; + + // 🆕 Numbering 타입인 경우 numberingRuleId를 detailSettings에 포함 + if (column.inputType === "numbering" && column.numberingRuleId) { + let existingSettings: Record = {}; + if (typeof finalDetailSettings === "string" && finalDetailSettings.trim().startsWith("{")) { + try { + existingSettings = JSON.parse(finalDetailSettings); + } catch { + existingSettings = {}; + } + } + const numberingSettings = { + ...existingSettings, + numberingRuleId: column.numberingRuleId, + }; + finalDetailSettings = JSON.stringify(numberingSettings); + console.log("🔧 전체저장 - Numbering 설정 JSON 생성:", { + columnName: column.columnName, + numberingRuleId: column.numberingRuleId, + finalDetailSettings, + }); + } + + // 🆕 Entity 타입인 경우 detailSettings에 엔티티 설정 포함 + if (column.inputType === "entity" && column.referenceTable) { + let existingSettings: Record = {}; + if (typeof finalDetailSettings === "string" && finalDetailSettings.trim().startsWith("{")) { + try { + existingSettings = JSON.parse(finalDetailSettings); + } catch { + existingSettings = {}; + } + } + const entitySettings = { + ...existingSettings, + entityTable: column.referenceTable, + entityCodeColumn: column.referenceColumn || "id", + entityLabelColumn: column.displayColumn || "name", + }; + finalDetailSettings = JSON.stringify(entitySettings); + } + + // 🆕 Code 타입인 경우 hierarchyRole을 detailSettings에 포함 + if (column.inputType === "code" && column.hierarchyRole) { + let existingSettings: Record = {}; + if (typeof finalDetailSettings === "string" && finalDetailSettings.trim().startsWith("{")) { + try { + existingSettings = JSON.parse(finalDetailSettings); + } catch { + existingSettings = {}; + } + } + const codeSettings = { + ...existingSettings, + hierarchyRole: column.hierarchyRole, + }; + finalDetailSettings = JSON.stringify(codeSettings); + } + + return { + columnName: column.columnName, // 실제 DB 컬럼명 (변경 불가) + columnLabel: column.displayName, // 사용자가 입력한 표시명 + inputType: column.inputType || "text", + detailSettings: finalDetailSettings, + description: column.description || "", + codeCategory: column.codeCategory || "", + codeValue: column.codeValue || "", + referenceTable: column.referenceTable || "", + referenceColumn: column.referenceColumn || "", + displayColumn: column.displayColumn || "", // 🎯 Entity 조인에서 표시할 컬럼명 + }; + }); // console.log("저장할 전체 설정:", { tableLabel, tableDescription, columnSettings }); diff --git a/frontend/components/screen/widgets/types/ImageWidget.tsx b/frontend/components/screen/widgets/types/ImageWidget.tsx index 5c81ca9c..fdcb1f27 100644 --- a/frontend/components/screen/widgets/types/ImageWidget.tsx +++ b/frontend/components/screen/widgets/types/ImageWidget.tsx @@ -9,15 +9,17 @@ import { WidgetComponent } from "@/types/screen"; import { toast } from "sonner"; import { apiClient, getFullImageUrl } from "@/lib/api/client"; -export const ImageWidget: React.FC = ({ +export const ImageWidget: React.FC = ({ component, value, onChange, readonly = false, - isDesignMode = false // 디자인 모드 여부 + isDesignMode = false, // 디자인 모드 여부 + size, // props로 전달된 size + style: propStyle, // props로 전달된 style }) => { const widget = component as WidgetComponent; - const { required, style } = widget; + const { required, style: widgetStyle } = widget; const fileInputRef = useRef(null); const [uploading, setUploading] = useState(false); @@ -25,8 +27,16 @@ export const ImageWidget: React.FC = ({ const rawImageUrl = value || widget.value || ""; const imageUrl = rawImageUrl ? getFullImageUrl(rawImageUrl) : ""; - // style에서 width, height 제거 (부모 컨테이너 크기 사용) - const filteredStyle = style ? { ...style, width: undefined, height: undefined } : {}; + // 🔧 컴포넌트 크기를 명시적으로 적용 (props.size 우선, 없으면 style에서 가져옴) + const effectiveSize = size || (widget as any).size || {}; + const effectiveStyle = propStyle || widgetStyle || {}; + const containerStyle: React.CSSProperties = { + width: effectiveSize.width ? `${effectiveSize.width}px` : effectiveStyle?.width || "100%", + height: effectiveSize.height ? `${effectiveSize.height}px` : effectiveStyle?.height || "100%", + }; + + // style에서 width, height 제거 (내부 요소용) + const filteredStyle = effectiveStyle ? { ...effectiveStyle, width: undefined, height: undefined } : {}; // 파일 선택 처리 const handleFileSelect = () => { @@ -120,11 +130,11 @@ export const ImageWidget: React.FC = ({ }; return ( -
+
{imageUrl ? ( // 이미지 표시 모드
= ({ ) : ( // 업로드 영역
((props, ref) => // formData 추출 (채번규칙 날짜 컬럼 기준 생성 시 사용) const formData = (props as any).formData || {}; const columnName = (props as any).columnName; + // onFormDataChange 추출 (채번 규칙 ID를 formData에 저장하기 위함) + const onFormDataChange = (props as any).onFormDataChange; // config가 없으면 기본값 사용 const config = (configProp || { type: "text" }) as V2InputConfig & { @@ -526,6 +528,15 @@ export const V2Input = forwardRef((props, ref) => try { const parsed = JSON.parse(targetColumn.detailSettings); numberingRuleIdRef.current = parsed.numberingRuleId || null; + + // 🆕 채번 규칙 ID를 formData에 저장 (저장 시 allocateCode 호출을 위해) + if (parsed.numberingRuleId && onFormDataChange && columnName) { + onFormDataChange(`${columnName}_numberingRuleId`, parsed.numberingRuleId); + console.log("🔧 채번 규칙 ID를 formData에 저장:", { + key: `${columnName}_numberingRuleId`, + value: parsed.numberingRuleId, + }); + } } catch { // JSON 파싱 실패 } diff --git a/frontend/components/v2/V2Media.tsx b/frontend/components/v2/V2Media.tsx index 71553651..f7359962 100644 --- a/frontend/components/v2/V2Media.tsx +++ b/frontend/components/v2/V2Media.tsx @@ -305,19 +305,19 @@ const ImageUploader = forwardRef +
{/* 이미지 미리보기 */} {preview && images.length > 0 && (
{images.map((src, index) => ( -
+
{`이미지