2025-03-28 17:31:43 +08:00
|
|
|
import {Table} from 'antd';
|
|
|
|
|
import React, {useEffect, useState} from 'react';
|
|
|
|
|
import moment from 'moment'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Tabledata = ({tableData}) => {
|
|
|
|
|
const columns = [
|
|
|
|
|
{ title: '序号', key: '', dataIndex: '', align: 'center',width:'40px',render:(a,b,c)=>c+1},
|
2025-04-02 09:38:49 +08:00
|
|
|
{ title: '数据时间', key: 'createTime', dataIndex: 'createTime', align: 'center',width:'200px',render: (rec) => <span>{rec ?? "-"}</span> },
|
2025-04-08 15:40:03 +08:00
|
|
|
{ title: '湿度', key: 'val', dataIndex: 'val', align: 'center',render: (rec) => <span>{getVal(rec)}</span> },
|
2025-03-28 17:31:43 +08:00
|
|
|
];
|
2025-04-08 15:40:03 +08:00
|
|
|
|
|
|
|
|
const getVal = (v)=>{
|
|
|
|
|
if(typeof v === 'number'){
|
|
|
|
|
return v.toFixed(2)
|
|
|
|
|
}else{
|
|
|
|
|
return '-'
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-03-28 17:31:43 +08:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<Table rowKey="adcd"
|
|
|
|
|
sticky
|
|
|
|
|
columns={columns}
|
|
|
|
|
pagination={false}
|
|
|
|
|
dataSource={tableData}
|
|
|
|
|
scroll={{ y: "420px"}}
|
|
|
|
|
/>
|
|
|
|
|
</>
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default Tabledata
|