constant.tsx 2.08 KB
import { TableDropdown } from '@ant-design/pro-components';

export type InvoiceItem = {
  id: number; //id
  invoiceStatus: string; //发票类型:专票/普票
  invoiceNumber: string; //发票号码
  status: string; //状态
  purchaser: string; //购买方
  payee: string; //收款单位
  contacts: string; //联系人
  sale: string; //销售
  money: number; //金额
  invoicingTime: string; //开票日期
  collectionTime: string; //收款时间
  notes: string; //备注
};

export const INVOICE_COLUMNS = [
  {
    dataIndex: 'invoiceNumber',
    title: '发票号码',
    valueType: 'text',
    width: 80,
  },
  {
    dataIndex: 'invoiceStatus',
    title: '发票类型',
    valueType: 'select',
    width: 80,
  },
  {
    title: '状态',
    dataIndex: 'status',
    valueType: 'text',
    width: 80,
  },
  {
    title: '购买方',
    dataIndex: 'purchaser',
    valueType: 'text',
    width: 80,
  },
  {
    title: '收款单位',
    dataIndex: 'payee',
    valueType: 'text',
    width: 80,
  },
  {
    title: '联系人',
    dataIndex: 'contacts',
    valueType: 'text',
    width: 80,
  },
  {
    title: '销售',
    dataIndex: 'sale',
    valueType: 'text',
    width: 80,
  },
  {
    title: '金额',
    dataIndex: 'money',
    valueType: 'money',
    width: 80,
  },
  {
    title: '开票日期',
    dataIndex: 'invoicingTime',
    valueType: 'date',
    width: 80,
  },
  {
    title: '收款时间',
    dataIndex: 'collectionTime',
    valueType: 'dateTime',
    width: 80,
  },
  {
    title: '操作',
    valueType: 'option',
    key: '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>,
      <TableDropdown
        key="actionGroup"
        onSelect={() => action?.reload()}
        menus={[
          { key: 'copy', name: '复制' },
          { key: 'delete', name: '删除' },
        ]}
      />,
    ],
  },
];