From c0dbf9efcba7a1a893bb4da2032ba729129ac7e3 Mon Sep 17 00:00:00 2001 From: xh <11675084@qq.com> Date: Thu, 6 Nov 2025 15:59:54 +0800 Subject: [PATCH] map --- web/README.md | 4 +- web/index.html | 2 +- .../Home/components/constants/map.constants.ts | 7 ++- .../Home/components/services/map.service.ts | 13 +++-- .../HandDevice/Home/components/utils/map.utils.ts | 12 +++-- web/src/views/gas/handdetector/index.vue | 58 +++++++++++++++++++--- web/src/views/gas/personnel/index.vue | 9 ---- 7 files changed, 76 insertions(+), 29 deletions(-) diff --git a/web/README.md b/web/README.md index 1a35747..39a9f38 100644 --- a/web/README.md +++ b/web/README.md @@ -1 +1,3 @@ -sudo unzip -o /home/zdhlroot/roadmap.zip -d /opt/website/mobile.zdhlcn.com/roadmap/ \ No newline at end of file +sudo unzip -o /home/zdhlroot/roadmap.zip -d /opt/website/mobile.zdhlcn.com/roadmap/ + +sudo cp /tmp/xiangheng/* /opt/website/mobile.zdhlcn.com/ -r \ No newline at end of file diff --git a/web/index.html b/web/index.html index 671e746..2410d77 100644 --- a/web/index.html +++ b/web/index.html @@ -1,5 +1,5 @@ - + diff --git a/web/src/views/HandDevice/Home/components/constants/map.constants.ts b/web/src/views/HandDevice/Home/components/constants/map.constants.ts index 7209234..22a84f8 100644 --- a/web/src/views/HandDevice/Home/components/constants/map.constants.ts +++ b/web/src/views/HandDevice/Home/components/constants/map.constants.ts @@ -1,6 +1,7 @@ /** * 地图组件常量配置 */ + import type { StatusDictItem, FenceData } from '../types/map.types' // 状态字典配置 @@ -28,11 +29,13 @@ export const STATUS_DICT = { // 状态优先级定义 (数字越小优先级越高) export const STATUS_PRIORITY = { + gasStatus_2: 1, gasStatus_1: 2, // battery_2: 3, batteryStatus_1: 4, // fence_2: 5, + fenceStatus_1: 6, offline: 7, normal: 8 @@ -46,9 +49,9 @@ export const DEFAULT_MARKERS = [] // 地图默认配置 export const MAP_DEFAULTS = { - tileUrl:'https://webrd04.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}', + tileUrl: 'https://webrd04.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}', // tileUrl: 'http://qtbj.icpcdev.site/roadmap/{z}/{x}/{y}.png', - + // tileUrl: 'http://192.168.43.94:8080/{z}/{x}/{y}.png', center: [116.3912757, 39.906217] as [number, number], zoom: 10, maxZoom: 18, diff --git a/web/src/views/HandDevice/Home/components/services/map.service.ts b/web/src/views/HandDevice/Home/components/services/map.service.ts index b2b572a..188dc6f 100644 --- a/web/src/views/HandDevice/Home/components/services/map.service.ts +++ b/web/src/views/HandDevice/Home/components/services/map.service.ts @@ -5,8 +5,10 @@ import { Map, View } from 'ol' import { Tile as TileLayer } from 'ol/layer' import { OSM, XYZ } from 'ol/source' -import { fromLonLat,transformExtent } from 'ol/proj' -import { boundingExtent } from 'ol/extent' +import { fromLonLat, transformExtent } from 'ol/proj' +import { boundingExtent } from 'ol/extent' + + import Overlay from 'ol/Overlay' import type { MapProps } from '../types/map.types' @@ -36,7 +38,8 @@ export class MapService { zoom: props.zoom, maxZoom: props.maxZoom, minZoom: props.minZoom - }) + }), + }) } @@ -88,13 +91,13 @@ export class MapService { */ fitToMarkers(lonLats: number[][]): void { if (!this.map || lonLats.length === 0) return - + const extent = boundingExtent(lonLats) const webMercatorExtent = transformExtent(extent, 'EPSG:4326', 'EPSG:3857') this.map.getView().fit(webMercatorExtent, { padding: [80, 50, 100, 50], - maxZoom: this.map.getView().getMaxZoom() + maxZoom: this.map.getView().getMaxZoom() }) } /** diff --git a/web/src/views/HandDevice/Home/components/utils/map.utils.ts b/web/src/views/HandDevice/Home/components/utils/map.utils.ts index a2ca571..f864002 100644 --- a/web/src/views/HandDevice/Home/components/utils/map.utils.ts +++ b/web/src/views/HandDevice/Home/components/utils/map.utils.ts @@ -36,6 +36,11 @@ export const getHighestPriorityStatus = (markerData: { fenceStatus?: number onlineStatus?: number }): keyof typeof STATUS_PRIORITY => { + const onlineStatus = String(markerData.onlineStatus) !== '1' ? 'offline' : null + if (onlineStatus === 'offline') { + return 'offline' + } + const statuses: string[] = [] // 收集非正常状态 @@ -53,11 +58,8 @@ export const getHighestPriorityStatus = (markerData: { const fenceStatusStr = getStatusMapping('fenceStatus', String(markerData.fenceStatus)) fenceStatusStr && statuses.push(fenceStatusStr) } - // 检查各种状态 - const onlineStatus = String(markerData.onlineStatus) !== '1' ? 'offline' : null - if (onlineStatus) { - statuses.push(onlineStatus) - } + + // console.log('statuses', statuses) // 如果没有报警状态,则为正常 diff --git a/web/src/views/gas/handdetector/index.vue b/web/src/views/gas/handdetector/index.vue index 1dc6fb3..cb3e237 100644 --- a/web/src/views/gas/handdetector/index.vue +++ b/web/src/views/gas/handdetector/index.vue @@ -27,6 +27,22 @@ class="!w-240px" /> + + + + 搜索 重置 @@ -74,7 +90,7 @@ -