This commit is contained in:
bb_pan 2025-05-28 13:01:46 +08:00
parent 4bba5cf288
commit ec928c2024
5 changed files with 34 additions and 28 deletions

BIN
src/assets/img/IOT.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -11,8 +11,8 @@ import { getUserInfoAPI } from 'http/api/login/index'
import { ElMessage } from 'element-plus'
import { wgs84ToGcj02ToBd09Public } from 'utils/map'
import { getMapData, mapLoginApi, getIotListApi, getBadgeInfoApi } from 'http/api/map'
import icon1 from '@/assets/img/work-card.png'
import icon2 from '@/assets/img/IOT.png'
import icon1 from '@/assets/img/work-card.jpg'
import icon2 from '@/assets/img/IOT.jpg'
const router: any = useRouter()
const userStore = useStore()
@ -45,10 +45,11 @@ const loginApi = async () => {
//
const getMapDataList = async () => {
try {
const res: any = await getMapData()
await getMapData()
} catch (res: any) {
console.log('🚀 ~ getMapDataList ~ res:', res)
mapData.value = res.data
console.log('🚀 ~ getMapDataList ~ mapData.value:', mapData.value.longitude)
if (res) {
mapData.value = res
let { longitude, latitude } = wgs84ToGcj02ToBd09Public(
Number(mapData.value.longitude),
Number(mapData.value.latitude),
@ -56,16 +57,15 @@ const getMapDataList = async () => {
mapData.value.longitude = longitude
mapData.value.latitude = latitude
console.log('🚀 ~ getMapDataList ~ longitude:', longitude, latitude)
points.value.push({
points.value = [
{
id: 4,
lng: longitude,
lat: latitude,
isWork: false,
})
getWorkData()
// initMap()
} catch (error) {
console.log('🚀 ~ getMapDataList ~ error:', error)
},
]
}
getWorkData()
// initMap()
}
@ -75,13 +75,13 @@ const getMapDataList = async () => {
const getWorkData = async () => {
try {
await getIotListApi()
} catch (res) {
} catch (res: any) {
console.log('🚀 ~ getWorkData ~ res:', res)
if (res.errorCode != 200) {
initMap()
return
}
points.value = res.devices.map((item: any) => {
const point = res.devices.map((item: any) => {
return {
id: item.user_id,
lng: item.jingdu,
@ -89,6 +89,9 @@ const getWorkData = async () => {
isWork: true,
}
})
//
points.value = [...JSON.parse(JSON.stringify(points.value)), ...point]
console.log('🚀 ~ getWorkData ~ points.value:', points.value)
initMap()
}
}
@ -97,7 +100,7 @@ const getWorkData = async () => {
const getWorkCardDetails = async (id: any) => {
try {
await getBadgeInfoApi(id)
} catch (res) {
} catch (res: any) {
console.log('🚀 ~ getWorkCardDetails ~ res:', res)
if (res.errorCode != 200) {
return
@ -245,7 +248,7 @@ const formatUtcTimeV2 = (utcTime: any, date: any) => {
const initMap = () => {
if (window.BMap) {
const map = new BMap.Map(mapContainer.value)
const point = new BMap.Point(106.6302, 26.6477) //
const point = new BMap.Point(106.674974,26.489328) //
//
points.value.forEach((item: any) => {
const point = new BMap.Point(item.lng, item.lat)
@ -278,7 +281,7 @@ const initMap = () => {
})
})
map.addControl(new BMap.NavigationControl()) //
map.centerAndZoom(point, 7) //
map.centerAndZoom(point, 11) //
map.enableScrollWheelZoom(true) //
// 7
} else {
@ -296,6 +299,7 @@ const handleTag = (tag: number) => {
} else {
tagData.value = mapData.value.cphase
}
console.log('🚀 ~ handleTag ~ tagData.value:', tagData.value)
}
onMounted(async () => {
@ -676,7 +680,9 @@ onMounted(async () => {
<el-col :span="12" :offset="0">iccid: {{ mapWorkCardData.su }}</el-col>
<el-col :span="12" :offset="0">联系人: {{ mapWorkCardData.owner }}</el-col>
<el-col :span="12" :offset="0">经纬度: {{ mapWorkCardData.jingwei }}</el-col>
<el-col :span="12" :offset="0">离线报警开关: {{ mapWorkCardData.alarm != 0 ? '开' : '关' }}</el-col>
<el-col :span="12" :offset="0"
>离线报警开关: {{ mapWorkCardData.alarm != 0 ? '开' : '关' }}</el-col
>
<el-col :span="12" :offset="0">服务商描述: {{ mapWorkCardData.deviceRemark }}</el-col>
<el-col :span="12" :offset="0">设备软件版本号: {{ mapWorkCardData.macVersion }}</el-col>
<el-col :span="12" :offset="0">视频地址: {{ mapWorkCardData.VideoConfig }}</el-col>