|
|
@ -30,10 +30,7 @@ |
|
|
<template #header="{ item }"> |
|
|
<template #header="{ item }"> |
|
|
<div class="marker-item"> |
|
|
<div class="marker-item"> |
|
|
<div class="flex-1 text-13px"> {{ item.name }}</div> |
|
|
<div class="flex-1 text-13px"> {{ item.name }}</div> |
|
|
<div |
|
|
|
|
|
class="text-12px pr-1" |
|
|
|
|
|
:style="{ color: item.statusColor }" |
|
|
|
|
|
> |
|
|
|
|
|
|
|
|
<div class="text-12px pr-1" :style="{ color: item.statusColor }"> |
|
|
{{ item.statusLabel }} |
|
|
{{ item.statusLabel }} |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
@ -113,7 +110,7 @@ import { MarkerData, FenceData } from './components/types/map.types' |
|
|
|
|
|
|
|
|
import { useHandDetectorStore } from '@/store/modules/handDetector' |
|
|
import { useHandDetectorStore } from '@/store/modules/handDetector' |
|
|
import { ElMessage, ElScrollbar } from 'element-plus' |
|
|
import { ElMessage, ElScrollbar } from 'element-plus' |
|
|
import dayjs, { Dayjs } from 'dayjs' |
|
|
|
|
|
|
|
|
import dayjs from 'dayjs' |
|
|
import { getDistance } from 'ol/sphere' |
|
|
import { getDistance } from 'ol/sphere' |
|
|
import { shallowRef } from 'vue' |
|
|
import { shallowRef } from 'vue' |
|
|
const componentsIsActive = ref(false) |
|
|
const componentsIsActive = ref(false) |
|
|
@ -126,7 +123,7 @@ const fences = ref<FenceData[]>([]) |
|
|
|
|
|
|
|
|
const mapRef = ref<InstanceType<typeof OpenLayerMap>>() |
|
|
const mapRef = ref<InstanceType<typeof OpenLayerMap>>() |
|
|
const search = ref('') |
|
|
const search = ref('') |
|
|
const selectStatus = ref(['normal', 'offline', 'fenceStatus_1', 'alarm','batteryStatus_1']) |
|
|
|
|
|
|
|
|
const selectStatus = ref(['normal', 'offline', 'fenceStatus_1', 'alarm', 'batteryStatus_1']) |
|
|
watch( |
|
|
watch( |
|
|
() => search.value, |
|
|
() => search.value, |
|
|
(newSearch, oldSearch) => { |
|
|
(newSearch, oldSearch) => { |
|
|
@ -152,7 +149,6 @@ const filterMarkers = computed(() => { |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (selectStatus.value.length !== 0) { |
|
|
if (selectStatus.value.length !== 0) { |
|
|
arr = arr.filter((item) => { |
|
|
arr = arr.filter((item) => { |
|
|
// console.log('selectStatus', selectStatus.value,item.statusStr); |
|
|
// console.log('selectStatus', selectStatus.value,item.statusStr); |
|
|
@ -162,23 +158,21 @@ const filterMarkers = computed(() => { |
|
|
if (item.statusStr == 'gasStatus_2' || item.statusStr == 'gasStatus_1') { |
|
|
if (item.statusStr == 'gasStatus_2' || item.statusStr == 'gasStatus_1') { |
|
|
return selectStatus.value.includes('alarm') |
|
|
return selectStatus.value.includes('alarm') |
|
|
} |
|
|
} |
|
|
// if (item.statusStr == 'fenceStatus_1') { |
|
|
|
|
|
// return selectStatus.value.includes('fenceStatus_1') |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
return selectStatus.value.includes(item.statusStr) |
|
|
return selectStatus.value.includes(item.statusStr) |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
// console.log('markers.value', markers.value) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return arr |
|
|
return arr |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
const filterMarkers2 = function getFilterMarkers2() { |
|
|
const filterMarkers2 = function getFilterMarkers2() { |
|
|
var arr: MarkerData[] = [] |
|
|
var arr: MarkerData[] = [] |
|
|
var nowTime=dayjs().format('YYYY-MM-DD HH:mm:ss') |
|
|
|
|
|
for (let i = 0; i < 10000; i++) { |
|
|
|
|
|
const lon= 80+Math.random()*20 |
|
|
|
|
|
const lat= 30+Math.random()*20 |
|
|
|
|
|
|
|
|
var nowTime = dayjs().format('YYYY-MM-DD HH:mm:ss') |
|
|
|
|
|
for (let i = 0; i < 50000; i++) { |
|
|
|
|
|
const lon = 100 + Math.random() * 2 |
|
|
|
|
|
const lat = 30 + Math.random() * 2 |
|
|
arr.push({ |
|
|
arr.push({ |
|
|
id: i + 1, |
|
|
id: i + 1, |
|
|
sn: '867989072728120', |
|
|
sn: '867989072728120', |
|
|
@ -222,17 +216,14 @@ const filterMarkers2 = function getFilterMarkers2() { |
|
|
expanded: false |
|
|
expanded: false |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
markers.value=arr |
|
|
|
|
|
|
|
|
markers.value = arr |
|
|
} |
|
|
} |
|
|
const getMarkers = async () => { |
|
|
const getMarkers = async () => { |
|
|
console.log('getMarkers') |
|
|
console.log('getMarkers') |
|
|
return await getLastDetectorData().then((res: HandDetectorData[]) => { |
|
|
return await getLastDetectorData().then((res: HandDetectorData[]) => { |
|
|
console.time('getLastDetectorData'); |
|
|
|
|
|
|
|
|
|
|
|
res = res.filter((i) => i.enableStatus === 1) |
|
|
res = res.filter((i) => i.enableStatus === 1) |
|
|
var res2 = res |
|
|
var res2 = res |
|
|
.map((i) => { |
|
|
.map((i) => { |
|
|
// console.log([i.longitude, i.latitude]) |
|
|
|
|
|
let statusStr = getHighestPriorityStatus({ |
|
|
let statusStr = getHighestPriorityStatus({ |
|
|
gasStatus: i.gasStatus, //气体报警状态 |
|
|
gasStatus: i.gasStatus, //气体报警状态 |
|
|
batteryStatus: i.batteryStatus, //电池报警状态 |
|
|
batteryStatus: i.batteryStatus, //电池报警状态 |
|
|
@ -252,13 +243,13 @@ const getMarkers = async () => { |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
.sort((a, b) => a.statusPriority - b.statusPriority) |
|
|
.sort((a, b) => a.statusPriority - b.statusPriority) |
|
|
console.timeEnd('getLastDetectorData'); |
|
|
|
|
|
|
|
|
|
|
|
markers.value = res2 |
|
|
markers.value = res2 |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
const getFences = async () => { |
|
|
const getFences = async () => { |
|
|
return await handDetectorStore.getAllFences().then((res) => { |
|
|
return await handDetectorStore.getAllFences().then((res) => { |
|
|
// console.log('getFences', res) |
|
|
|
|
|
|
|
|
|
|
|
let fencesData = res |
|
|
let fencesData = res |
|
|
.map((i) => { |
|
|
.map((i) => { |
|
|
return { |
|
|
return { |
|
|
@ -272,7 +263,6 @@ const getFences = async () => { |
|
|
} |
|
|
} |
|
|
// 定位到手持设备 |
|
|
// 定位到手持设备 |
|
|
function setCenter(item: MarkerData) { |
|
|
function setCenter(item: MarkerData) { |
|
|
console.log('setCenter', item) |
|
|
|
|
|
if (item.longitude && item.latitude) { |
|
|
if (item.longitude && item.latitude) { |
|
|
mapRef.value?.setCenter([item.longitude || 0, item.latitude || 0]) |
|
|
mapRef.value?.setCenter([item.longitude || 0, item.latitude || 0]) |
|
|
} |
|
|
} |
|
|
@ -396,13 +386,11 @@ async function showTrajectory(item: MarkerData) { |
|
|
const historicalCurveRef = ref<InstanceType<typeof HistoricalCurve>>() |
|
|
const historicalCurveRef = ref<InstanceType<typeof HistoricalCurve>>() |
|
|
// 点击历史曲线 |
|
|
// 点击历史曲线 |
|
|
function onClickHistoricalCurve(item: MarkerData) { |
|
|
function onClickHistoricalCurve(item: MarkerData) { |
|
|
// console.log('onClickHistoricalCurve', item) |
|
|
|
|
|
historicalCurveRef.value?.openDrawer(toRaw(item)) |
|
|
historicalCurveRef.value?.openDrawer(toRaw(item)) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 点击轨迹 |
|
|
// 点击轨迹 |
|
|
function onClickTrajectory(item: MarkerData) { |
|
|
function onClickTrajectory(item: MarkerData) { |
|
|
console.log('onClickTrajectory', item) |
|
|
|
|
|
trajectoryTimeRange.value = [dayjs().subtract(1, 'hour').valueOf(), dayjs().valueOf()] |
|
|
trajectoryTimeRange.value = [dayjs().subtract(1, 'hour').valueOf(), dayjs().valueOf()] |
|
|
showTrajectory(item) |
|
|
showTrajectory(item) |
|
|
} |
|
|
} |
|
|
@ -410,15 +398,13 @@ function onClickTrajectory(item: MarkerData) { |
|
|
const scrollbarRef = useTemplateRef<InstanceType<typeof VirtualCollapsePanel>>('scrollbarRef') |
|
|
const scrollbarRef = useTemplateRef<InstanceType<typeof VirtualCollapsePanel>>('scrollbarRef') |
|
|
// 点击手持设备 |
|
|
// 点击手持设备 |
|
|
function onClickMarker(markerItem: MarkerData) { |
|
|
function onClickMarker(markerItem: MarkerData) { |
|
|
console.log('onClickMarker', markerItem) |
|
|
|
|
|
|
|
|
|
|
|
var findIndex = filterMarkers.value.findIndex((item) => item.id === markerItem.id) |
|
|
var findIndex = filterMarkers.value.findIndex((item) => item.id === markerItem.id) |
|
|
if (findIndex === -1) { |
|
|
if (findIndex === -1) { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
setTimeout(() => { |
|
|
|
|
|
|
|
|
// console.log('findIndex', findIndex, filterMarkers.value[findIndex]) |
|
|
|
|
|
|
|
|
scrollbarRef.value?.scrollToIndex(findIndex) |
|
|
scrollbarRef.value?.scrollToIndex(findIndex) |
|
|
}, 300) |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
onMounted(() => { |
|
|
|