import {Input, InputNumber} from 'antd';
import React from 'react';
import { numberUtils } from '@utils';
import { UploadEL } from '@components';
const { TextArea } = Input;
const config = (formData, mode, dispatch, loading) => {

  // 物料信息
  const basic = [{
    title: '物料编号',
    dataIndex: 'itemCode',
  }, {
    title: '物料名称',
    dataIndex: 'itemName',
  }, {
    title: '物料类别',
    dataIndex: 'c3Name',
  }, {
    title: '供应商编号',
    dataIndex: 'suppCode',
  }, {
    title: '供应商名称',
    dataIndex: 'suppName',
  }, {
    title: '供货区域',
    dataIndex: 'suppCenterName',
  }, {
    title: '执行价格',
    dataIndex: 'taxPriceStr',
  }, {
    title: '币种',
    dataIndex: 'currName',
  }, {
    title: '价格期间',
    dataIndex: 'validDate',
  }, {
    title: '调整后价格',
    dataIndex: 'adjustPrice',
    tag: <InputNumber
      min={0}
      precision={4}
      formatter={(value) => {
        var parts = value.toString().split(".");
        parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
        return parts.join(".");
      }}
      parser={(value) => value.replace(/(,*)/g, '')}
      maxLength={19} style={{ width: '100%' }}
    />,
  }, {
    title: '调整人',
    dataIndex: 'createUser',
  }, {
    title: '调整时间',
    dataIndex: 'createTime',
  }, {
    title: '调整原因',
    dataIndex: 'reason',
    tag: <TextArea autosize={{ minRows: 2, maxRows: 2 }} maxLength={500} />,
  }, {
    title: '附件',
    dataIndex: 'attachment',
    tag: <UploadEL disabled={false}
                   api={`/api/price/adjust/sfs/token?dataKey=${formData.id ? formData.id : '' }`}
                   dataKey={formData.id ? formData.id : '' }
                   listTypes={'text'}
    />
  }
  ];

  return {
    basic
  };
};

export default config;
