From f69e125f1a0b47bbc22e2784208bf829bcdd24f8 Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Thu, 25 Sep 2025 12:19:07 +0900 Subject: (김준회) nonsap sync 배치 처리(크론잡 임시 주석처리), 메뉴 스크롤 처리, 벤더풀 임포트 복호화 처리, MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../table/vendor-pool-excel-import-button.tsx | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'lib/vendor-pool/table') diff --git a/lib/vendor-pool/table/vendor-pool-excel-import-button.tsx b/lib/vendor-pool/table/vendor-pool-excel-import-button.tsx index 704d4aff..0f51170f 100644 --- a/lib/vendor-pool/table/vendor-pool-excel-import-button.tsx +++ b/lib/vendor-pool/table/vendor-pool-excel-import-button.tsx @@ -18,6 +18,7 @@ import { getAccessorKeyByHeader, vendorPoolExcelColumns } from '../excel-utils' +import { decryptWithServerAction } from '@/components/drm/drmUtils' interface ImportExcelProps { onSuccess?: () => void @@ -26,7 +27,7 @@ interface ImportExcelProps { export function ImportVendorPoolButton({ onSuccess }: ImportExcelProps) { const fileInputRef = useRef(null) const [isImporting, setIsImporting] = React.useState(false) - const { data: session, status } = useSession() + const { data: session } = useSession() // 헬퍼 함수들은 excel-utils에서 import @@ -37,10 +38,23 @@ export function ImportVendorPoolButton({ onSuccess }: ImportExcelProps) { setIsImporting(true) try { - // Read the Excel file using ExcelJS - const data = await file.arrayBuffer() + // DRM 복호화 처리 + toast.info("파일을 복호화하고 있습니다...") + let decryptedData: ArrayBuffer + + try { + decryptedData = await decryptWithServerAction(file) + toast.success("파일 복호화가 완료되었습니다.") + } catch (drmError) { + console.warn("DRM 복호화 실패, 원본 파일로 진행합니다:", drmError) + toast.warning("DRM 복호화에 실패했습니다. 원본 파일로 진행합니다.") + decryptedData = await file.arrayBuffer() + } + + // 복호화된 데이터로 ExcelJS 워크북 로드 + toast.info("엑셀 파일을 분석하고 있습니다...") const workbook = new ExcelJS.Workbook() - await workbook.xlsx.load(data) + await workbook.xlsx.load(decryptedData) // Get the first worksheet const worksheet = workbook.getWorksheet(1) -- cgit v1.2.3