summaryrefslogtreecommitdiff
path: root/lib/items-tech/table/top
diff options
context:
space:
mode:
authordujinkim <dujin.kim@dtsolution.co.kr>2025-07-17 10:50:52 +0000
committerdujinkim <dujin.kim@dtsolution.co.kr>2025-07-17 10:50:52 +0000
commit2ef02e27dbe639876fa3b90c30307dda183545ec (patch)
treee132ae7f3dd774e1ce767291c2849be4a63ae762 /lib/items-tech/table/top
parentfb276ed3db86fe4fc0c0fcd870fd3d085b034be0 (diff)
(최겸) 기술영업 변경사항 적용
Diffstat (limited to 'lib/items-tech/table/top')
-rw-r--r--lib/items-tech/table/top/import-item-handler.tsx28
-rw-r--r--lib/items-tech/table/top/item-excel-template.tsx7
-rw-r--r--lib/items-tech/table/top/offshore-top-table-columns.tsx4
-rw-r--r--lib/items-tech/table/top/offshore-top-table-toolbar-actions.tsx8
4 files changed, 26 insertions, 21 deletions
diff --git a/lib/items-tech/table/top/import-item-handler.tsx b/lib/items-tech/table/top/import-item-handler.tsx
index 541ec4ef..0a163791 100644
--- a/lib/items-tech/table/top/import-item-handler.tsx
+++ b/lib/items-tech/table/top/import-item-handler.tsx
@@ -8,7 +8,7 @@ const TOP_WORK_TYPES = ["TM", "TS", "TE", "TP"] as const;
// 아이템 데이터 검증을 위한 Zod 스키마
const itemSchema = z.object({
- itemCode: z.string().min(1, "아이템 코드는 필수입니다"),
+ itemCode: z.string().optional(),
workType: z.enum(TOP_WORK_TYPES, {
required_error: "기능(공종)은 필수입니다",
}),
@@ -19,7 +19,7 @@ const itemSchema = z.object({
interface ProcessResult {
successCount: number;
errorCount: number;
- errors?: Array<{ row: number; message: string }>;
+ errors: Array<{ row: number; message: string; itemCode?: string; workType?: string }>;
}
/**
@@ -45,7 +45,7 @@ export async function processTopFileImport(
// 데이터 행이 없으면 빈 결과 반환
if (dataRows.length === 0) {
- return { successCount: 0, errorCount: 0 };
+ return { successCount: 0, errorCount: 0, errors: [] };
}
// 각 행에 대해 처리
@@ -81,7 +81,12 @@ export async function processTopFileImport(
err => `${err.path.join('.')}: ${err.message}`
).join(', ');
- errors.push({ row: rowIndex, message: errorMessage });
+ errors.push({
+ row: rowIndex,
+ message: errorMessage,
+ itemCode: cleanedRow.itemCode,
+ workType: cleanedRow.workType
+ });
errorCount++;
continue;
}
@@ -99,15 +104,24 @@ export async function processTopFileImport(
} else {
errors.push({
row: rowIndex,
- message: result.message || result.error || "알 수 없는 오류"
+ message: result.message || result.error || "알 수 없는 오류",
+ itemCode: cleanedRow.itemCode,
+ workType: cleanedRow.workType
});
errorCount++;
}
} catch (error) {
console.error(`${rowIndex}행 처리 오류:`, error);
+
+ // cleanedRow가 정의되지 않은 경우를 처리
+ const itemCode = row["자재 그룹"] || row["itemCode"] || "";
+ const workType = row["기능(공종)"] || row["workType"] || "";
+
errors.push({
row: rowIndex,
- message: error instanceof Error ? error.message : "알 수 없는 오류"
+ message: error instanceof Error ? error.message : "알 수 없는 오류",
+ itemCode: typeof itemCode === 'string' ? itemCode.trim() : String(itemCode).trim(),
+ workType: typeof workType === 'string' ? workType.trim() : String(workType).trim()
});
errorCount++;
}
@@ -122,6 +136,6 @@ export async function processTopFileImport(
return {
successCount,
errorCount,
- errors: errors.length > 0 ? errors : undefined
+ errors
};
}
diff --git a/lib/items-tech/table/top/item-excel-template.tsx b/lib/items-tech/table/top/item-excel-template.tsx
index f547d617..b67d91be 100644
--- a/lib/items-tech/table/top/item-excel-template.tsx
+++ b/lib/items-tech/table/top/item-excel-template.tsx
@@ -1,8 +1,6 @@
import * as ExcelJS from 'exceljs';
import { saveAs } from "file-saver";
-// 해양 TOP 기능(공종) 유형
-const TOP_WORK_TYPES = ["TM", "TS", "TE", "TP"] as const;
/**
* 해양 TOP 아이템 데이터 가져오기를 위한 Excel 템플릿 파일 생성 및 다운로드
@@ -81,11 +79,6 @@ export async function exportTopItemTemplate() {
}
});
- // 워크시트에 공종 유형 관련 메모 추가
- const infoRow = worksheet.addRow(['공종 유형 안내: ' + TOP_WORK_TYPES.join(', ')]);
- infoRow.font = { bold: true, color: { argb: 'FF0000FF' } };
- worksheet.mergeCells(`A${infoRow.number}:F${infoRow.number}`);
-
// 워크시트 보호 (선택적)
worksheet.protect('', {
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 c2df4b75..93f27492 100644
--- a/lib/items-tech/table/top/offshore-top-table-columns.tsx
+++ b/lib/items-tech/table/top/offshore-top-table-columns.tsx
@@ -162,7 +162,7 @@ export function getOffshoreTopColumns({ setRowAction }: GetColumnsProps): Column
header: ({ column }) => (
<DataTableColumnHeaderSimple column={column} title="생성일" />
),
- cell: ({ row }) => formatDate(row.original.createdAt, "KR"),
+ cell: ({ row }) => formatDate(row.original.createdAt),
enableSorting: true,
enableHiding: true,
meta: {
@@ -174,7 +174,7 @@ export function getOffshoreTopColumns({ setRowAction }: GetColumnsProps): Column
header: ({ column }) => (
<DataTableColumnHeaderSimple column={column} title="수정일" />
),
- cell: ({ row }) => formatDate(row.original.updatedAt, "KR"),
+ cell: ({ row }) => formatDate(row.original.updatedAt),
enableSorting: true,
enableHiding: true,
meta: {
diff --git a/lib/items-tech/table/top/offshore-top-table-toolbar-actions.tsx b/lib/items-tech/table/top/offshore-top-table-toolbar-actions.tsx
index f91adf96..bf10560f 100644
--- a/lib/items-tech/table/top/offshore-top-table-toolbar-actions.tsx
+++ b/lib/items-tech/table/top/offshore-top-table-toolbar-actions.tsx
@@ -70,12 +70,10 @@ export function OffshoreTopTableToolbarActions({ table }: OffshoreTopTableToolba
// 필요한 헤더 직접 정의 (필터링 문제 해결)
const headers = [
- { key: 'itemCode', header: '아이템 코드' },
- { key: 'itemName', header: '아이템 명' },
- { key: 'description', header: '설명' },
+ { key: 'itemCode', header: '자재 그룹' },
{ key: 'workType', header: '기능(공종)' },
- { key: 'itemList', header: '아이템 리스트' },
- { key: 'subItemList', header: '서브 아이템 리스트' },
+ { key: 'itemList', header: '자재명' },
+ { key: 'subItemList', header: '자재명(상세)' },
].filter(header => !excludeColumns.includes(header.key));
console.log("내보내기 헤더:", headers);