|
@@ -337,35 +337,40 @@ export default {
|
|
|
|
|
|
},
|
|
},
|
|
setValue(){
|
|
setValue(){
|
|
- if (this.start){
|
|
|
|
- this.end = this.input3
|
|
|
|
- }else {
|
|
|
|
- this.start = this.input3
|
|
|
|
- }
|
|
|
|
|
|
+ // if (this.start){
|
|
|
|
+ // this.end = this.input3
|
|
|
|
+ // }else {
|
|
|
|
+ // this.start = this.input3
|
|
|
|
+ // }
|
|
},
|
|
},
|
|
loadFind(){
|
|
loadFind(){
|
|
- let start = [125,43]
|
|
|
|
- let end = [125.8,43.8]
|
|
|
|
let option = {
|
|
let option = {
|
|
width: '8',
|
|
width: '8',
|
|
color: '#f40'
|
|
color: '#f40'
|
|
};
|
|
};
|
|
- let toolRoute = new CTMapOl.extend.ToolRoute(this.map.map, option);
|
|
|
|
- toolRoute.route(start, end).then(data => {
|
|
|
|
- toolRoute.drawPath(data.routs)
|
|
|
|
- })
|
|
|
|
const location = new CTMapOl.extend.ToolLocation(this.map.map, {
|
|
const location = new CTMapOl.extend.ToolLocation(this.map.map, {
|
|
onPick: coords => {
|
|
onPick: coords => {
|
|
- console.log(coords)
|
|
|
|
|
|
+ console.log('coords',coords)
|
|
|
|
+ if (this.start){
|
|
|
|
+ this.end = [coords[0],coords[1]]
|
|
|
|
+ }else {
|
|
|
|
+ this.start = [coords[0],coords[1]]
|
|
|
|
+ }
|
|
}
|
|
}
|
|
})
|
|
})
|
|
location._draw.overlay_.setStyle(null) //
|
|
location._draw.overlay_.setStyle(null) //
|
|
- location.locate([116.4, 39.6]) //
|
|
|
|
location.pick() //
|
|
location.pick() //
|
|
const onClickMap = this.map.on('click', evt => {
|
|
const onClickMap = this.map.on('click', evt => {
|
|
console.log(evt.coordinate)
|
|
console.log(evt.coordinate)
|
|
})
|
|
})
|
|
CTMapOl.Observable.unByKey(onClickMap)
|
|
CTMapOl.Observable.unByKey(onClickMap)
|
|
|
|
+
|
|
|
|
+ if (this.start.length===2 && this.end.length===2) {
|
|
|
|
+ let toolRoute = new CTMapOl.extend.ToolRoute(this.map.map, option);
|
|
|
|
+ toolRoute.route(this.start, this.end).then(data => {
|
|
|
|
+ toolRoute.drawPath(data.routs)
|
|
|
|
+ })
|
|
|
|
+ }
|
|
},
|
|
},
|
|
handleSizeChange(val) {
|
|
handleSizeChange(val) {
|
|
console.log(`每页 ${val} 条`);
|
|
console.log(`每页 ${val} 条`);
|