修改地图

dev
夜笙歌 7 months ago
parent 7b4097263e
commit 01c182ba31

@ -110,6 +110,10 @@
</div> </div>
</div> </div>
</div> </div>
<div style="text-align: center;margin: 8px 0;">
<el-button type="primary" v-if="isMap" @click="continueMap" :disabled="mapTotal < (mapOffset+1)*100" >继续加载</el-button>
</div>
<el-table <el-table
v-show="isMap" v-show="isMap"
:data="mapData" :data="mapData"
@ -172,6 +176,8 @@ export default {
components: {}, components: {},
data() { data() {
return { return {
mapOffset:0,
mapTotal:0,
vh: document.documentElement.offsetHeight / 100, vh: document.documentElement.offsetHeight / 100,
topData: {}, topData: {},
bottomData: [], bottomData: [],
@ -231,24 +237,31 @@ export default {
setMarkerSharding(e) { setMarkerSharding(e) {
let sum = e.length let sum = e.length
let nowNum = 0 let nowNum = 0
let fun = () => { e.forEach(v => {
setTimeout(() => {
let arr = e.splice(nowNum * 20, (nowNum + 1) * 20)
arr.forEach(v => {
this.setMarker([v.longitude, v.latitude], v.ts) this.setMarker([v.longitude, v.latitude], v.ts)
}) })
this.setPolyline(arr.map(e => { this.setPolyline(e.map(e => {
return [e.longitude, e.latitude] return [e.longitude, e.latitude]
})) }))
nowNum += 1
flag && map.setFitView() flag && map.setFitView()
if (nowNum * 20 <= sum) { // let fun = () => {
fun() // setTimeout(() => {
} // let arr = e.splice(nowNum * 20, (nowNum + 1) * 20)
}, 1000 * 0.5) // arr.forEach(v => {
} // this.setMarker([v.longitude, v.latitude], v.ts)
fun() // })
// this.setPolyline(arr.map(e => {
// return [e.longitude, e.latitude]
// }))
// nowNum += 1
// flag && map.setFitView()
// if (nowNum * 20 <= sum) {
// fun()
// }
// }, 1000 * 0.5)
// }
// fun()
}, },
async currentChange(e) { async currentChange(e) {
@ -274,21 +287,25 @@ export default {
this.date = null this.date = null
} }
}, },
async setHistoryData() { async setHistoryData(isTable=true) {
if(isTable){
this.isMap = false this.isMap = false
map.clearMap() map.clearMap()
this.show = false this.show = false
this.mapOffset = 0
}
const {data} = await getHistoryData({ const {data} = await getHistoryData({
"sceneId": this.$store.getters.sceneId, "sceneId": this.$store.getters.sceneId,
"deviceId": this.deviceId, "deviceId": this.deviceId,
deviceModeId: this.deviceModeId, deviceModeId: this.deviceModeId,
"offset": this.topData.gpsFlag !== '1' ? (this.currentPage - 1) : null, "offset": this.topData.gpsFlag !== '1' ? (this.currentPage - 1) : this.mapOffset,
"limit": this.topData.gpsFlag !== '1' ? 10 : null, "limit": this.topData.gpsFlag !== '1' ? 10 : 100,
startTime: this.date?.[0], startTime: this.date?.[0],
endTime: this.date?.[1], endTime: this.date?.[1],
}) })
let dataList = data.historyData?.dataList || [] let dataList = data.historyData?.dataList || []
if (dataList.filter(e => (Object.keys(e).includes('longitude') || Object.keys(e).includes('longitude'))).length > 0) { if (dataList.filter(e => (Object.keys(e).includes('longitude') || Object.keys(e).includes('longitude'))).length > 0) {
this.mapTotal = data.historyData.count
this.isMap = true this.isMap = true
let mapData = dataList.filter(e => (Object.keys(e).includes('longitude') || Object.keys(e).includes('longitude'))).map(e => { let mapData = dataList.filter(e => (Object.keys(e).includes('longitude') || Object.keys(e).includes('longitude'))).map(e => {
let [lng, lat] = wgs84togcj02(e.longitude, e.latitude) let [lng, lat] = wgs84togcj02(e.longitude, e.latitude)
@ -341,6 +358,10 @@ export default {
map.setFitView([maptext,mapMarker]) map.setFitView([maptext,mapMarker])
flag = false flag = false
console.log(e) console.log(e)
},
continueMap(){
this.mapOffset += 1
this.setHistoryData(false)
} }
} }
}; };

Loading…
Cancel
Save