2024-05-21 20:20:10 +08:00

62 lines
1.4 KiB
Vue

<template>
<view style="height: 100vh;width: 100%;">
<view class="page-body">
<view class="page-section page-section-gap">
<map style="width: 100%; height: 100%;" :markers="markersArr" :latitude="latitude"
:longitude="longitude">
</map>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
id: 0, // 使用 marker点击事件 需要填写id
title: 'map',
latitude: 39.909,
longitude: 116.39742,
projectSn: "",
markersArr: [],
}
},
onLoad(option) {
console.log(666777)
this.latitude = option.latitude ? option.latitude : '39.909';
this.longitude = option.longitude ? option.longitude : '116.39742';
this.projectSn = JSON.parse(uni.getStorageSync('projectDetail')).projectSn;
},
methods: {
//获取记录
getListData() {
let that = this;
//获取我整改的巡查记录数量
this.sendRequest({
url: 'xmgl/xzEmergencyRecord/page',
method: 'get',
data: {
projectSn: this.projectSn,
},
success: res => {
console.log(res)
that.markersArr = res.result.filter(item => item.longitude || item.latitude).map(
(item, index) => {
return {
id: index + 1,
latitude: item.latitude ? item.latitude : 0,
longitude: item.longitude ? item.longitude : 0,
title: item.goodsName
}
});
}
})
},
}
}
</script>
<style lang="scss" scoped>
</style>