import React from 'react';
import { Card, Table, } from 'antd';

import moment from 'moment';
import { fetch, apis } from '../../utils/request'
import PaginationWrapper from '../../components/PaginationWrapper'

const getMessageList = fetch(apis.system.taCustomerMessage)

const header = (props) => {

  const columns = [
    {
      title: '电话号码',
      dataIndex: 'phone',
      key: 'phone',
      align: 'center',
      width: 200,
    },
    {
      title: '留言内容',
      dataIndex: 'message',
      key: 'message',
      align: 'center',
      render: txt => (<p style={{ textAlign: 'left', lineHeight: '1.8em' }}>{txt}</p>)
    },
    {
      title: '创建时间',
      dataIndex: 'createDate',
      key: 'createDate',
      align: 'center',
      width: 200,
      render: (x, row) => <><span>{moment(row.createDate).format('YYYY-MM-DD')}</span></>
    },
  ];

 
  return (
    <Card>
 
    <PaginationWrapper
      request={getMessageList}
      render={data => <Table rowKey={record => record.messageId} dataSource={data.records} columns={columns} pagination={false}/>}
    >
    </PaginationWrapper>
    </Card>

  )
}


export default header
