2024-10-10 10:14:31 +08:00
|
|
|
<template>
|
|
|
|
<view>
|
|
|
|
<web-view :src="mapUrl"/>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2025-07-11 18:09:58 +08:00
|
|
|
import {
|
|
|
|
getChecklistInspectionStatusRecordViewOtherHiddenDangerList
|
|
|
|
} from "@/api";
|
2024-10-10 10:14:31 +08:00
|
|
|
import gcoord from '@/common/gcoord.js'
|
|
|
|
import imgH from "@/static/h.png";
|
|
|
|
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
2025-07-11 18:09:58 +08:00
|
|
|
id: '',
|
2024-10-10 10:14:31 +08:00
|
|
|
mapUrl: '',
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onLoad(event) {
|
2025-07-11 18:09:58 +08:00
|
|
|
this.id = event.id;
|
2024-10-10 10:14:31 +08:00
|
|
|
this.getData()
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
async getData() {
|
2025-07-11 18:09:58 +08:00
|
|
|
let { data } = await getChecklistInspectionStatusRecordViewOtherHiddenDangerList({
|
|
|
|
checkrecordId: this.id,
|
2024-10-10 10:14:31 +08:00
|
|
|
});
|
|
|
|
const covers = []
|
2025-07-11 18:09:58 +08:00
|
|
|
for (let i = 0; i < data.length; i++) {
|
2024-10-10 10:14:31 +08:00
|
|
|
if (
|
2025-07-11 18:09:58 +08:00
|
|
|
!this.isEmpty(data[i].longitude) &&
|
|
|
|
!this.isEmpty(data[i].latitude)
|
2024-10-10 10:14:31 +08:00
|
|
|
) {
|
|
|
|
covers.push({
|
2025-07-11 18:09:58 +08:00
|
|
|
latitude: data[i].latitude,
|
|
|
|
longitude: data[i].longitude,
|
2024-10-10 10:14:31 +08:00
|
|
|
iconPath: imgH,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
uni.getLocation({
|
|
|
|
type: "GCJ02",
|
|
|
|
success: (res) => {
|
|
|
|
const result = gcoord.transform(
|
|
|
|
[res.longitude, res.latitude],
|
|
|
|
gcoord.GCJ02,
|
|
|
|
gcoord.BD09
|
|
|
|
);
|
|
|
|
this.mapUrl =
|
|
|
|
"https://skqhdg.porthebei.com:9004/map/map.html?point=" +
|
|
|
|
encodeURIComponent(JSON.stringify(covers)) +
|
|
|
|
"&longitude=" +
|
|
|
|
result[0] +
|
|
|
|
"&latitude=" +
|
|
|
|
result[1];
|
|
|
|
},
|
|
|
|
fail: () => {
|
|
|
|
uni.showToast({
|
|
|
|
title: "获取位置失败",
|
|
|
|
icon: "none",
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
isEmpty(value) {
|
|
|
|
return (
|
|
|
|
value === undefined ||
|
|
|
|
value === null ||
|
|
|
|
value === "undefined" ||
|
|
|
|
value === "null" ||
|
|
|
|
(typeof value === "object" && Object.keys(value).length === 0) ||
|
|
|
|
(typeof value === "string" && value.trim().length === 0)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss"></style>
|