diff --git a/src/service/apiurl.js b/src/service/apiurl.js index 8c63985d5..fd04d7e0e 100644 --- a/src/service/apiurl.js +++ b/src/service/apiurl.js @@ -413,7 +413,9 @@ const apiurl = { edit: service_fxdd + "/termite/survey/update", delete: service_fxdd + "/termite/survey/del", detail: service_fxdd + "/termite/survey/detail", - dictionary:service_fxdd + "/sysDictB/listByCd" + dictionary: service_fxdd + "/sysDictB/listByCd", + allCd: service_fxdd + '/termite/survey/list/allOrder', + historyPage:service_fxdd + '/termite/survey/detail', }, fzxc: { page: service_fxdd + "/termite/adver/file/page", diff --git a/src/views/Home/MapCtrl/Pops/ShenLiu/drpOption.js b/src/views/Home/MapCtrl/Pops/ShenLiu/drpOption.js index a8487ff29..bf7393ac5 100644 --- a/src/views/Home/MapCtrl/Pops/ShenLiu/drpOption.js +++ b/src/views/Home/MapCtrl/Pops/ShenLiu/drpOption.js @@ -47,7 +47,7 @@ export default function drpOption(data,yjData) { { type: 'category', data: data.map(o => o.tm), - inverse: false, + inverse: true, splitLine: { show: false }, diff --git a/src/views/Home/MapCtrl/Pops/ShenYa/drpOption.js b/src/views/Home/MapCtrl/Pops/ShenYa/drpOption.js index 136e632f1..7fb7368dc 100644 --- a/src/views/Home/MapCtrl/Pops/ShenYa/drpOption.js +++ b/src/views/Home/MapCtrl/Pops/ShenYa/drpOption.js @@ -47,7 +47,7 @@ export default function drpOption(data,yjData) { { type: 'category', data: data.map(o => o.tm), - inverse: false, + inverse: true, splitLine: { show: false }, diff --git a/src/views/Home/MapCtrl/Pops/WeiYi/TableData.js b/src/views/Home/MapCtrl/Pops/WeiYi/TableData.js index eff5e41e9..c16f66cb9 100644 --- a/src/views/Home/MapCtrl/Pops/WeiYi/TableData.js +++ b/src/views/Home/MapCtrl/Pops/WeiYi/TableData.js @@ -3,14 +3,14 @@ import React, {useEffect, useState} from 'react'; import moment from 'moment' -const Tabledata = ({tableData}) => { +const Tabledata = ({ tableData }) => { const columns = [ { title: '序号', key: '', dataIndex: '', align: 'center',render:(a,b,c)=>c+1}, { title: '时间', key: 'tm', dataIndex: 'tm', align: 'center',render: (rec) => {rec ?? "-"} }, { title: '库水位(m)', key: 'rz', dataIndex: 'rz', align: 'center',render: (rec) => {rec ?? "-"} }, - { title: 'X方向位移(mm)', key: 'x', dataIndex: 'x', align: 'center',render: (rec) => {rec ?? "-"}}, - { title: 'Y方向位移(mm)', key: 'y', dataIndex: 'y', align: 'center',render: (rec) => {rec ?? "-"}}, - { title: 'H方向位移(mm)', key: 'h', dataIndex: 'h', align: 'center',render: (rec) => {rec ?? "-"}}, + { title: 'X方向位移(mm)', key: 'de', dataIndex: 'de', align: 'center',render: (rec) => {rec ?? "-"}}, + { title: 'Y方向位移(mm)', key: 'dn', dataIndex: 'dn', align: 'center',render: (rec) => {rec ?? "-"}}, + { title: 'H方向位移(mm)', key: 'du', dataIndex: 'du', align: 'center',render: (rec) => {rec ?? "-"}}, ]; diff --git a/src/views/Home/MapCtrl/Pops/WeiYi/drpOption.js b/src/views/Home/MapCtrl/Pops/WeiYi/drpOption.js index 9af0d8484..232d44289 100644 --- a/src/views/Home/MapCtrl/Pops/WeiYi/drpOption.js +++ b/src/views/Home/MapCtrl/Pops/WeiYi/drpOption.js @@ -1,7 +1,7 @@ export default function drpOption(data,yjData) { console.log("data",data); - const max1 = Math.max(...[...data.map(obj => obj.x),...data.map(obj => obj.y),...data.map(obj => obj.h),...yjData.map(obj => obj.value)]) - const min1 = Math.min(...[...data.map(obj => obj.x),...data.map(obj => obj.y),...data.map(obj => obj.h),...yjData.map(obj => obj.value)]) + const max1 = Math.max(...[...data.map(obj => obj.de),...data.map(obj => obj.dn),...data.map(obj => obj.du),...yjData.map(obj => obj.value)]) + const min1 = Math.min(...[...data.map(obj => obj.de),...data.map(obj => obj.dn),...data.map(obj => obj.du),...yjData.map(obj => obj.value)]) const max2 = Math.max(...data.map(obj => obj.rz)) const min2 = Math.min(...data.map(obj => obj.rz)) @@ -49,7 +49,7 @@ export default function drpOption(data,yjData) { { type: 'category', data: data.map(o => o.tm), - inverse: false, + inverse: true, splitLine: { show: false }, @@ -75,7 +75,7 @@ export default function drpOption(data,yjData) { // gridIndex: 1, type: 'value', position: 'left', - name: "位移(m)", + name: "位移(mm)", nameTextStyle: { padding: [0, 0, 10, 10], color:'#333333', diff --git a/src/views/Home/MapCtrl/Pops/WeiYi/index.js b/src/views/Home/MapCtrl/Pops/WeiYi/index.js index c355605e2..6af84fd08 100644 --- a/src/views/Home/MapCtrl/Pops/WeiYi/index.js +++ b/src/views/Home/MapCtrl/Pops/WeiYi/index.js @@ -88,7 +88,7 @@ function ShenYa({ id, data, dispatch, onCancel }) {
- {data.stationCode} + {data.cdnm}
diff --git a/src/views/Home/homePanelsLayoutPage/item_gongcheng.js b/src/views/Home/homePanelsLayoutPage/item_gongcheng.js index 7b8929544..7044ed496 100644 --- a/src/views/Home/homePanelsLayoutPage/item_gongcheng.js +++ b/src/views/Home/homePanelsLayoutPage/item_gongcheng.js @@ -29,7 +29,7 @@ const Page = () => { ] }else{ return [ - { title: '监测点', key: 'cd', dataIndex: 'cd',align: "center",width: 80, ellipsis: true }, + { title: '监测点', key: 'cdnm', dataIndex: 'cdnm',align: "center",width: 80, ellipsis: true }, { title: '监测时间', key: 'tm', dataIndex: 'tm',align: "center",width: 80, ellipsis: true, render:(v,row)=>
{v?.slice(5,10)}
{v?.slice(11,16)}
}, { title:
x方向
(mm)
, key: 'de', dataIndex: 'de',align: "center", ellipsis: true, render:(v,row)=>
{v}
}, { title:
y方向
(mm)
, key: 'dn', dataIndex: 'dn',align: "center", ellipsis: true, render:(v,row)=>
{v}
}, diff --git a/src/views/gcaqjc/gcaqyj/yhyj/index.js b/src/views/gcaqjc/gcaqyj/yhyj/index.js index c8ac6d487..7caafc747 100644 --- a/src/views/gcaqjc/gcaqyj/yhyj/index.js +++ b/src/views/gcaqjc/gcaqyj/yhyj/index.js @@ -57,7 +57,8 @@ const Page = () => { {record.valueTwo || ''} }, - { title: '校验规则描述', key: 'ruleDesc', dataIndex: 'ruleDesc', width: 250, ellipsis: true,align:"center", }, + { title: '校验规则描述', key: 'ruleDesc', dataIndex: 'ruleDesc', width: 250, ellipsis: true, align: "center", }, + { title: '处理建议', key: 'resolveSuggest', dataIndex: 'resolveSuggest', width: 200, ellipsis: true, align:"center" }, ]; diff --git a/src/views/gcaqjc/gcaqyj/yjgzpz/form.js b/src/views/gcaqjc/gcaqyj/yjgzpz/form.js index 8416a0b13..1ed629d96 100644 --- a/src/views/gcaqjc/gcaqyj/yjgzpz/form.js +++ b/src/views/gcaqjc/gcaqyj/yjgzpz/form.js @@ -1,92 +1,92 @@ -import React,{useEffect,useState,useMemo} from 'react'; -import { Form, Button, Input, Row, Col, DatePicker, Upload,message,Image,Modal,Radio } from 'antd'; +import React, { useEffect, useState, useMemo } from 'react'; +import { Form, Button, Input, Row, Col, DatePicker, Upload, message, Image, Modal, Radio } from 'antd'; import { formItemLayout, btnItemLayout } from '../../../../components/crud/FormLayoutProps'; import apiurl from '../../../../service/apiurl'; import NormalSelect from '../../../../components/Form/NormalSelect'; import { httppost2 } from '../../../../utils/request'; import moment from 'moment'; -const ModalForm = ({ mode, record,onEdit,onSave,onSimilarSave }) => { +const ModalForm = ({ mode, record, onEdit, onSave, onSimilarSave }) => { const optionsType = [ { label: "渗压监测", - value:1 + value: 1 }, { label: "渗流监测", - value:2 + value: 2 }, { - label:"位移监测", - value:3 + label: "位移监测", + value: 3 }, ] const optionsLevel = [ { label: "黄色告警", - value:1 + value: 1 }, { label: "红色告警", - value:2 + value: 2 }, ] const conditionOneType = [ { label: ">", - value:">" + value: ">" }, { label: "<", - value:"<" + value: "<" }, { label: "=", - value:"=" + value: "=" }, { label: ">=", - value:">=" + value: ">=" }, { label: "<=", - value:"<=" + value: "<=" }, { label: "!=", - value:"!=" + value: "!=" }, ] - + const condition = [ { label: "且", - value:1 + value: 1 }, { label: "或", - value:2 + value: 2 }, ] const wyOptions = [ { label: "X方向", - value:"x" + value: "x" }, { label: "Y方向", - value:"y" + value: "y" }, { label: "H方向", - value:"h" + value: "h" }, ] - console.log("record",record); + console.log("record", record); const [form] = Form.useForm(); const [staCodeList, setStaCodeList] = useState([])//渗压 const [Condition, setCondition] = useState("") @@ -94,16 +94,16 @@ const ModalForm = ({ mode, record,onEdit,onSave,onSimilarSave }) => { const [slStacodeList, setSlStacodeList] = useState([])//渗流 const onFinish = (values) => { values.valueOne = values.valueOne ? Number(values.valueOne) : '' - values.valueTwo = values.valueTwo ? Number(values.valueTwo) : '' + values.valueTwo = values.valueTwo ? Number(values.valueTwo) : '' if (mode === 'edit') { values.id = record.id; values.createTime = record.createTime - onEdit(apiurl.gcaqjc.gcaqyj.yjgzpz.edit,values) + onEdit(apiurl.gcaqjc.gcaqyj.yjgzpz.edit, values) } if (mode === 'save') { - onSave(apiurl.gcaqjc.gcaqyj.yjgzpz.save,values) + onSave(apiurl.gcaqjc.gcaqyj.yjgzpz.save, values) } - + } const [codeList, setCodeList] = useState([])//位移 @@ -111,7 +111,7 @@ const ModalForm = ({ mode, record,onEdit,onSave,onSimilarSave }) => { const getwYCode = async () => { try { const res = await httppost2(apiurl.gcaqjc.sjtjcx.wycx.list) - setCodeList(res.data.map(s=>({stationCode:s.cd,label:s.cdNm,value:s.cd})));// + setCodeList(res.data.map(s => ({ stationCode: s.cd, label: s.cdNm, value: s.cd })));// } catch (error) { console.log(error); } @@ -120,23 +120,23 @@ const ModalForm = ({ mode, record,onEdit,onSave,onSimilarSave }) => { const getSlCode = async () => { try { const res = await httppost2(apiurl.gcaqjc.sjtjcx.wycx.slList) - setSlStacodeList(res.data.map(s=>({stationCode:s.dvcd,label:s.dvcd,value:s.dvcd}))); + setSlStacodeList(res.data.map(s => ({ stationCode: s.dvcd, label: s.dvcd, value: s.dvcd }))); } catch (error) { console.log(error); } } - const getStationCode = async () => { - try { - const res = await httppost2(apiurl.gcaqjc.gcaqyj.yjgzpz.list) - setStaCodeList(res.data.map(s=>({stationCode:s.dvcd,label:s.dvcd,value:s.dvcd}))); - } catch (error) { - console.log(error); + const getStationCode = async () => { + try { + const res = await httppost2(apiurl.gcaqjc.gcaqyj.yjgzpz.list) + setStaCodeList(res.data.map(s => ({ stationCode: s.dvcd, label: s.dvcd, value: s.dvcd }))); + } catch (error) { + console.log(error); + } } -} - - useEffect(()=>{ - if (mode !== "save" ) { - // getFileInfo(record) + + useEffect(() => { + if (mode !== "save") { + // getFileInfo(record) setCondition(record?.condition) setTypes(record.type) } @@ -149,10 +149,10 @@ const ModalForm = ({ mode, record,onEdit,onSave,onSimilarSave }) => { }, []) useEffect(() => { if (mode == "save") { - form.setFieldValue("status", 1) + form.setFieldValue("status", 1) } }, [mode]) - + return ( <>
{ onFinish={onFinish} initialValues={record} > - + - + setTypes(e)} /> - + - + { options={optionsLevel} /> - - - - - - - - - - - - - - - - - {types != 3 ? - <> - - - - - - + + + + - - - - - + > { setCondition(e)} } - /> + options={ + types == 3 ? codeList : + types == 1 ? staCodeList : slStacodeList + } /> - - - - - - - - + label="校验规则描述" + rules={[{ required: true }]} + name="ruleDesc" + > + - + + {types != 3 ? + <> + + + + + + + + + + + + + + + { setCondition(e) }} + /> + + + + + + + + + + + + + + + : <> - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - { setCondition(e)} } - /> - - - - - - - - - - - - - + > + + + + + + { setCondition(e) }} + /> + + + + + + + + + + + + + - } + } - - - 启用 - 不启用 + + + 启用 + 不启用 - - - - { - mode==='view'?null:( - <> - - - - - ) - } + '修改'} + + + + ) + }
); diff --git a/src/views/rcgl/byfz/bypc/index.js b/src/views/rcgl/byfz/bypc/index.js index 396b37fa6..9d105a5f9 100644 --- a/src/views/rcgl/byfz/bypc/index.js +++ b/src/views/rcgl/byfz/bypc/index.js @@ -1,51 +1,58 @@ -import React, { Fragment, useRef, useMemo,useEffect,useState } from 'react'; +import React, { Fragment, useRef, useMemo, useEffect, useState } from 'react'; import BasicCrudModal from '../../../../components/crud/BasicCrudModal'; -import { Table, Card, Modal, Form, Input, Button, Row,Col, Timeline, message, Tabs,Image,Tag } from 'antd'; -import {FileWordOutlined,FilePdfOutlined,FileZipOutlined,FileExcelOutlined } from '@ant-design/icons'; -import { useSelector } from 'react-redux'; +import { Table, Card, Modal, Form, Input, Button, Row, Col, Timeline, message, Tabs, Image, Tag } from 'antd'; +import { FileWordOutlined, FilePdfOutlined, FileZipOutlined, FileExcelOutlined } from '@ant-design/icons'; +import { useSelector, useDispatch } from 'react-redux'; import ToolBar from './toolbar'; import ModalForm from './form'; import apiurl from '../../../../service/apiurl'; import usePageTable from '../../../../components/crud/usePageTable2'; import { createCrudService } from '../../../../components/crud/_'; -import { httppost2 } from '../../../../utils/request'; -import {CrudOpRender_text} from '../../../../components/crud/CrudOpRender'; +import { httppost2, httpget2 } from '../../../../utils/request'; +import { CrudOpRender_text } from '../../../../components/crud/CrudOpRender'; +import PointHistory from './pointHistory'; import './index.less'; import moment from 'moment'; +// 引入OpenLayers相关依赖 +import Map from 'ol/Map'; +import View from 'ol/View'; +import TileLayer from 'ol/layer/Tile'; +import XYZSource from 'ol/source/XYZ'; +import * as proj from 'ol/proj'; +import Feature from 'ol/Feature'; +import Point from 'ol/geom/Point'; +import { Vector as VectorLayer } from 'ol/layer'; +import { Vector as VectorSource } from 'ol/source'; +import { Circle as CircleStyle, Fill, Stroke, Style, Text } from 'ol/style'; +import Overlay from 'ol/Overlay'; const url = "http://223.75.53.141:9100/gs-tsg" const Page = () => { const role = useSelector(state => state.auth.role); const editBtn = role?.rule?.find(item => item.menuName == "编辑") || true; - const viewBtn = role?.rule?.find(item => item.menuName == "查看")|| true; + const viewBtn = role?.rule?.find(item => item.menuName == "查看") || true; const delBtn = role?.rule?.find(item => item.menuName == "删除") || true; const initData = { obDate: moment().format('YYYY-MM-DD') } - - const [stats, setStats] = useState({ - total: 400, - withMosquito: 14, - withoutMosquito: 382, - noData: 4 - }); - const surveyType = { - 1: "日常检查排查", - 2: "定期普查", - 3:"专项调查" - } - const surveyWay = { - 1: "人工排查法", - 2: "引诱法", - 3: "仪器探测法", - 4:"其他" - } - const isHarm = { - 0: "无危害", - 1: "有危害", - } + // 添加地图相关的状态和引用 + const mapContainerRef = useRef(null); + const [map, setMap] = useState(null); + const [vectorLayer, setVectorLayer] = useState(null); + const [selectedFeature, setSelectedFeature] = useState(null); + const [popupOverlay, setPopupOverlay] = useState(null); + const popupRef = useRef(null); + // 在组件顶部的状态声明中添加一个新的状态 + const [highlightLayer, setHighlightLayer] = useState(null); + // 点位弹框 + const [modalVisible, setModalVisible] = useState(false) + const [detailPoint, setDetailPoint] = useState({}) + const dispatch = useDispatch(); + + const refModal = useRef(); - const [searchVal, setSearchVal] = useState({...initData}) + const [searchVal, setSearchVal] = useState({ ...initData }) const [count, setCount] = useState({}) + const [allCdList, setAllCdList] = useState([]) // const columns = [ // { title: '序号', key: 'inx', dataIndex: 'inx', width: 60, align: "center" }, // {title: '填报日期', key: 'reportDate', dataIndex: 'reportDate', width: 140,}, @@ -56,7 +63,7 @@ const Page = () => { // { // title: '普查方式', key: 'surveyWay', dataIndex: 'surveyWay', width: 200, // render: (value) => {value ? surveyWay[value] : ''} - + // }, // { // title: '危害情况', key: 'isHarm', dataIndex: 'isHarm', width: 200, @@ -83,34 +90,34 @@ const Page = () => { dataIndex: 'obDate', key: 'obDate', width: 180, - align:'center' + align: 'center' }, { title: '测点编号', dataIndex: 'order', key: 'order', width: 120, - align:'center' + align: 'center' }, { title: '有无白蚁', dataIndex: 'status', - align:'center', + align: 'center', key: 'status', width: 100, - render:(text, record) => { + render: (text, record) => { // 如果 isHarm 为 null 或 undefined,显示无 if (text == null) { - return ; + return ; } - + // 如果 isHandle 为 null 或 undefined,当作 false 处理 const isHandle = record.isHandle ?? false; - + return ( - {!text ? '无' : '有'} @@ -119,7 +126,7 @@ const Page = () => { } ]; const width = useMemo(() => columns.reduce((total, cur) => total + (cur.width), 0), [columns]); - + const command = (type) => (params) => { if (type === 'save') { refModal.current.showSave(); @@ -131,18 +138,18 @@ const Page = () => { refModal.current.onDeleteGet(apiurl.rcgl.byfz.bypc.delete + `/${params.id}`); } } - - + + const { tableProps, search, refresh } = usePageTable(createCrudService(apiurl.rcgl.byfz.bypc.page).find_noCode); - /** - * @description 处理成功的回调 - */ - const successCallback = () => { - refresh() + /** + * @description 处理成功的回调 + */ + const successCallback = () => { + refresh() } - + // 获取白蚁统计数量 const getCount = async () => { const params = { @@ -157,82 +164,343 @@ const Page = () => { setCount(res.data); } catch (error) { console.log(error); - + } } + + // 获取白蚁所有测点 + const getCdList = async () => { + + try { + const res = await httpget2(apiurl.rcgl.byfz.bypc.allCd); + if (res.code == 200) { + setAllCdList(res.data); + // 添加标记点到地图 + if (map && res.data && res.data.length > 0) { + addMarkersToMap(res.data); + } + } + } catch (error) { + console.log(error); + + } + } + + // 添加标记点到地图 + const addMarkersToMap = (points) => { + if (!map) return; + + // 如果已存在矢量图层,先移除 + if (vectorLayer) { + map.removeLayer(vectorLayer); + } + + // 创建矢量数据源 + const vectorSource = new VectorSource(); + + // 遍历所有点位数据 + points.forEach(point => { + // 确保点位有经纬度 + if (point.lgtd && point.lttd) { + // 创建要素 + const feature = new Feature({ + geometry: new Point(proj.fromLonLat([point.lgtd, point.lttd])), + properties: point // 保存点位的所有属性 + }); + + // 根据status设置样式 + const color = point.status === 1 ? '#d9001b' : '#04d919'; // 1为红色,0为绿色 + + feature.setStyle(new Style({ + image: new CircleStyle({ + radius: 4, + fill: new Fill({ color: color }), + stroke: new Stroke({ color: '#ffffff', width: 1 }) + }) + })); + + // 添加要素到数据源 + vectorSource.addFeature(feature); + } + }); + + // 创建矢量图层 + const newVectorLayer = new VectorLayer({ + source: vectorSource, + zIndex: 10 // 确保点位在地图上层显示 + }); + + // 添加图层到地图 + map.addLayer(newVectorLayer); + + // 保存矢量图层引用 + setVectorLayer(newVectorLayer); + + // 添加点击事件处理 + // map.on('click', (event) => { + // const feature = map.forEachFeatureAtPixel(event.pixel, function(feature) { + // return feature; + // }); + + // if (feature) { + // const properties = feature.get('properties'); + // if (properties) { + // // 可以在这里处理点击事件,比如显示详情等 + // console.log('点击了标记点:', properties); + // // 可以添加弹窗或其他交互 + // } + // } + // }); + }; + + + // 修改高亮显示选中的测点函数 + const highlightFeature = (feature) => { + if (!feature || !highlightLayer) return; + + // 清除之前的高亮 + highlightLayer.getSource().clear(); + + // 获取要素属性 + const properties = feature.get('properties'); + const color = properties.status === 1 ? '#d9001b' : '#04d919'; + + // 创建一个新的要素用于高亮显示 + const highlightFeature = new Feature({ + geometry: feature.getGeometry().clone(), + properties: properties + }); + + // 设置高亮样式 + highlightFeature.setStyle(new Style({ + image: new CircleStyle({ + radius: 10, // 放大图标 + fill: new Fill({ color: color }), + stroke: new Stroke({ color: '#ffffff', width: 3 }) + }), + text: new Text({ + text: properties.order || '未命名测点', + offsetY: -20, + font: 'bold 14px Arial', + fill: new Fill({ color: '#333' }), + stroke: new Stroke({ color: '#fff', width: 3 }) + }) + })); + + // 添加到高亮图层 + highlightLayer.getSource().addFeature(highlightFeature); + + // 更新选中的要素引用 + setSelectedFeature(feature); + + // 平移地图到选中的要素位置 + const geometry = feature.getGeometry(); + const coordinate = geometry.getCoordinates(); + map.getView().animate({ + center: coordinate, + duration: 500, + zoom: map.getView().getZoom() < 18 ? 18 : map.getView().getZoom() + }); + }; + + // 根据测点ID查找对应的要素 + const findFeatureByDeviceId = (deviceId) => { + if (!vectorLayer) return null; + + let targetFeature = null; + vectorLayer.getSource().forEachFeature((feature) => { + const properties = feature.get('properties'); + if (properties && properties.order === deviceId) { + targetFeature = feature; + } + }); + + return targetFeature; + }; + + // 处理表格行点击事件 + const handleRowClick = (record) => { + const feature = findFeatureByDeviceId(record.order); + if (feature) { + highlightFeature(feature); + } + }; useEffect(() => { const params = { search: { ...searchVal, } - }; + }; search(params) getCount(); }, [searchVal]) - - + + // 初始化地图 + useEffect(() => { + if (!mapContainerRef.current) return; + + // 创建地图实例 + const mapInstance = new Map({ + target: mapContainerRef.current, + controls: [], + view: new View({ + center: proj.fromLonLat([114.764317000, 31.496800000]), // 设置地图中心点坐标 + zoom: 18.4, // 设置初始缩放级别 + minZoom: 5.5, + maxZoom: 30, + }), + }); + + // 添加天地图卫星影像图层 + const satelliteLayer = new TileLayer({ + source: new XYZSource({ + url: "https://t{0-7}.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=efc861f25f96dc6e5f884f0403ebfefd", + }), + maxZoom: 30, + }); + + // 设置图层名称 + satelliteLayer.set('name', 'SatelliteImage'); + + // 添加图层到地图 + mapInstance.addLayer(satelliteLayer); + + // 创建高亮图层 + const highlightVectorLayer = new VectorLayer({ + source: new VectorSource(), + zIndex: 999, // 确保高亮图层在最上面 + style: null + }); + + // 添加高亮图层到地图 + mapInstance.addLayer(highlightVectorLayer); + setHighlightLayer(highlightVectorLayer); + + // 创建弹出层 + const overlay = new Overlay({ + element: popupRef.current, + positioning: 'bottom-center', + stopEvent: false, + offset: [0, -10] + }); + mapInstance.addOverlay(overlay); + setPopupOverlay(overlay); + + // 添加地图点击事件 + mapInstance.on('click', (event) => { + const feature = mapInstance.forEachFeatureAtPixel(event.pixel, function (feature) { + return feature; + }); + + if (feature) { + setModalVisible(true) + setDetailPoint(feature?.values_?.properties) + highlightFeature(feature); + } + }); + + // 保存地图实例 + setMap(mapInstance); + + // 组件卸载时清理地图 + return () => { + if (mapInstance) { + mapInstance.setTarget(null); + } + }; + }, []); + + // 当地图实例创建完成后获取测点数据 + useEffect(() => { + if (map) { + getCdList(); + } + }, [map]); return ( <> -
-
- - -
-
- {count.totalPoint} - +
+
+
+
+ + +
+
+ {count.totalPoint} + +
+ 总监测点数
- 总监测点数 -
- - -
-
- {count.hasAnt} - -
- 有白蚁 -
- - -
-
- {count.notAnt} - -
- 无白蚁 -
- - -
-
- {count.noData} - -
- 离线 -
- - - - + +
+
+ {count.hasAnt} + +
+ 有白蚁 +
+ + +
+
+ {count.notAnt} + +
+ 无白蚁 +
+ + +
+
+ {count.noData} + +
+ 离线 +
+ + + + - -
- + /> + +
+
({ + onClick: () => handleRowClick(record), // 添加行点击事件 + style: { cursor: 'pointer' } // 添加鼠标指针样式 + })} + /> + - + + {/* 添加测点详情Modal */} + setModalVisible(false)} + width={800} + footer={null} + destroyOnClose + > + + {refresh({addvcd:localStorage.getItem('ADCD6')})}} + // onCrudSuccess={()=>{refresh({addvcd:localStorage.getItem('ADCD6')})}} /> diff --git a/src/views/rcgl/byfz/bypc/pointHistory.js b/src/views/rcgl/byfz/bypc/pointHistory.js new file mode 100644 index 000000000..ae0f71ac6 --- /dev/null +++ b/src/views/rcgl/byfz/bypc/pointHistory.js @@ -0,0 +1,109 @@ +import React,{useEffect,useState} from 'react' +import { DatePicker, Table, Button, Form } from 'antd' +import usePageTable from '../../../../components/crud/usePageTable2'; +import { createCrudService } from '../../../../components/crud/_'; +import apiurl from '../../../../service/apiurl'; +import moment from 'moment'; +const {RangePicker} = DatePicker +export default function PointHistory({data}) { + const columns = [ + { + title: '序号', + dataIndex: 'inx', + key: 'inx', + width: 60, + // render: (_, __, index) => index + 1 + }, + { + title: '测点编号', + dataIndex: 'order', + key: 'order', + width: 130 + }, + { + title: '监测时间', + dataIndex: 'obDate', + key: 'obDate', + width: 180 + }, + { + title: '白蚁入侵', + dataIndex: 'status', + key: 'status', + width: 100, + render: (status) => {status === 1 ? '有' : '无'} + }, + { + title: '电量', + dataIndex: 'electricity', + key: 'electricity', + width: 80 + } + ] + const [searchVal, setSearchVal] = useState({ + dateTimeRangeSo: { + start: moment().subtract(1, 'days').format('YYYY-MM-DD HH:mm:ss'), + end:moment().format('YYYY-MM-DD HH:mm:ss') + } + }) + + const [form] = Form.useForm(); + + const { tableProps, search, refresh } = usePageTable(createCrudService(apiurl.rcgl.byfz.bypc.historyPage).find_noCode); + const onReset = () => { + form.resetFields(); + }; + const onFinish = (values) => { + let dateSo; + if (values.tm) { + dateSo = { + start: moment(values.tm[0]).format('YYYY-MM-DD HH:mm:ss'), + end: moment(values.tm[1]).format('YYYY-MM-DD HH:mm:ss') + } + } + delete values.tm + setSearchVal({...values, dateTimeRangeSo:dateSo}); + } + useEffect(() => { + const params = { + search: { + ...searchVal, + order:data?.order + } + }; + search(params) + }, [searchVal,data]) + + useEffect(() => { + form.setFieldValue('tm',[moment().subtract(1,'days'),moment()]) + }, []) + + return ( +
+
+
+ + + + + + + + + + + +
+
+ + ) +} diff --git a/src/views/rcgl/byfz/bypc/toolbar.js b/src/views/rcgl/byfz/bypc/toolbar.js index bee981df4..e2c052468 100644 --- a/src/views/rcgl/byfz/bypc/toolbar.js +++ b/src/views/rcgl/byfz/bypc/toolbar.js @@ -34,13 +34,13 @@ const ToolBar = ({ setSearchVal, onSave, storeData, role, initData }) => { {/*