Browse Source

显示时间,数值,单位,类型

master
xh 2 days ago
parent
commit
b935bba35c
  1. 3
      web/src/api/gas/handdetector/index.ts
  2. 7
      web/src/views/HandDevice/Home/components/services/popup.service.ts
  3. 5
      web/src/views/HandDevice/Home/components/types/map.types.ts
  4. 26
      web/src/views/HandDevice/Home/index.vue

3
web/src/api/gas/handdetector/index.ts

@ -22,6 +22,9 @@ export interface HandDetector {
accuracy?: number // 数值除数 accuracy?: number // 数值除数
sortOrder?: number // 排序 sortOrder?: number // 排序
remark?: string // 备注 remark?: string // 备注
time?: number // 时间
value?: number // 数值
} }
// GAS手持探测器 API // GAS手持探测器 API

7
web/src/views/HandDevice/Home/components/services/popup.service.ts

@ -44,8 +44,11 @@ export class PopupService {
<div style="color: ${getStatusColor(status)};"> <div style="color: ${getStatusColor(status)};">
状态: ${getStatusLabel(status)} 状态: ${getStatusLabel(status)}
</div> </div>
<div style="margin-top: 4px; font-size: 10px; color: #666;">
坐标: ${markerData.coordinates[0].toFixed(6)}, ${markerData.coordinates[1].toFixed(6)}
<div>${markerData.gasChemical}</div>
<div>${markerData.value} ${markerData.unit ? markerData.unit : ''}</div>
<div>${markerData.time ? markerData.time : '-'} </div>
<div>
${markerData.coordinates[0].toFixed(6)}, ${markerData.coordinates[1].toFixed(6)}
</div> </div>
` `
} }

5
web/src/views/HandDevice/Home/components/types/map.types.ts

@ -46,7 +46,10 @@ export interface MarkerData extends HandDetector {
/** 标记标题 */ /** 标记标题 */
name: string name: string
/** 自定义数据 */ /** 自定义数据 */
data?: any
data?: any,
value: number,
unit: string,
time: string
} }
// 地图组件 Props 接口 // 地图组件 Props 接口

26
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 { MarkerData } from './components/types/map.types'
import { Fence } from '@/api/gas/fence' import { Fence } from '@/api/gas/fence'
import { FenceApi } from '@/api/gas/fence' import { FenceApi } from '@/api/gas/fence'
import dayjs from 'dayjs'
const getDataTimer = ref<NodeJS.Timeout | null>(null) const getDataTimer = ref<NodeJS.Timeout | null>(null)
const markers = ref<MarkerData[]>([]) const markers = ref<MarkerData[]>([])
const fences = ref<Fence[]>([]) const fences = ref<Fence[]>([])
@ -16,14 +17,17 @@ const getMarkers = async () => {
console.log('getMarkers') console.log('getMarkers')
return await getLastestDetectorData().then((res: HandDetector[]) => { return await getLastestDetectorData().then((res: HandDetector[]) => {
res = res.filter((i) => i.enableStatus === 1) res = res.filter((i) => i.enableStatus === 1)
res = res.map((i) => {
var res2 = res.map((i) => {
return { return {
...i, ...i,
coordinates: [i.longitude, i.latitude], 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 inited.value = true
}) })
} }
@ -34,14 +38,14 @@ const getFences = async () => {
pageSize: 100 pageSize: 100
}).then((res) => { }).then((res) => {
console.log('getFences', 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(() => { onMounted(() => {

Loading…
Cancel
Save