mcfxkh-Web/src/views/Home/panels/Xczl/index.js

210 lines
7.6 KiB
JavaScript
Raw Normal View History

2025-06-05 18:01:20 +08:00
import React, { useMemo, useState } from 'react';
import useRequest from '../../../../utils/useRequest';
import { useDispatch, useSelector } from 'react-redux';
import PanelBox from '../../components/PanelBox';
import Table from '@material-ui/core/Table';
import TableContainer from '@material-ui/core/TableContainer';
import TableBody from '@material-ui/core/TableBody';
import TableHead from '@material-ui/core/TableHead';
import TableRow from '@material-ui/core/TableRow';
import DpTableCell from '../../../../layouts/mui/DpTableCell';
import DpTableRow from '../../../../layouts/mui/DpTableRow';
import clsx from 'clsx';
import { renderDrp } from '../../../../utils/renutils';
import XcCard from './xcCard'
import config from '../../../../config';
const data = [
{
"guid": "42118120003",
2025-06-11 15:03:25 +08:00
"code": "1",
2025-06-05 18:01:20 +08:00
"name": "浮桥河水库-汛前检查",
"resRegCode": "42000020030-A4",
"adName": "白果镇",
"engScal": "大2型",
"place": "湖北省-黄冈市-麻城市-白果镇",
2025-06-11 15:03:25 +08:00
"lgtd": "114.88169",
"lttd": "31.171967",
2025-06-05 18:01:20 +08:00
'username': '熊杰',
taskType: '日常巡查',
tm: '2025-06-02 00:08:00',
status: '进行中'
},
{
"guid": "42118120003",
"code": "",
"name": "浮桥河水库-特别巡查",
"resRegCode": "42000020030-A4",
"adName": "白果镇",
"engScal": "大2型",
"place": "湖北省-黄冈市-麻城市-白果镇",
"lgtd": "115.068090",
"lttd": "31.026170",
'username': '白斌',
taskType: '汛前巡查',
tm: '2025-06-02 00:09:00',
status: '已完成'
},
2025-06-06 16:30:16 +08:00
2025-06-05 18:01:20 +08:00
{
"guid": "42118120003",
"code": "",
2025-06-11 15:03:25 +08:00
"name": "浮桥河水库-日常管理",
2025-06-05 18:01:20 +08:00
"resRegCode": "42000020030-A4",
"adName": "白果镇",
"engScal": "大2型",
"place": "湖北省-黄冈市-麻城市-白果镇",
2025-06-06 16:30:16 +08:00
"lgtd": "115.120278",
"lttd": "31.183611",
2025-06-05 18:01:20 +08:00
'username': '周真',
taskType: '特别巡查',
tm: '2025-06-02 00:10:00',
status: '未完成'
},
{
"guid": "42118120003",
"code": "",
2025-06-11 15:03:25 +08:00
"name": "浮桥河水库-汛前检查",
2025-06-05 18:01:20 +08:00
"resRegCode": "42000020030-A4",
"adName": "白果镇",
"engScal": "大2型",
"place": "湖北省-黄冈市-麻城市-白果镇",
2025-06-06 16:30:16 +08:00
"lgtd": "115.057222",
"lttd": "31.110833",
2025-06-05 18:01:20 +08:00
'username': '陈发',
taskType: '特别巡查',
tm: '2025-06-02 00:10:00',
status: '未完成'
},
]
function DrpReal({ style }) {
const [tab, setTab] = useState('1')
const dispatch = useDispatch();
const flyTo = () => {
dispatch?.runtime.setInfoDlg({ layerId: 'XunchachaoshiLayer', properties: {} })
}
2025-06-11 16:45:01 +08:00
const setSkLayer1 = ()=>{
const map = window.__mapref;
const layer = map.getLayer('临时线')
if(layer){
map.removeLayer('临时线');
map.removeSource('临时线');
}
map.addLayer({
'id': '临时线',
'type': 'line',
'source': {
'type': 'geojson',
'data': `${window.location.origin}/data3/line2.geojson`
},
'layout': {
'line-join': 'round'
},
'paint': {
'line-color': 'red',
'line-width': 10
// [
// 'case',
// ['==', ['get', 'LEVEL'], 1], 2.2,
// ['==', ['get', 'LEVEL'], 2], 2.2,
// ['==', ['get', 'LEVEL'], 3], 2.2,
// ['==', ['get', 'LEVEL'], 4], 1.6,
// ['==', ['get', 'LEVEL'], 5], 1.3,
// 10
// ]
},
'visibility': 'visible',
});
}
2025-06-05 18:01:20 +08:00
const jumpTo = (record) => {
const { lgtd, lttd } = record;
2025-06-11 15:03:25 +08:00
const lgtdNum = Number(lgtd);
2025-06-06 16:30:16 +08:00
const lttdNum = Number(lttd)
2025-06-11 15:03:25 +08:00
if (record.code == 1) {
2025-06-11 16:45:01 +08:00
setSkLayer1()
2025-06-11 15:03:25 +08:00
if (lgtdNum && lttdNum) {
dispatch.runtime.setCameraTarget({
center: [lgtdNum, lttdNum],
zoom: 17,
pitch: config.poiPitch,
});
}
2025-06-05 18:01:20 +08:00
}
}
return (
<PanelBox
style={style}
title="巡查任务总览"
color="green"
extra={
<span className="button-group">
<span className={clsx({ active: tab === '1' })} onClick={() => setTab('1')}>本月</span>
<span className={clsx({ active: tab === '2' })} onClick={() => setTab('2')}>本年</span>
</span>
}
>
<div className='skyb-box'>
<div className='rain-yb'>
<div className='title-yb'>巡查任务</div>
</div>
</div>
<div style={{ padding: 10 }}>
<XcCard />
</div>
<TableContainer>
<Table size="small" stickyHeader>
<TableHead>
<TableRow>
<DpTableCell style={{ width: '20%' }} align="center">任务标题</DpTableCell>
<DpTableCell style={{ width: '20%' }} align="center">任务类型</DpTableCell>
<DpTableCell style={{ width: '20%' }} align="center">巡查人</DpTableCell>
<DpTableCell style={{ width: '20%' }} align="center">巡查时间</DpTableCell>
<DpTableCell style={{ width: '20%' }} align="center">状态</DpTableCell>
</TableRow>
</TableHead>
<TableBody>
{data.map((row, index) => (
<DpTableRow key={row.stcd}
2025-06-06 16:30:16 +08:00
onClick={() => jumpTo(row)}
2025-06-05 18:01:20 +08:00
>
<DpTableCell align="center">
<div
className="table-ellipsis cursor-pointer"
>{row.name}</div>
</DpTableCell>
<DpTableCell align="center">{row.taskType}</DpTableCell>
<DpTableCell align="center">{row.username}</DpTableCell>
<DpTableCell align="center">
<div
className="table-ellipsis cursor-pointer"
> {row.tm}</div>
</DpTableCell>
<DpTableCell align="center">{row.status}</DpTableCell>
</DpTableRow>
))}
</TableBody>
</Table>
</TableContainer>
2025-06-06 16:30:16 +08:00
<div className='skyb-box' style={{ marginTop: 10 }}>
2025-06-05 18:01:20 +08:00
<div className='rain-yb'>
<div className='title-yb'>数据统计</div>
</div>
</div>
<div>
<img src={`${process.env.PUBLIC_URL}/assets/sjtj1.jpg`} alt="" style={{ width: 420 }} />
<div style={{ position: 'relative' }}>
<img src={`${process.env.PUBLIC_URL}/assets/sjti2.png`} alt="" style={{ width: 205, height: 72 }} />
<img src={`${process.env.PUBLIC_URL}/assets/gantanh.png`} alt=""
style={{ width: 20, position: 'absolute', top: 12, left: 145, cursor: 'pointer' }}
onClick={flyTo}
/>
</div>
</div>
</PanelBox>
)
}
export default DrpReal;