import React from 'react';
import {connect} from 'dva';
import {stringUtils} from '@utils';
import {DataTable, UdcSelect} from '@components';
import {Card, DatePicker, Input, message} from 'antd';
import CascaderItem from '../../components/CascaderItem/CascaderItem';

const BidGroup = ({dispatch, bidGroup, loading}) => {
  const {list, total, mode, addBtnFlag, editBtnFlag,  viewBtnFlag, deleteBtnFlag} = bidGroup;

  const domain = 'bidGroup';
  const domainCN = '评标小组';

  const tableProps = {
    rowKey: 'id',
    limit: stringUtils.queryURL('limit'),
    offset: stringUtils.queryURL('offset'),
    sortBy: stringUtils.queryURL('sortBy') || 'ID',
    sortDirection: stringUtils.queryURL('sortDirection') || 'DESC',
    scroll: {x: '100%', y: 400},
    domain,
    dispatch,
    loading,
    total,
    showAdd: addBtnFlag ,
    showEdit: editBtnFlag,
    showDelete: deleteBtnFlag,
    showView: viewBtnFlag,
    dataSource: list,
    // mode,
    // record: currentItem,
    // visible: modalVisible,
    // maskClosable: false,
    width: '60%',
    confirmLoading: mode === 'create' ? loading.effects[`${domain}/create`] : loading.effects[`${domain}/update`],
    readOnly: mode === 'view',

    filter: [{
      title: '小组名称',
      dataIndex: 'groupName',
      tag: <Input placeholder="小组名称"/>,
    }, {
      title: '物料品类',
      dataIndex: 'itemC3Id',
      tag: <UdcSelect domain="SUPP" code="GYSYLSX" />,
      options: {
        initialValue: '',
      },
    }],
    columns: [{
      title: '小组名称',
      dataIndex: 'groupName',
      width: '30%',
    }, {
      title: '物料品类',
      dataIndex: 'itemC3Name',
      width: '30%',
    }, {
      title: '小组说明',
      dataIndex: 'memo',
      width: '30%',
    }],
  };

  return (
    <div className="content-inner">
      <DataTable {...tableProps} />
    </div>
  );

};

export default connect(({bidGroup, loading}) => ({bidGroup, loading}))(BidGroup);
