From a9c038e51f1cf508165e9d196ffe332f6ac54d74 Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Mon, 3 Nov 2025 17:28:06 +0900 Subject: (김준회) SWP: 커버페이지 다운로드 버튼 추가 (문서별) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/swp/table/swp-table-columns.tsx | 25 +++++++++++++++++++++++++ lib/swp/table/swp-table.tsx | 22 +++++++++++++++++++++- 2 files changed, 46 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/swp/table/swp-table-columns.tsx b/lib/swp/table/swp-table-columns.tsx index 48b2c90a..5334bd8c 100644 --- a/lib/swp/table/swp-table-columns.tsx +++ b/lib/swp/table/swp-table-columns.tsx @@ -2,6 +2,8 @@ import { ColumnDef } from "@tanstack/react-table"; import { Badge } from "@/components/ui/badge"; +import { Button } from "@/components/ui/button"; +import { Download } from "lucide-react"; import type { DocumentListItem } from "@/lib/swp/document-service"; export const swpDocumentColumns: ColumnDef[] = [ @@ -125,4 +127,27 @@ export const swpDocumentColumns: ColumnDef[] = [ ), size: 100, }, + { + id: "actions", + header: "액션", + cell: ({ row }) => ( + + ), + size: 120, + }, ]; diff --git a/lib/swp/table/swp-table.tsx b/lib/swp/table/swp-table.tsx index 21a1c775..4d824f77 100644 --- a/lib/swp/table/swp-table.tsx +++ b/lib/swp/table/swp-table.tsx @@ -1,6 +1,6 @@ "use client"; -import React, { useState } from "react"; +import React, { useState, useEffect } from "react"; import { useReactTable, getCoreRowModel, @@ -17,12 +17,15 @@ import { import { swpDocumentColumns } from "./swp-table-columns"; import { SwpDocumentDetailDialog } from "./swp-document-detail-dialog"; import type { DocumentListItem } from "@/lib/swp/document-service"; +import { toast } from "sonner"; +import { quickDownload } from "@/lib/file-download"; interface SwpTableProps { documents: DocumentListItem[]; projNo: string; vendorCode: string; userId: string; + onCoverDownload?: (document: DocumentListItem) => void; } export function SwpTable({ @@ -30,6 +33,7 @@ export function SwpTable({ projNo, vendorCode, userId, + onCoverDownload, }: SwpTableProps) { const [dialogOpen, setDialogOpen] = useState(false); const [selectedDocument, setSelectedDocument] = useState(null); @@ -46,6 +50,22 @@ export function SwpTable({ setDialogOpen(true); }; + // 커버페이지 다운로드 이벤트 리스너 + useEffect(() => { + const handleCoverDownload = (event: CustomEvent) => { + const { document } = event.detail; + if (onCoverDownload) { + onCoverDownload(document); + } + }; + + window.addEventListener('coverDownload', handleCoverDownload as EventListener); + + return () => { + window.removeEventListener('coverDownload', handleCoverDownload as EventListener); + }; + }, [onCoverDownload]); + return (
{/* 테이블 */} -- cgit v1.2.3