39 lines
1.0 KiB
JavaScript
39 lines
1.0 KiB
JavaScript
import {Table} from 'antd';
|
|
import React, {useEffect, useState} from 'react';
|
|
import moment from 'moment'
|
|
|
|
|
|
const Tabledata = ({data}) => {
|
|
const columns = [
|
|
{title: '时间', key: '', dataIndex: '', align: 'center',render:(rec)=>moment(rec.tm).format('MM-DD HH:mm')},
|
|
// {
|
|
// title: '雨量(mm)', key: 'drp', dataIndex: 'drp', align: 'center',
|
|
// render: (rec) => <span>{rec ?? "-"}</span>
|
|
// },
|
|
{
|
|
title: '水位(m)', key: 'z', dataIndex: 'z', align: 'center',
|
|
render: (rec) => <span>{rec ? rec.toFixed(2) : "-"}</span>
|
|
},
|
|
{
|
|
title: '转换流量(m³/s)', key: 'tq', dataIndex: 'tq', align: 'center',
|
|
render: (rec) => <span>{rec ?? "-"}</span>
|
|
},
|
|
];
|
|
const [tableData, setTableData] = useState([])
|
|
useEffect(()=>{
|
|
setTableData(data)
|
|
})
|
|
return (
|
|
<>
|
|
<Table rowKey="adcd"
|
|
sticky
|
|
columns={columns}
|
|
pagination={false}
|
|
dataSource={tableData}
|
|
/>
|
|
</>
|
|
)
|
|
|
|
}
|
|
|
|
export default Tabledata |