添加搜索条件

master
夜笙歌 2 years ago
parent a10e60718b
commit 7aa5e3e485

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

Loading…
Cancel
Save