From 4015e0330b33f6f83e2082b4bebbc3fb89b93488 Mon Sep 17 00:00:00 2001 From: mhy <2624196756@qq.com> Date: Fri, 7 Feb 2025 10:20:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A4=84=E7=90=86=E8=BD=A6=E8=BE=86?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BaseElement/CarList/CarList.module.less | 11 ++++++ .../pages/BaseElement/CarList/CarList.tsx | 35 ++++++++++++------- .../IntegratedCommand/pages/Map/index.tsx | 12 +++++-- 3 files changed, 43 insertions(+), 15 deletions(-) diff --git a/src/pages/IntegratedCommand/pages/BaseElement/CarList/CarList.module.less b/src/pages/IntegratedCommand/pages/BaseElement/CarList/CarList.module.less index fc5e4f5..e1f0a40 100644 --- a/src/pages/IntegratedCommand/pages/BaseElement/CarList/CarList.module.less +++ b/src/pages/IntegratedCommand/pages/BaseElement/CarList/CarList.module.less @@ -122,6 +122,17 @@ } } +.status { + min-width: fit-content; + height: 40px; + font-size: 25px; + color: #fff; + border-radius: 5px; + line-height: 40px; + padding: 0 3px; + margin-top: 5px; +} + .item { cursor: pointer; diff --git a/src/pages/IntegratedCommand/pages/BaseElement/CarList/CarList.tsx b/src/pages/IntegratedCommand/pages/BaseElement/CarList/CarList.tsx index 20d5aa8..de70802 100644 --- a/src/pages/IntegratedCommand/pages/BaseElement/CarList/CarList.tsx +++ b/src/pages/IntegratedCommand/pages/BaseElement/CarList/CarList.tsx @@ -114,20 +114,31 @@ const CarList: FC<{ type: string }> = (props) => { export default CarList +const colors: any = { + 离线: '#c89a1b', + 正常: '#41FF84', + 工作中: '#1576fc', + 异常: '#ff5c54', + 在岗: '#1576fc', + 无定位: '#b0b0b0', +} const ItemInfo: FC<{ item: any }> = ({ item }) => { const mapRef = useContext(MapContext) - const { id, orgName, name, status, typeText, point } = item - return { - if (point) { - const [lng, lat] = point.coordinates - mapRef.current?.setViewport([new BMapGL.Point(lng, lat)]) - } - }}> - -
{name}
- {typeText} + const { id, orgName, name, status, statusText, typeText, point } = item + return +
{statusText}
+ { + if (point) { + const [lng, lat] = point.coordinates + mapRef.current?.setViewport([new BMapGL.Point(lng, lat)]) + } + }}> + +
{name}
+ {typeText} +
+
{orgName || '暂无'}
-
{orgName || '暂无'}
-} \ No newline at end of file +} diff --git a/src/pages/IntegratedCommand/pages/Map/index.tsx b/src/pages/IntegratedCommand/pages/Map/index.tsx index d06237e..8ca8b4f 100644 --- a/src/pages/IntegratedCommand/pages/Map/index.tsx +++ b/src/pages/IntegratedCommand/pages/Map/index.tsx @@ -19,13 +19,14 @@ import CarDetail from "../CarDetail/CarDetail"; import { carMapMarker, carTypes, twoMapData } from "@/api"; import { Checkbox, Input, Flex, Popover } from "antd"; import axios from "axios"; -import { useUpdate, useUpdateEffect } from "ahooks" +import { useUpdateEffect } from "ahooks" import icon33 from '@/assets/images/icon/icon33.png' import icon34 from '@/assets/images/icon/icon34.png' import icon35 from '@/assets/images/icon/icon35.png' import { MapContext } from "../.."; +import { gcj02ToBd09 } from "@/utils/coordinateTransformation"; -const gpsCarData = [ +const gpsCarData: any[] = [ { plateNumber: "川AHR166", id: "014188111422", carId: "1860942969732943873" }, { plateNumber: "川AHR609", id: "024908993503", carId: "1860943090080108546" }, { plateNumber: "川AHG196", id: "024908993508", carId: "1860942811288915970" }, @@ -104,7 +105,9 @@ const CustomMap: React.FC = () => { return data; }); resolve(data); - }); + }).catch(() => { + resolve([]) + }) }); }; @@ -233,6 +236,9 @@ const CustomMap: React.FC = () => { const path = workRange.split(';').reduce((init: any, item: string) => { const [lng, lat] = item.split(',') init.push(new BMapGL.Point(Number(lng), Number(lat))) + + // const { longitude, latitude } = gcj02ToBd09(Number(lng), Number(lat)) + // init.push(new BMapGL.Point(longitude, latitude)) return init }, []) const txtPoint = new BMapGL.Point(Number(centerX || 0), Number(centerY || 0)) -- GitLab