
import React from 'react';
import { ColumnProps } from 'kts-components-antd-x3/lib/Table/interface';
import { PaginationConfig } from 'kts-components-antd-x3/lib/Table';
import { GetFieldDecoratorOptions } from 'kts-components-antd-x3/lib/form/Form';

export interface IGetBuyerListOption {
  /** 分页数据 */
  pagination: PaginationConfig;
}

export interface IFormItem {
  id: string;
  label: string;
  node: React.ReactNode;
  options: GetFieldDecoratorOptions;
}

export interface IBuyerInfo {
  /** 购买方名称 */
  buyerName?: string;

  /** 购买方纳税人识别号 */
  buyerNo?: string;

  /** 购买方地址及电话 */
  buyerAddress?: string;

  /** 购买方开户行及账号 */
  buyerBank?: string;
}

/** 自动填充 */
export interface IAutoContainer {

  /** 购买方变化 */
  onBuyNameChange: (e?: string) => Promise<{ recent?: IBuyerInfo[], list?: IBuyerInfo[] }>;
}

export default class BuyerState {

  /** 表头 */
  columns: ColumnProps<any>[] = [
    {
      title: '公司名称',
      dataIndex: 'buyerName',
      key: 'buyerName',
    },
    {
      title: '纳税人识别号',
      dataIndex: 'buyerNo',
      key: 'buyerNo',
    },
    {
      title: '地址',
      dataIndex: 'address',
      key: 'address',
    },
    {
      title: '电话',
      dataIndex: 'phone',
      key: 'phone',
    },
    {
      title: '开户行及账号',
      dataIndex: 'buyerBank',
      key: 'buyerBank',
    },
  ];

  /** 行点击事件 */
  onRowClick = async (record: any) => record;

  /** 购方列表 */
  dataSource: any = [];

  /** 分页数据 */
  pagination: PaginationConfig = {};

  /** 是否显示导入 */
  isVisibleDrawer = false;

  /** 顶部扩展 */
  topExpand?: React.ReactNode;

  /** 自动填充 */
  autoContainer?: IAutoContainer;
}
