表格增加序号列,移除 id 列
This commit is contained in:
@@ -250,7 +250,6 @@ export default function BatchPage() {
|
||||
<DataTable<Batch>
|
||||
{...table}
|
||||
columns={[
|
||||
{ header: "ID", accessorKey: "id" },
|
||||
{
|
||||
header: "会员号",
|
||||
accessorFn: row => row.user?.phone || "-",
|
||||
|
||||
@@ -328,7 +328,6 @@ export default function BillingPage() {
|
||||
<DataTable<Billing>
|
||||
{...table}
|
||||
columns={[
|
||||
{ header: "ID", accessorKey: "id" },
|
||||
{ header: "会员号", accessorFn: row => row.user?.phone || "-" },
|
||||
{ header: "套餐号", accessorKey: "resource.resource_no" },
|
||||
{
|
||||
|
||||
@@ -238,7 +238,6 @@ export default function ChannelPage() {
|
||||
<DataTable<Channel>
|
||||
{...table}
|
||||
columns={[
|
||||
{ header: "ID", accessorKey: "id" },
|
||||
{
|
||||
header: "会员号",
|
||||
accessorFn: row => row.user?.phone || "-",
|
||||
|
||||
@@ -35,7 +35,6 @@ export default function CouponPage() {
|
||||
<DataTable<Coupon>
|
||||
{...table}
|
||||
columns={[
|
||||
{ header: "ID", accessorKey: "id" },
|
||||
{ header: "所属用户", accessorKey: "user_id" },
|
||||
{ header: "代码", accessorKey: "code" },
|
||||
{ header: "备注", accessorKey: "remark" },
|
||||
|
||||
@@ -234,7 +234,6 @@ export default function UserPage() {
|
||||
<DataTable<Cust>
|
||||
{...table}
|
||||
columns={[
|
||||
{ header: "ID", accessorKey: "id" },
|
||||
{ header: "账号", accessorKey: "username" },
|
||||
{ header: "手机", accessorKey: "phone" },
|
||||
{ header: "邮箱", accessorKey: "email" },
|
||||
|
||||
@@ -281,7 +281,6 @@ function ResourceList({ resourceType }: ResourceListProps) {
|
||||
|
||||
const columns = useMemo(
|
||||
() => [
|
||||
{ header: "ID", accessorKey: "id" },
|
||||
{
|
||||
header: "会员号",
|
||||
accessorFn: (row: Resources) => row.user?.phone || "-",
|
||||
|
||||
@@ -258,7 +258,6 @@ export default function TradePage() {
|
||||
<DataTable<Trade>
|
||||
{...table}
|
||||
columns={[
|
||||
{ header: "ID", accessorKey: "id" },
|
||||
{
|
||||
header: "会员号",
|
||||
accessorFn: row => row.user?.phone || "-",
|
||||
|
||||
@@ -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" },
|
||||
|
||||
@@ -29,6 +29,7 @@ export type DataTableProps<T> = {
|
||||
headRow?: string
|
||||
dataRow?: string
|
||||
}
|
||||
serial?: boolean
|
||||
}
|
||||
|
||||
export function DataTable<T extends Record<string, unknown>>(
|
||||
@@ -36,7 +37,14 @@ export function DataTable<T extends Record<string, unknown>>(
|
||||
) {
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user