diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-05-15 01:34:49 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-05-15 01:34:49 +0000 |
| commit | ed864fa46c7ce0aac2de4c5ba5d311ebfd7e6a88 (patch) | |
| tree | b04695b9c8a4d2b03ed1f44f318fa38d8c490364 /lib/vendors/table/vendors-table-columns.tsx | |
| parent | 9beaabc8d1e0ac3a5c54c8202d3c690577bdbd39 (diff) | |
(대표님) 벤더 문서 관련 개발사항
Diffstat (limited to 'lib/vendors/table/vendors-table-columns.tsx')
| -rw-r--r-- | lib/vendors/table/vendors-table-columns.tsx | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/lib/vendors/table/vendors-table-columns.tsx b/lib/vendors/table/vendors-table-columns.tsx index c768b587..21086918 100644 --- a/lib/vendors/table/vendors-table-columns.tsx +++ b/lib/vendors/table/vendors-table-columns.tsx @@ -51,9 +51,12 @@ type NextRouter = ReturnType<typeof useRouter>; interface GetColumnsProps { setRowAction: React.Dispatch<React.SetStateAction<DataTableRowAction<VendorWithType> | null>>; router: NextRouter; - userId: number; + userId: number; } + + + /** * tanstack table 컬럼 정의 (중첩 헤더 버전) */ @@ -110,13 +113,13 @@ export function getColumns({ setRowAction, router, userId }: GetColumnsProps): C </Button> </DropdownMenuTrigger> <DropdownMenuContent align="end" className="w-56"> - {(isApproved ||afterApproved) && ( - <DropdownMenuItem - onSelect={() => setRowAction({ row, type: "update" })} - > - 레코드 편집 - </DropdownMenuItem> - )} + {(isApproved || afterApproved) && ( + <DropdownMenuItem + onSelect={() => setRowAction({ row, type: "update" })} + > + 레코드 편집 + </DropdownMenuItem> + )} <DropdownMenuItem onSelect={() => { @@ -130,10 +133,18 @@ export function getColumns({ setRowAction, router, userId }: GetColumnsProps): C 상세보기 </DropdownMenuItem> <DropdownMenuItem - onSelect={() => setRowAction({ row, type: "log" })} - > - 감사 로그 보기 - </DropdownMenuItem> + onSelect={() => { + // 새창으로 열기 위해 window.open() 사용 + window.open(`/evcp/vendors/${row.original.id}/info`, '_blank'); + }} + > + 상세보기(새창) + </DropdownMenuItem> + <DropdownMenuItem + onSelect={() => setRowAction({ row, type: "log" })} + > + 감사 로그 보기 + </DropdownMenuItem> <Separator /> <DropdownMenuSub> @@ -409,10 +420,12 @@ export function getColumns({ setRowAction, router, userId }: GetColumnsProps): C <DataTableColumnHeaderSimple column={column} title="" /> ), cell: ({ row }) => { - // hasAttachments 및 attachmentsList 속성이 추가되었다고 가정 - const hasAttachments = (row.original as VendorWithAttachments).hasAttachments; - const attachmentsList = (row.original as VendorWithAttachments).attachmentsList || []; - + const vendor = row.original as unknown as VendorWithAttachments; + + // 속성이 undefined일 수 있으므로 옵셔널 체이닝과 기본값 사용 + const hasAttachments = vendor.hasAttachments ?? false; + const attachmentsList = vendor.attachmentsList ?? []; + if (hasAttachments) { // 서버 액션을 사용하는 컴포넌트로 교체 return ( |
