feat:完善功能

This commit is contained in:
zjc
2025-02-24 21:01:23 +08:00
parent 896a9f9f05
commit b5c1b97818

View File

@@ -1,7 +1,7 @@
<template> <template>
<div class="dialog"> <div class="dialog">
<el-dialog v-model="modelValue" align-center :modal="false" :show-close="false"> <el-dialog v-model="modelValue" align-center :modal="false" :show-close="false">
<img class="close" src="@/assets/images/close.png" @click="modelValue = false" /> <img class="close" src="@/assets/images/close.png" @click="handleClose" />
<div class="flex"> <div class="flex">
<div class="list-box"> <div class="list-box">
<title2 title="车船" /> <title2 title="车船" />
@@ -175,8 +175,8 @@
let list = ref([]) let list = ref([])
let carOverlays = ref([]) let carOverlays = ref([])
let shipOverlays = ref([]) let shipOverlays = ref([])
let lastInfoBox = ref() let lastInfoBox = ref(null)
let infoBox = ref() let infoBox = ref(null)
let currentMarker = ref() let currentMarker = ref()
let tabs = ref([ let tabs = ref([
{ {
@@ -212,11 +212,12 @@
{ immediate: true } { immediate: true }
) )
watch( watch(
() => [map.value, props.carList, props.shipList], () => [map.value, props.carList, props.shipList, modelValue.value],
(val) => { () => {
if (val[0]) { if (map.value && modelValue.value) {
// 109.645729,31.041203 // 109.645729,31.041203
if (carOverlays.value.length > 0) { if (carOverlays.value.length > 0) {
console.log(11111)
// 更新车辆marker位置 // 更新车辆marker位置
let flag = false let flag = false
for (let i = 0; i < carOverlays.value.length; i++) { for (let i = 0; i < carOverlays.value.length; i++) {
@@ -248,6 +249,7 @@
} }
} }
} else { } else {
console.log(2222)
props.carList.map((item, i) => { props.carList.map((item, i) => {
if (item.lng && item.lat) { if (item.lng && item.lat) {
addMarker(carIcon, [item.lng, item.lat], [36, 50]) addMarker(carIcon, [item.lng, item.lat], [36, 50])
@@ -255,7 +257,6 @@
e.sim = e.target.sim e.sim = e.target.sim
currentMarker.value = e currentMarker.value = e
let obj = props.carList.find((item) => item.sim == e.target.sim) let obj = props.carList.find((item) => item.sim == e.target.sim)
console.log(obj, 'obj')
setInfoBox(e.latLng, obj) setInfoBox(e.latLng, obj)
}) })
marker.value.sim = item.sim marker.value.sim = item.sim
@@ -320,6 +321,7 @@
const day = date.getDate() const day = date.getDate()
return `${year}-${month}-${day}` return `${year}-${month}-${day}`
} }
const setHtml = (data) => { const setHtml = (data) => {
data.gpsTime = timestampToYMD(data?.gpsTime) data.gpsTime = timestampToYMD(data?.gpsTime)
// <div class='marker-col'> <img src='${icon16}' /> <p> 18723232323 </p> </div> // <div class='marker-col'> <img src='${icon16}' /> <p> 18723232323 </p> </div>
@@ -380,6 +382,15 @@
active.value = index active.value = index
} }
const handleClose = () => {
carOverlays.value = []
shipOverlays.value = []
map.value = null
infoBox.value = null
lastInfoBox.value = null
modelValue.value = false
}
const getGpsList = async () => { const getGpsList = async () => {
let res = await getGpsListApi({ let res = await getGpsListApi({
scenicSpotId: scenicSpotId.value, scenicSpotId: scenicSpotId.value,