ant design pro 可编辑表格

import React, {useRef,} from 'react';
import {PageHeaderWrapper} from '@ant-design/pro-layout';
import {ProColumns, ActionType, TableDropdown} from '@ant-design/pro-table';
import ProTable from '@ant-design/pro-table';
import {index} from './service';

type columnsType = {
    id:number;
    apply_company_name: string;
    product_name: string
    salesperson_name: string
    applicant_name: string
    applicant_phone: string
    state: number
    created_at: any
    url:string
}
const TableList: React.FC = () => {

    const actionRef = useRef<ActionType>();

    const columns: ProColumns<columnsType>[] = [
        {
            title: '序号',
            valueType: "index",
            search: false
        },
        {
            title: '申请公司',
            dataIndex: 'apply_company_name',
            search: false
        },
        {
            title: '项目名称',
            dataIndex: 'product_name',
            search: false
        },
        {
            title: '杜邦销售姓名',
            dataIndex: 'salesperson_name',
        },
        {
            title: '表单填写人姓名',
            dataIndex: 'applicant_name',
            search: false
        },
        {
            title: '联系电话',
            dataIndex: 'applicant_phone',
            search:false
        },
        {
            title: '提交时间',
            dataIndex: 'created_at',
            valueType: 'dateTime',
            search: false
        },
        {
            title: '操作',
            valueType: 'option',
            render: (text, record, _, action) => [// 重点
                <a
                    key="editable"
                    onClick={() => {
                        action?.startEditable?.(record.id);
                    }}
                >
                    编辑
                </a>,
                <a href={record.url} target="_blank" rel="noopener noreferrer" key="view">
                    查看
                </a>,
            ],
        },
    ];
    return (
        <PageHeaderWrapper>
            <ProTable
                headerTitle=""
                actionRef={actionRef}
                rowKey="id"
                request={async (params) => {
                    console.log(params)
                    const result = await index(params);
                    return result.data;
                }}
                options={{fullScreen:true}}
                columns={columns}
                search={{filterType:"light"}}
            />
        </PageHeaderWrapper>
    );
};

export default TableList;

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ᖇꫀᧁᖇꫀᧁ

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值