From 7e86ecb9d3df7f554f82a8d5fdd538d1c148ce73 Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Sun, 2 Nov 2025 18:43:05 +0900 Subject: (김준회) PCR: 컬럼 표현방식 수정 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pcr/table/pcr-table-column.tsx | 56 ++++++++++++++++++++------------------ lib/pcr/types.ts | 1 + lib/soap/ecc/mapper/pcr-mapper.ts | 4 +-- 3 files changed, 33 insertions(+), 28 deletions(-) (limited to 'lib') diff --git a/lib/pcr/table/pcr-table-column.tsx b/lib/pcr/table/pcr-table-column.tsx index aa4936ce..98cf9502 100644 --- a/lib/pcr/table/pcr-table-column.tsx +++ b/lib/pcr/table/pcr-table-column.tsx @@ -1,4 +1,4 @@ -import { ColumnDef } from "@tanstack/react-table" +import { ColumnDef, Column, Row } from "@tanstack/react-table" import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" import { Checkbox } from "@/components/ui/checkbox" @@ -12,9 +12,9 @@ import { } from "@/components/ui/dropdown-menu" import { DataTableColumnHeaderSimple } from "@/components/data-table/data-table-column-simple-header" import { PcrPoData, PCR_APPROVAL_STATUS_CONFIG, PCR_CHANGE_TYPE_CONFIG } from "@/lib/pcr/types" -import { MoreHorizontal, Eye, Edit, Trash2 } from "lucide-react" +import { MoreHorizontal, Edit } from "lucide-react" import type { DataTableRowAction } from "@/types/table" -import { DataTableColumnHeader } from "@/components/data-table/data-table-column-header" +import { formatNumber } from "@/lib/utils" interface GetColumnsProps { setRowAction: React.Dispatch | null>> @@ -81,7 +81,7 @@ export function getColumns({ setRowAction, isEvcpPage = false }: GetColumnsProps return ( {config.label} @@ -137,7 +137,7 @@ export function getColumns({ setRowAction, isEvcpPage = false }: GetColumnsProps cell: ({ row }) => { const value = row.getValue("project") as string return ( -
+
{value || "-"}
) @@ -171,7 +171,7 @@ export function getColumns({ setRowAction, isEvcpPage = false }: GetColumnsProps cell: ({ row }) => { const value = row.getValue("revItemNumber") as string return ( -
+
{value || "-"}
) @@ -185,7 +185,7 @@ export function getColumns({ setRowAction, isEvcpPage = false }: GetColumnsProps cell: ({ row }) => { const value = row.getValue("purchaseContractManager") as string return ( -
+
{value || "-"}
) @@ -199,7 +199,7 @@ export function getColumns({ setRowAction, isEvcpPage = false }: GetColumnsProps cell: ({ row }) => { const value = row.getValue("pcrCreator") as string return ( -
+
{value || "-"}
) @@ -212,13 +212,10 @@ export function getColumns({ setRowAction, isEvcpPage = false }: GetColumnsProps ), cell: ({ row }) => { const value = row.getValue("poContractAmountBefore") as number - const currency = row.original.contractCurrency - - if (!value) return "-" return (
- {currency} {value.toLocaleString()} + {formatNumber(value)}
) }, @@ -230,13 +227,10 @@ export function getColumns({ setRowAction, isEvcpPage = false }: GetColumnsProps ), cell: ({ row }) => { const value = row.getValue("poContractAmountAfter") as number - const currency = row.original.contractCurrency - - if (!value) return "-" return (
- {currency} {value.toLocaleString()} + {formatNumber(value)}
) }, @@ -258,10 +252,10 @@ export function getColumns({ setRowAction, isEvcpPage = false }: GetColumnsProps // EvcP 페이지에서만 협력업체 정보 표시 ...(isEvcpPage ? [{ accessorKey: "vendorName" as const, - header: ({ column }: { column: any }) => ( + header: ({ column }: { column: Column }) => ( ), - cell: ({ row }: { row: any }) => { + cell: ({ row }: { row: Row }) => { const vendorName = row.getValue("vendorName") as string const vendorCode = row.original.vendorCode as string const displayText = vendorName @@ -271,7 +265,7 @@ export function getColumns({ setRowAction, isEvcpPage = false }: GetColumnsProps : "-" return ( -
+
{displayText}
) @@ -284,9 +278,21 @@ export function getColumns({ setRowAction, isEvcpPage = false }: GetColumnsProps ), cell: ({ row }) => { const value = row.getValue("details") as string + + if (!value) return
-
+ + // 세미콜론으로 구분하고 빈 문자열 제거 + const items = value.split(";").filter(item => item.trim() !== "") + + if (items.length === 0) return
-
+ return ( -
- {value || "-"} +
+ {items.map((item, index) => ( + + {item.trim()} + + ))}
) }, @@ -299,7 +305,7 @@ export function getColumns({ setRowAction, isEvcpPage = false }: GetColumnsProps cell: ({ row }) => { const value = row.getValue("pcrReason") as string return ( -
+
{value || "-"}
) @@ -313,7 +319,7 @@ export function getColumns({ setRowAction, isEvcpPage = false }: GetColumnsProps cell: ({ row }) => { const value = row.getValue("detailsReason") as string return ( -
+
{value || "-"}
) @@ -327,7 +333,7 @@ export function getColumns({ setRowAction, isEvcpPage = false }: GetColumnsProps cell: ({ row }) => { const value = row.getValue("rejectionReason") as string return ( -
+
{value || "-"}
) @@ -379,8 +385,6 @@ export function getColumns({ setRowAction, isEvcpPage = false }: GetColumnsProps ), cell: ({ row }) => { - const pcrPo = row.original - return ( diff --git a/lib/pcr/types.ts b/lib/pcr/types.ts index cdbc7d2e..7de5dbcf 100644 --- a/lib/pcr/types.ts +++ b/lib/pcr/types.ts @@ -100,6 +100,7 @@ export interface PcrPoData { pcrResponseDate?: Date; vendorId?: number; vendorName?: string; // JOIN 결과 포함 + vendorCode?: string; // JOIN 결과 포함 createdBy: number; updatedBy: number; createdAt: Date; diff --git a/lib/soap/ecc/mapper/pcr-mapper.ts b/lib/soap/ecc/mapper/pcr-mapper.ts index 2733d6d4..24ffe2a2 100644 --- a/lib/soap/ecc/mapper/pcr-mapper.ts +++ b/lib/soap/ecc/mapper/pcr-mapper.ts @@ -17,8 +17,8 @@ * - poContractAmountBefore: NETWR (PO 금액) * - poContractAmountAfter: ECC에서 제공 안됨 (TODO: NETPR * QTY_A로 계산 가능) * - contractCurrency: WAERS (PO 통화) - * - pcrReason: REQUEST_RSN (Request 사유) - * - detailsReason: REQUEST_CD (Request 코드) + * - pcrReason: REQUEST_CD (Request 코드) + * - detailsReason: REQUEST_RSN (Request 사유) * * [pcrPr 매핑] * - materialNumber: MATNR (자재번호) -- cgit v1.2.3