TestTable.jsx 2.01 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
import React,{ useState, useEffect, } from 'react'
import {
  Card,
  Input,
  Button
} from 'antd';
import { PageContainer } from '@ant-design/pro-layout';
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)