73 lines
2.4 KiB
JavaScript
73 lines
2.4 KiB
JavaScript
import { useEffect, useState } from "react"
|
|
import {useDispatch, useSelector} from "react-redux";
|
|
import { Table, Modal, message } from 'antd';
|
|
import { httpget2, httppost2 } from '../../../utils/request';
|
|
import apiurl from '../../../service/apiurl';
|
|
|
|
|
|
const Page = () => {
|
|
const dispatch = useDispatch();
|
|
const [ tableData, setTableData ] = useState([])//在线
|
|
const columns = [
|
|
{ title: '站点', key: 'stnm', dataIndex: 'stnm',align: "center",width:80, ellipsis: true, },
|
|
{ title: '湿度(%RH)', key: 'val', dataIndex: 'val',align: "center",width:80, ellipsis: true,render:(v)=>typeof v ==='number'?v.toFixed(2):'' },
|
|
{ title: '监测时间', key: 'tm', dataIndex: 'tm',align: "center",width: 150, ellipsis: true },
|
|
];
|
|
|
|
useEffect(()=>{
|
|
dispatch.map.setLayerVisible({ TuRangLayer: true })
|
|
getData()
|
|
return ()=>{
|
|
dispatch.map.setLayerVisible({ TuRangLayer: false })
|
|
}
|
|
},[])
|
|
|
|
const getData = async()=>{
|
|
const { code, data} = await httpget2(apiurl.home.turangshangqing)
|
|
if(code!==200){
|
|
return
|
|
}
|
|
|
|
setTableData(data||[])
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
<>
|
|
<div className="home_yuqing">
|
|
<div className="ant-card-body" style={{padding:"10px"}}>
|
|
<Table rowKey="stationCode"
|
|
sticky
|
|
columns={columns}
|
|
pagination={false}
|
|
dataSource={tableData}
|
|
scroll={{ y: "300px"}}
|
|
onRow={
|
|
(row)=>({
|
|
onClick:()=>{
|
|
// dispatch.runtime.setCameraTarget({
|
|
// center: [row.lgtd, row.lttd],
|
|
// zoom: 13,
|
|
// pitch: 60
|
|
// })
|
|
dispatch.runtime.setFeaturePop({
|
|
id: row.id,
|
|
data:{...row},
|
|
type: 'turangshangqing',
|
|
lgtd: row.lgtd,
|
|
lttd: row.lttd,
|
|
})
|
|
}
|
|
})
|
|
}
|
|
/>
|
|
</div>
|
|
</div>
|
|
</>
|
|
)
|
|
}
|
|
|
|
export default Page
|