|
|
|
@ -46,6 +46,8 @@ const dateRange = ref([])
|
|
|
|
|
let map = null
|
|
|
|
|
let polyline = null
|
|
|
|
|
let polylinePath = ref([])
|
|
|
|
|
let distance = null
|
|
|
|
|
let text = null
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let mouseTool = null
|
|
|
|
@ -108,6 +110,7 @@ const convertFrom = (LngLatArray, success) =>{
|
|
|
|
|
const handleQuery = () => {
|
|
|
|
|
polyline ? map.remove([polyline]) : ''
|
|
|
|
|
getTrack(proxy.addDateRange(queryParams.value, dateRange.value)).then(e => {
|
|
|
|
|
text&&text.remove()
|
|
|
|
|
let pathRow = e.data.map(val => [val.longitude, val.latitude])
|
|
|
|
|
convertFrom(pathRow,(result)=>{
|
|
|
|
|
let lnglats = result.map(e => [e.lng, e.lat]);
|
|
|
|
@ -118,8 +121,8 @@ const handleQuery = () => {
|
|
|
|
|
strokeWeight: 6 // 线宽
|
|
|
|
|
})
|
|
|
|
|
map.add(polyline);
|
|
|
|
|
let distance = Math.round(AMap.GeometryUtil.distanceOfLine(lnglats));
|
|
|
|
|
let text = new AMap.Text({
|
|
|
|
|
distance = Math.round(AMap.GeometryUtil.distanceOfLine(lnglats));
|
|
|
|
|
text = new AMap.Text({
|
|
|
|
|
position: lnglats.at(-1),
|
|
|
|
|
text: '行驶路径' + distance + '米',
|
|
|
|
|
offset: new AMap.Pixel(-20, -20)
|
|
|
|
|