96 lines
2.9 KiB
JavaScript
96 lines
2.9 KiB
JavaScript
|
|
import { useEffect, useState } from "react"
|
||
|
|
import {useDispatch, useSelector} from "react-redux";
|
||
|
|
import { Table, Modal, message } from 'antd';
|
||
|
|
import { 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: '温度', key: 'wd', dataIndex: 'wd',align: "center",width:80, ellipsis: true, },
|
||
|
|
{ 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 httppost2(apiurl.home.turangshangqing)
|
||
|
|
// if(code!==200){
|
||
|
|
// return
|
||
|
|
// }
|
||
|
|
const list = [
|
||
|
|
{
|
||
|
|
id:'1',
|
||
|
|
stcd: '10001',
|
||
|
|
stnm: '水田站',
|
||
|
|
wd: '53',
|
||
|
|
tm: '2025-03-19 15:00:00',
|
||
|
|
lgtd: "114.7684000",
|
||
|
|
lttd: "31.4941000"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
id:'2',
|
||
|
|
stcd: '10002',
|
||
|
|
stnm: '旱田站',
|
||
|
|
wd: '21',
|
||
|
|
tm: '2025-03-19 15:00:00',
|
||
|
|
lgtd: "114.7984000",
|
||
|
|
lttd: "31.4941000"
|
||
|
|
},
|
||
|
|
]
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
setTableData(list)
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
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
|