diff --git a/src/app/(root)/batch/page.tsx b/src/app/(root)/batch/page.tsx index ffe789c..0fde74a 100644 --- a/src/app/(root)/batch/page.tsx +++ b/src/app/(root)/batch/page.tsx @@ -250,7 +250,6 @@ export default function BatchPage() { {...table} columns={[ - { header: "ID", accessorKey: "id" }, { header: "会员号", accessorFn: row => row.user?.phone || "-", diff --git a/src/app/(root)/billing/page.tsx b/src/app/(root)/billing/page.tsx index df23de3..4eef580 100644 --- a/src/app/(root)/billing/page.tsx +++ b/src/app/(root)/billing/page.tsx @@ -328,7 +328,6 @@ export default function BillingPage() { {...table} columns={[ - { header: "ID", accessorKey: "id" }, { header: "会员号", accessorFn: row => row.user?.phone || "-" }, { header: "套餐号", accessorKey: "resource.resource_no" }, { diff --git a/src/app/(root)/channel/page.tsx b/src/app/(root)/channel/page.tsx index 845edf6..086b83e 100644 --- a/src/app/(root)/channel/page.tsx +++ b/src/app/(root)/channel/page.tsx @@ -238,7 +238,6 @@ export default function ChannelPage() { {...table} columns={[ - { header: "ID", accessorKey: "id" }, { header: "会员号", accessorFn: row => row.user?.phone || "-", diff --git a/src/app/(root)/coupon/page.tsx b/src/app/(root)/coupon/page.tsx index 1287010..d02f894 100644 --- a/src/app/(root)/coupon/page.tsx +++ b/src/app/(root)/coupon/page.tsx @@ -35,7 +35,6 @@ export default function CouponPage() { {...table} columns={[ - { header: "ID", accessorKey: "id" }, { header: "所属用户", accessorKey: "user_id" }, { header: "代码", accessorKey: "code" }, { header: "备注", accessorKey: "remark" }, diff --git a/src/app/(root)/cust/page.tsx b/src/app/(root)/cust/page.tsx index 50e60d6..859acb5 100644 --- a/src/app/(root)/cust/page.tsx +++ b/src/app/(root)/cust/page.tsx @@ -234,7 +234,6 @@ export default function UserPage() { {...table} columns={[ - { header: "ID", accessorKey: "id" }, { header: "账号", accessorKey: "username" }, { header: "手机", accessorKey: "phone" }, { header: "邮箱", accessorKey: "email" }, diff --git a/src/app/(root)/resources/page.tsx b/src/app/(root)/resources/page.tsx index 3f9d23c..d69ba8a 100644 --- a/src/app/(root)/resources/page.tsx +++ b/src/app/(root)/resources/page.tsx @@ -281,7 +281,6 @@ function ResourceList({ resourceType }: ResourceListProps) { const columns = useMemo( () => [ - { header: "ID", accessorKey: "id" }, { header: "会员号", accessorFn: (row: Resources) => row.user?.phone || "-", diff --git a/src/app/(root)/trade/page.tsx b/src/app/(root)/trade/page.tsx index 46bad90..4881f31 100644 --- a/src/app/(root)/trade/page.tsx +++ b/src/app/(root)/trade/page.tsx @@ -258,7 +258,6 @@ export default function TradePage() { {...table} columns={[ - { header: "ID", accessorKey: "id" }, { header: "会员号", accessorFn: row => row.user?.phone || "-", diff --git a/src/app/(root)/user/page.tsx b/src/app/(root)/user/page.tsx index 2df0c76..5569628 100644 --- a/src/app/(root)/user/page.tsx +++ b/src/app/(root)/user/page.tsx @@ -150,7 +150,6 @@ export default function UserPage() { data={userList || []} status={loading ? "load" : "done"} columns={[ - { header: "ID", accessorKey: "id" }, { header: "账号", accessorKey: "username" }, { header: "手机", accessorKey: "phone" }, { header: "邮箱", accessorKey: "email" }, diff --git a/src/components/data-table/component.tsx b/src/components/data-table/component.tsx index cd5e8bb..a775744 100644 --- a/src/components/data-table/component.tsx +++ b/src/components/data-table/component.tsx @@ -29,6 +29,7 @@ export type DataTableProps = { headRow?: string dataRow?: string } + serial?: boolean } export function DataTable>( @@ -36,7 +37,14 @@ export function DataTable>( ) { const table = useReactTable({ data: props.data, - columns: props.columns, + columns: [ + { + id: "serial", + header: "#", + cell: ({ row }) => row.index + 1, + }, + ...props.columns, + ], getCoreRowModel: getCoreRowModel(), manualPagination: true, rowCount: props.pagination?.total,