feat: Enhance mold management functionality
- Added new `updateMoldSerial` API endpoint for updating mold serial details. - Modified existing mold-related SQL queries to include `id` and `created_date` fields. - Updated frontend to handle mold serial updates and image uploads. - Improved subcontractor management table with additional fields and rendering logic. This update improves the overall functionality and user experience in managing molds and subcontractors.
This commit is contained in:
@@ -34,14 +34,16 @@ export function useTableSettings<T extends { key: string }>(
|
||||
settingsId: string,
|
||||
tableName: string,
|
||||
defaultColumns: T[],
|
||||
/** 초기 표시 컬럼 키 (미지정 시 defaultColumns 전체) */
|
||||
initialVisibleKeys?: string[],
|
||||
) {
|
||||
const [open, setOpen] = useState(false);
|
||||
const [visibleKeys, setVisibleKeys] = useState<Set<string>>(
|
||||
() => new Set(defaultColumns.map((c) => c.key)),
|
||||
() => new Set(initialVisibleKeys || defaultColumns.map((c) => c.key)),
|
||||
);
|
||||
const [columnWidths, setColumnWidths] = useState<Record<string, number>>({});
|
||||
const [orderedKeys, setOrderedKeys] = useState<string[]>(
|
||||
() => defaultColumns.map((c) => c.key),
|
||||
() => initialVisibleKeys || defaultColumns.map((c) => c.key),
|
||||
);
|
||||
// 초기 filterConfig: GRID_COLUMNS에 있는 컬럼만 필터 가능 (전부 비활성)
|
||||
const [filterConfig, setFilterConfig] = useState<TableSettings["filters"]>(
|
||||
@@ -70,9 +72,12 @@ export function useTableSettings<T extends { key: string }>(
|
||||
}
|
||||
}
|
||||
|
||||
// settings에 없는 새 컬럼은 보이도록 추가
|
||||
// settings에 없는 새 컬럼은 초기 표시 목록에 있을 때만 보이도록 추가
|
||||
const initKeys = initialVisibleKeys
|
||||
? new Set(initialVisibleKeys)
|
||||
: new Set(defaultColumns.map((c) => c.key));
|
||||
for (const col of defaultColumns) {
|
||||
if (!settings.columns.find((c) => c.columnName === col.key)) {
|
||||
if (!settings.columns.find((c) => c.columnName === col.key) && initKeys.has(col.key)) {
|
||||
visible.add(col.key);
|
||||
order.push(col.key);
|
||||
}
|
||||
@@ -87,7 +92,7 @@ export function useTableSettings<T extends { key: string }>(
|
||||
settings.filters?.filter((f) => visible.has(f.columnName)),
|
||||
);
|
||||
},
|
||||
[defaultColumns],
|
||||
[defaultColumns, initialVisibleKeys],
|
||||
);
|
||||
|
||||
// 마운트 시 저장된 설정 복원
|
||||
@@ -148,6 +153,6 @@ export function useTableSettings<T extends { key: string }>(
|
||||
/** 필터 설정 */
|
||||
filterConfig,
|
||||
/** GRID_COLUMNS 기본 컬럼 키 목록 (TableSettingsModal defaultVisibleKeys용) */
|
||||
defaultVisibleKeys: defaultColumns.map((c) => c.key),
|
||||
defaultVisibleKeys: initialVisibleKeys || defaultColumns.map((c) => c.key),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user