diff options
| -rw-r--r-- | components/form-data/import-excel-form.tsx | 4 | ||||
| -rw-r--r-- | lib/tags/table/tags-table-toolbar-actions.tsx | 12 |
2 files changed, 12 insertions, 4 deletions
diff --git a/components/form-data/import-excel-form.tsx b/components/form-data/import-excel-form.tsx index 45e48312..fd9adc1c 100644 --- a/components/form-data/import-excel-form.tsx +++ b/components/form-data/import-excel-form.tsx @@ -4,6 +4,7 @@ import { saveAs } from "file-saver"; import { toast } from "sonner"; import { DataTableColumnJSON } from "./form-data-table-columns"; import { updateFormDataInDB } from "@/lib/forms/services"; +import { decryptWithServerAction } from "../drm/drmUtils"; // Assuming the previous types are defined above export interface ImportExcelOptions { file: File; @@ -52,7 +53,8 @@ export async function importExcelData({ const existingTagNumbers = new Set(tableData.map((d) => d.TAG_NO)); const workbook = new ExcelJS.Workbook(); - const arrayBuffer = await file.arrayBuffer(); + // const arrayBuffer = await file.arrayBuffer(); + const arrayBuffer = await decryptWithServerAction(file); await workbook.xlsx.load(arrayBuffer); const worksheet = workbook.worksheets[0]; diff --git a/lib/tags/table/tags-table-toolbar-actions.tsx b/lib/tags/table/tags-table-toolbar-actions.tsx index c6d13247..f77ebafa 100644 --- a/lib/tags/table/tags-table-toolbar-actions.tsx +++ b/lib/tags/table/tags-table-toolbar-actions.tsx @@ -15,6 +15,7 @@ import { fetchTagSubfieldOptions, getTagNumberingRules, } from "@/lib/tag-number import { bulkCreateTags, getClassOptions, getProjectIdFromContractItemId, getSubfieldsByTagType } from "../service" import { DeleteTagsDialog } from "./delete-tags-dialog" import { useRouter } from "next/navigation" // Add this import +import { decryptWithServerAction } from "@/components/drm/drmUtils" // 태그 번호 검증을 위한 인터페이스 interface TagNumberingRule { @@ -55,6 +56,7 @@ interface TagsTableToolbarActionsProps { /** 현재 태그 목록(상태) */ tableData: Tag[] /** 태그 목록을 갱신하는 setState */ + selectedMode:string } /** @@ -68,6 +70,7 @@ export function TagsTableToolbarActions({ table, selectedPackageId, tableData, + selectedMode }: TagsTableToolbarActionsProps) { const router = useRouter() // Add this line @@ -395,7 +398,8 @@ export function TagsTableToolbarActions({ try { // 1) Workbook 로드 const workbook = new ExcelJS.Workbook() - const arrayBuffer = await file.arrayBuffer() + // const arrayBuffer = await file.arrayBuffer() + const arrayBuffer = await decryptWithServerAction(file); await workbook.xlsx.load(arrayBuffer) // 첫 번째 시트 사용 @@ -580,9 +584,11 @@ export function TagsTableToolbarActions({ // API 엔드포인트 호출 - 작업 시작만 요청 const response = await fetch('/api/cron/tags/start', { method: 'POST', - body: JSON.stringify({ packageId: selectedPackageId }) + body: JSON.stringify({ + packageId: selectedPackageId, + mode: selectedMode // 모드 정보 추가 + }) }) - if (!response.ok) { const errorData = await response.json() throw new Error(errorData.error || 'Failed to start tag import') |
