From b1e444930b9be540612dc671209b8699478b3bc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=ED=98=81=EC=84=B1?= Date: Thu, 22 Jan 2026 22:47:31 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=A7=A4=EC=9E=85=EA=B4=80=EB=A6=AC=20?= =?UTF-8?q?=ED=92=88=EC=9D=98=EC=84=9C/=EC=A7=80=EC=B6=9C=EA=B2=B0?= =?UTF-8?q?=EC=9D=98=EC=84=9C=20=EC=97=B0=EB=8F=99=20UI=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - PurchaseRecord 타입에 approvalId 필드 추가 - API 응답에서 approval 데이터를 sourceDocument로 변환 - 매입 목록에 '연결문서' 컬럼 추가 (품의서/지출결의서 표시) - 모바일 카드 뷰에 연결문서 정보 표시 --- .../accounting/PurchaseManagement/actions.ts | 32 +++++++++++++++++++ .../accounting/PurchaseManagement/index.tsx | 12 +++++++ .../accounting/PurchaseManagement/types.ts | 4 ++- 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/src/components/accounting/PurchaseManagement/actions.ts b/src/components/accounting/PurchaseManagement/actions.ts index 18eb8c57..f9f9ed65 100644 --- a/src/components/accounting/PurchaseManagement/actions.ts +++ b/src/components/accounting/PurchaseManagement/actions.ts @@ -31,6 +31,18 @@ interface PurchaseApiData { status: string; purchase_type?: string; withdrawal_id?: number; + approval_id?: number; + approval?: { + id: number; + document_number: string; + title: string; + content?: Record; + form?: { + id: number; + name: string; + category: string; + }; + }; tax_invoice_received: boolean; created_at?: string; updated_at?: string; @@ -60,6 +72,23 @@ function transformApiToFrontend(data: PurchaseApiData): PurchaseRecord { ? (data.purchase_type as PurchaseType) : 'unset'; + // 품의서/지출결의서 연결 정보 변환 + let sourceDocument: PurchaseRecord['sourceDocument'] = undefined; + if (data.approval) { + // form.category로 문서 유형 결정 (proposal=품의서, expense_report=지출결의서) + const docType = data.approval.form?.category === 'expense_report' ? 'expense_report' : 'proposal'; + // content에서 예상금액 추출 (품의서 양식에 따라 다를 수 있음) + const expectedCost = (data.approval.content?.expected_cost as number) || + (data.approval.content?.total_amount as number) || 0; + + sourceDocument = { + type: docType, + documentNo: data.approval.document_number, + title: data.approval.title, + expectedCost, + }; + } + return { id: String(data.id), purchaseNo: data.purchase_number, @@ -72,6 +101,8 @@ function transformApiToFrontend(data: PurchaseApiData): PurchaseRecord { purchaseType, evidenceType: 'tax_invoice', status: data.status === 'confirmed' ? 'completed' : 'pending', + approvalId: data.approval_id ? String(data.approval_id) : undefined, + sourceDocument, items: [], taxInvoiceReceived: data.tax_invoice_received ?? false, createdAt: data.created_at || '', @@ -90,6 +121,7 @@ function transformFrontendToApi(data: Partial): Record합계 + {tableTotals.totalSupplyAmount.toLocaleString()} {tableTotals.totalVat.toLocaleString()} {tableTotals.totalAmount.toLocaleString()} @@ -424,6 +426,15 @@ export function PurchaseManagement() { {item.purchaseNo} {item.purchaseDate} {item.vendorName} + + {item.sourceDocument ? ( + + {item.sourceDocument.type === 'proposal' ? '품의서' : '지출결의서'} + + ) : ( + - + )} + {item.supplyAmount.toLocaleString()} {item.vat.toLocaleString()} {item.totalAmount.toLocaleString()} @@ -489,6 +500,7 @@ export function PurchaseManagement() { onClick={() => handleRowClick(item)} details={[ { label: '매입일', value: item.purchaseDate }, + { label: '연결문서', value: item.sourceDocument ? (item.sourceDocument.type === 'proposal' ? '품의서' : '지출결의서') : '-' }, { label: '공급가액', value: `${item.supplyAmount.toLocaleString()}원` }, { label: '합계금액', value: `${item.totalAmount.toLocaleString()}원` }, ]} diff --git a/src/components/accounting/PurchaseManagement/types.ts b/src/components/accounting/PurchaseManagement/types.ts index 48620580..88f2cab8 100644 --- a/src/components/accounting/PurchaseManagement/types.ts +++ b/src/components/accounting/PurchaseManagement/types.ts @@ -54,7 +54,9 @@ export interface PurchaseRecord { purchaseType: PurchaseType; // 매입유형 evidenceType: EvidenceType; // 증빙유형 status: PurchaseStatus; // 상태 - // 근거 문서 + // 연결된 결재문서 ID (품의서/지출결의서) + approvalId?: string; + // 근거 문서 (API에서 조회됨) sourceDocument?: { type: 'proposal' | 'expense_report'; // 품의서 | 지출결의서 documentNo: string;