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(() => {