From b935bba35c439fa70b023419037aad8cb9be9fe7 Mon Sep 17 00:00:00 2001 From: xh <11675084@qq.com> Date: Fri, 17 Oct 2025 14:51:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=97=B6=E9=97=B4=EF=BC=8C?= =?UTF-8?q?=E6=95=B0=E5=80=BC=EF=BC=8C=E5=8D=95=E4=BD=8D=EF=BC=8C=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/api/gas/handdetector/index.ts | 3 +++ .../Home/components/services/popup.service.ts | 7 ++++-- .../HandDevice/Home/components/types/map.types.ts | 5 ++++- web/src/views/HandDevice/Home/index.vue | 26 +++++++++++++--------- 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/web/src/api/gas/handdetector/index.ts b/web/src/api/gas/handdetector/index.ts index 7f23fd5..10222ec 100644 --- a/web/src/api/gas/handdetector/index.ts +++ b/web/src/api/gas/handdetector/index.ts @@ -22,6 +22,9 @@ export interface HandDetector { accuracy?: number // 数值除数 sortOrder?: number // 排序 remark?: string // 备注 + + time?: number // 时间 + value?: number // 数值 } // GAS手持探测器 API diff --git a/web/src/views/HandDevice/Home/components/services/popup.service.ts b/web/src/views/HandDevice/Home/components/services/popup.service.ts index 07b04aa..9c52b30 100644 --- a/web/src/views/HandDevice/Home/components/services/popup.service.ts +++ b/web/src/views/HandDevice/Home/components/services/popup.service.ts @@ -44,8 +44,11 @@ export class PopupService {
状态: ${getStatusLabel(status)}
-
- 坐标: ${markerData.coordinates[0].toFixed(6)}, ${markerData.coordinates[1].toFixed(6)} +
类型:${markerData.gasChemical}
+
数值:${markerData.value} ${markerData.unit ? markerData.unit : ''}
+
时间:${markerData.time ? markerData.time : '-'}
+
+ 坐标:${markerData.coordinates[0].toFixed(6)}, ${markerData.coordinates[1].toFixed(6)}
` } diff --git a/web/src/views/HandDevice/Home/components/types/map.types.ts b/web/src/views/HandDevice/Home/components/types/map.types.ts index 8572dcb..89be640 100644 --- a/web/src/views/HandDevice/Home/components/types/map.types.ts +++ b/web/src/views/HandDevice/Home/components/types/map.types.ts @@ -46,7 +46,10 @@ export interface MarkerData extends HandDetector { /** 标记标题 */ name: string /** 自定义数据 */ - data?: any + data?: any, + value: number, + unit: string, + time: string } // 地图组件 Props 接口 diff --git a/web/src/views/HandDevice/Home/index.vue b/web/src/views/HandDevice/Home/index.vue index 657fbd7..ad95c5d 100644 --- a/web/src/views/HandDevice/Home/index.vue +++ b/web/src/views/HandDevice/Home/index.vue @@ -8,6 +8,7 @@ import { HandDetector } from '@/api/gas/handdetector' import { MarkerData } from './components/types/map.types' import { Fence } from '@/api/gas/fence' import { FenceApi } from '@/api/gas/fence' +import dayjs from 'dayjs' const getDataTimer = ref(null) const markers = ref([]) const fences = ref([]) @@ -16,14 +17,17 @@ const getMarkers = async () => { console.log('getMarkers') return await getLastestDetectorData().then((res: HandDetector[]) => { res = res.filter((i) => i.enableStatus === 1) - res = res.map((i) => { + var res2 = res.map((i) => { return { ...i, coordinates: [i.longitude, i.latitude], - data: [] + data: [], + time: i.time ? dayjs(i.time).format('YYYY-MM-DD HH:mm:ss') : '', + value: i.value, + unit: i.unit } }) - markers.value = res as unknown as any[] + markers.value = res2 as unknown as any[] inited.value = true }) } @@ -34,14 +38,14 @@ const getFences = async () => { pageSize: 100 }).then((res) => { console.log('getFences', res) - let fencesData = res.list as Fence[] - fencesData = fencesData.map((i) => { - return { - ...i, - fenceRange: JSON.parse(i.fenceRange) - } - }) - fences.value = fencesData as unknown as Fence[] + let fencesData = res.list as Fence[] + fencesData = fencesData.map((i) => { + return { + ...i, + fenceRange: JSON.parse(i.fenceRange) + } + }) + fences.value = fencesData as unknown as Fence[] }) } onMounted(() => {