import React,{ useState, useEffect, } from 'react'
import {
  Card,
  Input,
  Button
} from 'antd';
import PageContainer from '@/components/BasePageContainer';
import { connect } from 'react-redux';
import ProTable from '@ant-design/pro-table';
import { get, post } from '../../services';
const TestTable = ()=> {
  const [data,setData] = useState([])
  //搜索框时间
  useEffect(() =>{
    get(`/Cityinterface/rest/services/OMS.svc/S_GetConnRecord`, {
      _version: 9999,
      dc: 1603334559186,
    }).then( res =>{
      if(res){
        setData(res)
      }
      console.log(res)
    }).catch( err =>{
      console.error(err)
    })
  },[])
  const columns = [
    {
      title: '服务器名或IP地址',
      dataIndex: 'ip',
      key: 'ip',
    },
    {
      title: '数据库名称',
      dataIndex: 'dbName',
      key: 'dbName',
    },
    {
      title: '数据库用户名称',
      dataIndex: 'userName',
      key: 'userName',
    },
    {
      title: '保存时间',
      dataIndex: 'saveTime',
      key: 'saveTime',
    },
    {
      title: '描述',
      dataIndex: 'desc',
      key: 'desc',
    },
    {
      title: '修改描述',
      dataIndex: 'name',
      key: 'name',
      filters:true,
      valueType: 'dateTime'
      // render: () => {
      //   return <Button type='primary' onClick={ ()=>{changeDesc()}}>修改描述</Button>;
      // },
    },
    {
      title: '操作',
      dataIndex: 'option',
      valueType: 'option',
      render: (_, record) => (  
        <>
          <Button
          >
            修改描述
          </Button>
          <Button href="">删除</Button>
        </>
      ),
    },
  ];
  return (
    <>
      <PageContainer>
          <Card></Card>
          <ProTable
            style={{marginTop:'20px'}}
            headerTitle='表格'
            rowKey="key"
            search={{labelWidth:100}}
            columns={columns}
            bordered
            dataSource={data}
          />
      </PageContainer>
    </>
  )
}

export default connect()(TestTable)