diff --git a/src/pages/IntegratedCommand/pages/BaseElement/CarList/CarList.module.less b/src/pages/IntegratedCommand/pages/BaseElement/CarList/CarList.module.less index fc5e4f562001bdc8f4afd887ae5a4297892d5b78..e1f0a40fd497c48a29bfc5a270cf01ad4d94391d 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 20d5aa8be904ddfd5d3caa34756dd273ffc6b83d..de708024b3dcdb20d314e4d79d556d4ad44985e2 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 d06237e1ca718a449db1af319b10dce605b7d8ee..8ca8b4fa6ee088833e82a801131d3e27b6540caf 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))