diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-06-13 07:22:04 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-06-13 07:22:04 +0000 |
| commit | 9f3b8915ab20f177edafd3c4a4cc1ca0da0fc766 (patch) | |
| tree | df110ca4a654bc3b3d0bd02b68cba45a25a7c39e /lib/items-tech/table | |
| parent | 0fddf148402fd6b99a1b3800d73679899bcb2ed3 (diff) | |
(최겸) 기술영업 아이템 수정(컬럼명 및 item table FK 삭제, rfq에서 사용하는 service 수정)
Diffstat (limited to 'lib/items-tech/table')
| -rw-r--r-- | lib/items-tech/table/add-items-dialog.tsx | 24 | ||||
| -rw-r--r-- | lib/items-tech/table/hull/import-item-handler.tsx | 10 | ||||
| -rw-r--r-- | lib/items-tech/table/hull/item-excel-template.tsx | 6 | ||||
| -rw-r--r-- | lib/items-tech/table/hull/offshore-hull-table-columns.tsx | 12 | ||||
| -rw-r--r-- | lib/items-tech/table/import-excel-button.tsx | 16 | ||||
| -rw-r--r-- | lib/items-tech/table/ship/Items-ship-table.tsx | 4 | ||||
| -rw-r--r-- | lib/items-tech/table/ship/import-item-handler.tsx | 76 | ||||
| -rw-r--r-- | lib/items-tech/table/ship/item-excel-template.tsx | 36 | ||||
| -rw-r--r-- | lib/items-tech/table/ship/items-ship-table-columns.tsx | 8 | ||||
| -rw-r--r-- | lib/items-tech/table/ship/items-table-toolbar-actions.tsx | 4 | ||||
| -rw-r--r-- | lib/items-tech/table/top/import-item-handler.tsx | 10 | ||||
| -rw-r--r-- | lib/items-tech/table/top/item-excel-template.tsx | 6 | ||||
| -rw-r--r-- | lib/items-tech/table/top/offshore-top-table-columns.tsx | 12 | ||||
| -rw-r--r-- | lib/items-tech/table/update-items-sheet.tsx | 58 |
14 files changed, 74 insertions, 208 deletions
diff --git a/lib/items-tech/table/add-items-dialog.tsx b/lib/items-tech/table/add-items-dialog.tsx index a3af0a8c..ee8ee8b8 100644 --- a/lib/items-tech/table/add-items-dialog.tsx +++ b/lib/items-tech/table/add-items-dialog.tsx @@ -46,16 +46,6 @@ const shipbuildingWorkTypes = [ { label: "철의", value: "철의" },
] as const
-// // 선종 유형 정의
-// const shipTypes = [
-// { label: "A-MAX", value: "A-MAX" },
-// { label: "S-MAX", value: "S-MAX" },
-// { label: "LNGC", value: "LNGC" },
-// { label: "VLCC", value: "VLCC" },
-// { label: "CONT", value: "CONT" },
-// { label: "OPTION", value: "OPTION" },
-// ] as const
-
// 해양 TOP 공종 유형 정의
const offshoreTopWorkTypes = [
{ label: "TM", value: "TM" },
@@ -76,14 +66,11 @@ const offshoreHullWorkTypes = [ // 기본 아이템 스키마
const itemFormSchema = z.object({
itemCode: z.string().min(1, "아이템 코드는 필수입니다"),
- itemName: z.string().min(1, "아이템 명은 필수입니다"),
- description: z.string().optional(),
workType: z.string().min(1, "공종은 필수입니다"),
// 조선 및 해양 아이템 공통 필드
itemList: z.string().optional(),
// 조선 아이템 전용 필드
shipTypes: z.string().optional(),
- // 해양 아이템 전용 필드
subItemList: z.string().optional(),
})
@@ -101,14 +88,11 @@ export function AddItemDialog({ itemType }: AddItemDialogProps) { const getDefaultValues = () => {
const defaults: ItemFormValues = {
itemCode: "",
- itemName: "기술영업",
- description: "",
workType: getDefaultWorkType(),
}
if (itemType === 'shipbuilding') {
defaults.shipTypes = "OPTION"
- defaults.itemList = ""
} else {
defaults.itemList = ""
defaults.subItemList = ""
@@ -146,20 +130,16 @@ export function AddItemDialog({ itemType }: AddItemDialogProps) { await createShipbuildingItem({
itemCode: data.itemCode,
- itemName: data.itemName,
workType: data.workType,
shipTypes: data.shipTypes,
- description: data.description || null,
- itemList: data.itemList || null
+ itemList: data.itemList || null,
});
break;
case 'offshoreTop':
await createOffshoreTopItem({
itemCode: data.itemCode,
- itemName: data.itemName,
workType: data.workType as "TM" | "TS" | "TE" | "TP",
- description: data.description || null,
itemList: data.itemList || null,
subItemList: data.subItemList || null
});
@@ -168,9 +148,7 @@ export function AddItemDialog({ itemType }: AddItemDialogProps) { case 'offshoreHull':
await createOffshoreHullItem({
itemCode: data.itemCode,
- itemName: data.itemName,
workType: data.workType as "HA" | "HE" | "HH" | "HM" | "NC",
- description: data.description || null,
itemList: data.itemList || null,
subItemList: data.subItemList || null
});
diff --git a/lib/items-tech/table/hull/import-item-handler.tsx b/lib/items-tech/table/hull/import-item-handler.tsx index 8c0e1cfa..aa0c7992 100644 --- a/lib/items-tech/table/hull/import-item-handler.tsx +++ b/lib/items-tech/table/hull/import-item-handler.tsx @@ -60,16 +60,14 @@ export async function processHullFileImport( try { // 필드 매핑 (한글/영문 필드명 모두 지원) - const itemCode = row["아이템 코드"] || row["itemCode"] || ""; - const itemName = row["아이템 명"] || row["itemName"] || "기술영업"; // 기본값 설정 + const itemCode = row["자재 그룹"] || row["itemCode"] || ""; const workType = row["기능(공종)"] || row["workType"] || ""; - const itemList = row["아이템 리스트"] || row["itemList"] || null; - const subItemList = row["서브 아이템 리스트"] || row["subItemList"] || null; + const itemList = row["자재명"] || row["itemList"] || null; + const subItemList = row["자재명(상세)"] || row["subItemList"] || null; // 데이터 정제 const cleanedRow = { itemCode: typeof itemCode === 'string' ? itemCode.trim() : String(itemCode).trim(), - itemName: typeof itemName === 'string' ? itemName.trim() : String(itemName).trim(), workType: typeof workType === 'string' ? workType.trim() : String(workType).trim(), itemList: itemList ? (typeof itemList === 'string' ? itemList : String(itemList)) : null, subItemList: subItemList ? (typeof subItemList === 'string' ? subItemList : String(subItemList)) : null, @@ -91,9 +89,7 @@ export async function processHullFileImport( // 해양 HULL 아이템 생성 const result = await createOffshoreHullItem({ itemCode: cleanedRow.itemCode, - itemName: cleanedRow.itemName, // Excel에서 가져온 값 또는 기본값 사용 workType: cleanedRow.workType as "HA" | "HE" | "HH" | "HM" | "NC", - description: null, itemList: cleanedRow.itemList, subItemList: cleanedRow.subItemList, }); diff --git a/lib/items-tech/table/hull/item-excel-template.tsx b/lib/items-tech/table/hull/item-excel-template.tsx index 61fddecc..13ec1973 100644 --- a/lib/items-tech/table/hull/item-excel-template.tsx +++ b/lib/items-tech/table/hull/item-excel-template.tsx @@ -18,10 +18,10 @@ export async function exportHullItemTemplate() { // 컬럼 헤더 정의 및 스타일 적용 worksheet.columns = [ - { header: '아이템 코드', key: 'itemCode', width: 15 }, + { header: '자재 그룹', key: 'itemCode', width: 15 }, { header: '기능(공종)', key: 'workType', width: 15 }, - { header: '아이템 리스트', key: 'itemList', width: 20 }, - { header: '서브 아이템 리스트', key: 'subItemList', width: 20 }, + { header: '자재명', key: 'itemList', width: 20 }, + { header: '자재명(상세)', key: 'subItemList', width: 20 }, ]; // 헤더 스타일 적용 diff --git a/lib/items-tech/table/hull/offshore-hull-table-columns.tsx b/lib/items-tech/table/hull/offshore-hull-table-columns.tsx index 7bc02173..efc6c583 100644 --- a/lib/items-tech/table/hull/offshore-hull-table-columns.tsx +++ b/lib/items-tech/table/hull/offshore-hull-table-columns.tsx @@ -112,13 +112,13 @@ export function getOffshoreHullColumns({ setRowAction }: GetColumnsProps): Colum {
accessorKey: "itemCode",
header: ({ column }) => (
- <DataTableColumnHeaderSimple column={column} title="Material Group" />
+ <DataTableColumnHeaderSimple column={column} title="자재 그룹" />
),
cell: ({ row }) => <div>{row.original.itemCode}</div>,
enableSorting: true,
enableHiding: true,
meta: {
- excelHeader: "Material Group",
+ excelHeader: "자재 그룹",
},
},
{
@@ -136,25 +136,25 @@ export function getOffshoreHullColumns({ setRowAction }: GetColumnsProps): Colum {
accessorKey: "itemList",
header: ({ column }) => (
- <DataTableColumnHeaderSimple column={column} title="아이템 리스트" />
+ <DataTableColumnHeaderSimple column={column} title="자재명" />
),
cell: ({ row }) => <div>{row.original.itemList || "-"}</div>,
enableSorting: true,
enableHiding: true,
meta: {
- excelHeader: "아이템 리스트",
+ excelHeader: "자재명",
},
},
{
accessorKey: "subItemList",
header: ({ column }) => (
- <DataTableColumnHeaderSimple column={column} title="서브 아이템 리스트" />
+ <DataTableColumnHeaderSimple column={column} title="자재명(상세)" />
),
cell: ({ row }) => <div>{row.original.subItemList || "-"}</div>,
enableSorting: true,
enableHiding: true,
meta: {
- excelHeader: "서브 아이템 리스트",
+ excelHeader: "자재명(상세)",
},
},
{
diff --git a/lib/items-tech/table/import-excel-button.tsx b/lib/items-tech/table/import-excel-button.tsx index 9bf4578c..3281823c 100644 --- a/lib/items-tech/table/import-excel-button.tsx +++ b/lib/items-tech/table/import-excel-button.tsx @@ -13,7 +13,6 @@ import { DialogFooter, DialogHeader, DialogTitle, - DialogTrigger, } from "@/components/ui/dialog" import { Progress } from "@/components/ui/progress" import { processFileImport } from "./ship/import-item-handler" @@ -123,22 +122,13 @@ export function ImportItemButton({ itemType, onSuccess }: ImportItemButtonProps) }); // 필수 헤더 확인 (타입별 구분) - let requiredHeaders: string[] = ["아이템 코드", "기능(공종)"]; - - // 해양 TOP 및 HULL의 경우 선종 헤더는 필요 없음 - if (itemType === "ship") { - requiredHeaders = [...requiredHeaders, "A-MAX", "S-MAX", "LNGC", "VLCC", "CONT"]; - } + const requiredHeaders: string[] = ["아이템 코드", "기능(공종)"]; const alternativeHeaders = { "아이템 코드": ["itemCode", "item_code"], - "아이템 명": ["itemName", "item_name"], "기능(공종)": ["workType"], - "설명": ["description"], - "항목1": ["itemList1"], - "항목2": ["itemList2"], - "항목3": ["itemList3"], - "항목4": ["itemList4"] + "자재명": ["itemList"], + "자재명(상세)": ["subItemList"] }; // 헤더 매핑 확인 (대체 이름 포함) diff --git a/lib/items-tech/table/ship/Items-ship-table.tsx b/lib/items-tech/table/ship/Items-ship-table.tsx index 61e8d8b4..feab288a 100644 --- a/lib/items-tech/table/ship/Items-ship-table.tsx +++ b/lib/items-tech/table/ship/Items-ship-table.tsx @@ -24,7 +24,7 @@ type ShipbuildingItem = { shipTypes: string;
itemCode: string;
itemName: string;
- itemList: string | null;
+ itemList: string | null;
description: string | null;
createdAt: Date;
updatedAt: Date;
@@ -110,7 +110,7 @@ export function ItemsShipTable({ promises }: ItemsTableProps) { label: "아이템 리스트",
type: "text",
},
- ]
+ ]
const { table } = useDataTable({
data: data as ShipbuildingItem[],
diff --git a/lib/items-tech/table/ship/import-item-handler.tsx b/lib/items-tech/table/ship/import-item-handler.tsx index 77bed4f0..a47e451b 100644 --- a/lib/items-tech/table/ship/import-item-handler.tsx +++ b/lib/items-tech/table/ship/import-item-handler.tsx @@ -3,14 +3,13 @@ import { z } from "zod" import { createShipbuildingImportItem } from "../../service" // 아이템 생성 서버 액션 -const SHIP_TYPES = ['A-MAX', 'S-MAX', 'LNGC', 'VLCC', 'CONT'] as const; - // 아이템 데이터 검증을 위한 Zod 스키마 const itemSchema = z.object({ itemCode: z.string().min(1, "아이템 코드는 필수입니다"), workType: z.enum(["기장", "전장", "선실", "배관", "철의"], { required_error: "기능(공종)은 필수입니다", }), + shipTypes: z.string().nullable().optional(), itemList: z.string().nullable().optional(), }); @@ -58,16 +57,16 @@ export async function processFileImport( try { // 필드 매핑 (한글/영문 필드명 모두 지원) - const itemCode = row["아이템 코드"] || row["itemCode"] || ""; - const itemName = row["아이템 명"] || row["itemName"] || "기술영업"; // 기본값 설정 + const itemCode = row["자재 그룹"] || row["itemCode"] || ""; const workType = row["기능(공종)"] || row["workType"] || ""; - const itemList = row["아이템 리스트"] || row["itemList"] || null; + const shipTypes = row["선종"] || row["shipTypes"] || null; + const itemList = row["자재명"] || row["itemList"] || null; // 데이터 정제 const cleanedRow = { itemCode: typeof itemCode === 'string' ? itemCode.trim() : String(itemCode).trim(), - itemName: typeof itemName === 'string' ? itemName.trim() : String(itemName).trim(), workType: typeof workType === 'string' ? workType.trim() : String(workType).trim(), + shipTypes: shipTypes ? (typeof shipTypes === 'string' ? shipTypes.trim() : String(shipTypes).trim()) : null, itemList: itemList ? (typeof itemList === 'string' ? itemList : String(itemList)) : null, }; @@ -84,57 +83,24 @@ export async function processFileImport( continue; } - // 선종 데이터 처리 - const shipTypeEntries = SHIP_TYPES.map(type => ({ - type, - value: row[type] ? String(row[type]).toUpperCase() === 'O' : false - })).filter(entry => entry.value); - console.log('shipTypeEntries:', shipTypeEntries); - - // 선종이 없는 경우에 "option" 값을 사용 - if (shipTypeEntries.length === 0) { - // "option" 값으로 아이템 생성 - const result = await createShipbuildingImportItem({ - itemCode: cleanedRow.itemCode, - itemName: cleanedRow.itemName, // Excel에서 가져온 값 또는 기본값 사용 - workType: cleanedRow.workType as "기장" | "전장" | "선실" | "배관" | "철의", - shipTypes: { "OPTION": true }, - description: null, - itemList: cleanedRow.itemList, - }); - - if (result.success || !result.error) { - successCount++; - } else { - errors.push({ - row: rowIndex, - message: `OPTION: ${result.message || result.error || "알 수 없는 오류"}` - }); - errorCount++; - } + // 아이템 생성 + const result = await createShipbuildingImportItem({ + itemCode: cleanedRow.itemCode, + workType: cleanedRow.workType as "기장" | "전장" | "선실" | "배관" | "철의", + shipTypes: cleanedRow.shipTypes, + itemList: cleanedRow.itemList, + }); + + if (result.success || !result.error) { + successCount++; } else { - // 각 선종에 대해 아이템 생성 - for (const { type } of shipTypeEntries) { - const result = await createShipbuildingImportItem({ - itemCode: cleanedRow.itemCode, - itemName: cleanedRow.itemName, // Excel에서 가져온 값 또는 기본값 사용 - workType: cleanedRow.workType as "기장" | "전장" | "선실" | "배관" | "철의", - shipTypes: { [type]: true }, - description: null, - itemList: cleanedRow.itemList, - }); - - if (result.success || !result.error) { - successCount++; - } else { - errors.push({ - row: rowIndex, - message: `${type}: ${result.message || result.error || "알 수 없는 오류"}` - }); - errorCount++; - } - } + errors.push({ + row: rowIndex, + message: result.message || result.error || "알 수 없는 오류" + }); + errorCount++; } + } catch (error) { console.error(`${rowIndex}행 처리 오류:`, error); errors.push({ diff --git a/lib/items-tech/table/ship/item-excel-template.tsx b/lib/items-tech/table/ship/item-excel-template.tsx index f6b20b6d..401fb911 100644 --- a/lib/items-tech/table/ship/item-excel-template.tsx +++ b/lib/items-tech/table/ship/item-excel-template.tsx @@ -1,8 +1,6 @@ import * as ExcelJS from 'exceljs'; import { saveAs } from "file-saver"; -const SHIP_TYPES = ['A-MAX', 'S-MAX', 'LNGC', 'VLCC', 'CONT'] as const; - /** * 조선 아이템 데이터 가져오기를 위한 Excel 템플릿 파일 생성 및 다운로드 */ @@ -17,14 +15,10 @@ export async function exportItemTemplate() { // 컬럼 헤더 정의 및 스타일 적용 worksheet.columns = [ - { header: '아이템 코드', key: 'itemCode', width: 15 }, + { header: '자재 그룹', key: 'itemCode', width: 15 }, { header: '기능(공종)', key: 'workType', width: 15 }, - { header: '아이템 리스트', key: 'itemList', width: 30 }, - ...SHIP_TYPES.map(type => ({ - header: type, - key: type, - width: 10 - })) + { header: '선종', key: 'shipTypes', width: 15 }, + { header: '자재명', key: 'itemList', width: 30 }, ]; // 헤더 스타일 적용 @@ -52,32 +46,20 @@ export async function exportItemTemplate() { { itemCode: 'BG0001', workType: '기장', - itemList: '아이템 리스트 내용', - 'A-MAX': 'O', - 'S-MAX': 'O', - 'LNGC': 'O', - 'VLCC': ' ', - 'CONT': ' ' + shipTypes: 'A-MAX', + itemList: '자재명', }, { itemCode: 'BG0002', workType: '전장', - itemList: '아이템 리스트 내용 2', - 'A-MAX': 'O', - 'S-MAX': ' ', - 'LNGC': 'O', - 'VLCC': 'O', - 'CONT': ' ' + shipTypes: 'LNGC', + itemList: '자재명', }, { itemCode: 'BG0003', workType: '선실', - itemList: '선종 없는 아이템', - 'A-MAX': ' ', - 'S-MAX': ' ', - 'LNGC': ' ', - 'VLCC': ' ', - 'CONT': ' ' + shipTypes: 'VLCC', + itemList: '자재명', } ]; diff --git a/lib/items-tech/table/ship/items-ship-table-columns.tsx b/lib/items-tech/table/ship/items-ship-table-columns.tsx index 29e1d503..13ba2480 100644 --- a/lib/items-tech/table/ship/items-ship-table-columns.tsx +++ b/lib/items-tech/table/ship/items-ship-table-columns.tsx @@ -115,13 +115,13 @@ export function getShipbuildingColumns({ setRowAction }: GetColumnsProps): Colum {
accessorKey: "itemCode",
header: ({ column }) => (
- <DataTableColumnHeaderSimple column={column} title="Material Group" />
+ <DataTableColumnHeaderSimple column={column} title="자재 그룹" />
),
cell: ({ row }) => <div>{row.original.itemCode}</div>,
enableSorting: true,
enableHiding: true,
meta: {
- excelHeader: "Material Group",
+ excelHeader: "자재 그룹",
},
},
{
@@ -151,13 +151,13 @@ export function getShipbuildingColumns({ setRowAction }: GetColumnsProps): Colum {
accessorKey: "itemList",
header: ({ column }) => (
- <DataTableColumnHeaderSimple column={column} title="아이템 리스트" />
+ <DataTableColumnHeaderSimple column={column} title="자재명" />
),
cell: ({ row }) => <div>{row.original.itemList || "-"}</div>,
enableSorting: true,
enableHiding: true,
meta: {
- excelHeader: "아이템 리스트",
+ excelHeader: "자재명",
},
},
{
diff --git a/lib/items-tech/table/ship/items-table-toolbar-actions.tsx b/lib/items-tech/table/ship/items-table-toolbar-actions.tsx index 677173d1..e58ba135 100644 --- a/lib/items-tech/table/ship/items-table-toolbar-actions.tsx +++ b/lib/items-tech/table/ship/items-table-toolbar-actions.tsx @@ -134,9 +134,7 @@ export function ItemsTableToolbarActions({ table }: ItemsTableToolbarActionsProp {/* 선택된 로우가 있으면 삭제 다이얼로그 */} {table.getFilteredSelectedRowModel().rows.length > 0 ? ( <DeleteItemsDialog - items={table - .getFilteredSelectedRowModel() - .rows.map((row) => row.original)} + items={table.getFilteredSelectedRowModel().rows.map((row) => row.original) as any} onSuccess={() => table.toggleAllRowsSelected(false)} itemType="shipbuilding" /> diff --git a/lib/items-tech/table/top/import-item-handler.tsx b/lib/items-tech/table/top/import-item-handler.tsx index e2564a91..541ec4ef 100644 --- a/lib/items-tech/table/top/import-item-handler.tsx +++ b/lib/items-tech/table/top/import-item-handler.tsx @@ -60,16 +60,14 @@ export async function processTopFileImport( try { // 필드 매핑 (한글/영문 필드명 모두 지원) - const itemCode = row["아이템 코드"] || row["itemCode"] || ""; - const itemName = row["아이템 명"] || row["itemName"] || "기술영업"; // 기본값 설정 + const itemCode = row["자재 그룹"] || row["itemCode"] || ""; const workType = row["기능(공종)"] || row["workType"] || ""; - const itemList = row["아이템 리스트"] || row["itemList"] || null; - const subItemList = row["서브 아이템 리스트"] || row["subItemList"] || null; + const itemList = row["자재명"] || row["itemList"] || null; + const subItemList = row["자재명(상세)"] || row["subItemList"] || null; // 데이터 정제 const cleanedRow = { itemCode: typeof itemCode === 'string' ? itemCode.trim() : String(itemCode).trim(), - itemName: typeof itemName === 'string' ? itemName.trim() : String(itemName).trim(), workType: typeof workType === 'string' ? workType.trim() : String(workType).trim(), itemList: itemList ? (typeof itemList === 'string' ? itemList : String(itemList)) : null, subItemList: subItemList ? (typeof subItemList === 'string' ? subItemList : String(subItemList)) : null, @@ -91,9 +89,7 @@ export async function processTopFileImport( // 해양 TOP 아이템 생성 const result = await createOffshoreTopItem({ itemCode: cleanedRow.itemCode, - itemName: cleanedRow.itemName, // Excel에서 가져온 값 또는 기본값 사용 workType: cleanedRow.workType as "TM" | "TS" | "TE" | "TP", - description: null, itemList: cleanedRow.itemList, subItemList: cleanedRow.subItemList, }); diff --git a/lib/items-tech/table/top/item-excel-template.tsx b/lib/items-tech/table/top/item-excel-template.tsx index f0e10d82..f547d617 100644 --- a/lib/items-tech/table/top/item-excel-template.tsx +++ b/lib/items-tech/table/top/item-excel-template.tsx @@ -18,10 +18,10 @@ export async function exportTopItemTemplate() { // 컬럼 헤더 정의 및 스타일 적용 worksheet.columns = [ - { header: '아이템 코드', key: 'itemCode', width: 15 }, + { header: '자재 그룹', key: 'itemCode', width: 15 }, { header: '기능(공종)', key: 'workType', width: 15 }, - { header: '아이템 리스트', key: 'itemList', width: 20 }, - { header: '서브 아이템 리스트', key: 'subItemList', width: 20 }, + { header: '자재명', key: 'itemList', width: 20 }, + { header: '자재명(상세)', key: 'subItemList', width: 20 }, ]; diff --git a/lib/items-tech/table/top/offshore-top-table-columns.tsx b/lib/items-tech/table/top/offshore-top-table-columns.tsx index 4746f226..93f27492 100644 --- a/lib/items-tech/table/top/offshore-top-table-columns.tsx +++ b/lib/items-tech/table/top/offshore-top-table-columns.tsx @@ -112,13 +112,13 @@ export function getOffshoreTopColumns({ setRowAction }: GetColumnsProps): Column {
accessorKey: "itemCode",
header: ({ column }) => (
- <DataTableColumnHeaderSimple column={column} title="Material Group" />
+ <DataTableColumnHeaderSimple column={column} title="자재 그룹" />
),
cell: ({ row }) => <div>{row.original.itemCode}</div>,
enableSorting: true,
enableHiding: true,
meta: {
- excelHeader: "Material Group",
+ excelHeader: "자재 그룹",
},
},
{
@@ -136,25 +136,25 @@ export function getOffshoreTopColumns({ setRowAction }: GetColumnsProps): Column {
accessorKey: "itemList",
header: ({ column }) => (
- <DataTableColumnHeaderSimple column={column} title="아이템 리스트" />
+ <DataTableColumnHeaderSimple column={column} title="자재명" />
),
cell: ({ row }) => <div>{row.original.itemList || "-"}</div>,
enableSorting: true,
enableHiding: true,
meta: {
- excelHeader: "아이템 리스트",
+ excelHeader: "자재명",
},
},
{
accessorKey: "subItemList",
header: ({ column }) => (
- <DataTableColumnHeaderSimple column={column} title="서브 아이템 리스트" />
+ <DataTableColumnHeaderSimple column={column} title="자재명(상세)" />
),
cell: ({ row }) => <div>{row.original.subItemList || "-"}</div>,
enableSorting: true,
enableHiding: true,
meta: {
- excelHeader: "서브 아이템 리스트",
+ excelHeader: "자재명(상세)",
},
},
{
diff --git a/lib/items-tech/table/update-items-sheet.tsx b/lib/items-tech/table/update-items-sheet.tsx index efab4b1a..16dfcb71 100644 --- a/lib/items-tech/table/update-items-sheet.tsx +++ b/lib/items-tech/table/update-items-sheet.tsx @@ -61,29 +61,26 @@ const offshoreHullWorkTypes = [ { value: "NC", label: "NC" },
] as const
-interface CommonItemFields {
+
+type ShipbuildingItem = {
id: number
- itemId: number
itemCode: string
- itemName: string
- description: string | null
- createdAt: Date
- updatedAt: Date
-}
-
-type ShipbuildingItem = CommonItemFields & {
workType: "기장" | "전장" | "선실" | "배관" | "철의"
shipTypes: string
itemList: string | null
}
-type OffshoreTopItem = CommonItemFields & {
+type OffshoreTopItem = {
+ id: number
+ itemCode: string
workType: "TM" | "TS" | "TE" | "TP"
itemList: string | null
subItemList: string | null
}
-type OffshoreHullItem = CommonItemFields & {
+type OffshoreHullItem = {
+ id: number
+ itemCode: string
workType: "HA" | "HE" | "HH" | "HM" | "NC"
itemList: string | null
subItemList: string | null
@@ -91,12 +88,9 @@ type OffshoreHullItem = CommonItemFields & { type UpdateItemSchema = {
itemCode?: string
- itemName?: string
- description?: string
workType?: string
shipTypes?: string
itemList?: string
- subItemList?: string
}
interface UpdateItemSheetProps {
@@ -112,8 +106,6 @@ export function UpdateItemSheet({ item, itemType, open, onOpenChange }: UpdateIt // 초기값 설정
const form = useForm<UpdateItemSchema>({
defaultValues: {
- itemName: item.itemName,
- description: item.description || "",
workType: item.workType,
...getItemTypeSpecificDefaults(item, itemType),
},
@@ -127,7 +119,7 @@ export function UpdateItemSheet({ item, itemType, open, onOpenChange }: UpdateIt case 'shipbuilding':
return {
shipTypes: (item as ShipbuildingItem).shipTypes,
- itemList: (item as ShipbuildingItem).itemList || ""
+ itemList: (item as ShipbuildingItem).itemList || "",
};
case 'offshoreTop':
case 'offshoreHull':
@@ -279,25 +271,8 @@ export function UpdateItemSheet({ item, itemType, open, onOpenChange }: UpdateIt </FormItem>
)}
/>
- <FormField
- control={form.control}
- name="itemList"
- render={({ field }) => (
- <FormItem>
- <FormLabel>아이템 리스트</FormLabel>
- <FormControl>
- <Input placeholder="아이템 리스트를 입력하세요" {...field} />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
</>
)}
-
- {/* 해양 TOP 또는 HULL 아이템 전용 필드 */}
- {(itemType === 'offshoreTop' || itemType === 'offshoreHull') && (
- <>
<FormField
control={form.control}
name="itemList"
@@ -311,21 +286,6 @@ export function UpdateItemSheet({ item, itemType, open, onOpenChange }: UpdateIt </FormItem>
)}
/>
- <FormField
- control={form.control}
- name="subItemList"
- render={({ field }) => (
- <FormItem>
- <FormLabel>서브 아이템 리스트</FormLabel>
- <FormControl>
- <Input placeholder="서브 아이템 리스트를 입력하세요" {...field} />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
- </>
- )}
<SheetFooter>
<SheetClose asChild>
<Button variant="outline">취소</Button>
|
