|
|
@ -123,7 +123,7 @@ |
|
|
|
>查询</el-button |
|
|
|
> --> |
|
|
|
<div |
|
|
|
id="map_app" |
|
|
|
id="map_add" |
|
|
|
class="div_map" |
|
|
|
style="width: 500px; height: 300px; margin-top: 20px" |
|
|
|
></div> |
|
|
@ -188,8 +188,8 @@ export default { |
|
|
|
noAvailableVaccines: '1', |
|
|
|
mobile: "", |
|
|
|
address: "", |
|
|
|
longitude: "120.38945519", |
|
|
|
latitude: "36.0722275", |
|
|
|
longitude: "", |
|
|
|
latitude: "", |
|
|
|
}, |
|
|
|
keyWords: null, |
|
|
|
// organizationList: [], |
|
|
@ -333,14 +333,16 @@ export default { |
|
|
|
}, |
|
|
|
// 地图初始化函数,本例取名为init,开发者可根据实际情况定义 |
|
|
|
initMap() { |
|
|
|
let { latitude, longitude } = this.dataForm; |
|
|
|
// 定义地图中心点坐标 |
|
|
|
let _this = this; |
|
|
|
var center = new window.TMap.LatLng( |
|
|
|
_this.dataForm.latitude, |
|
|
|
_this.dataForm.longitude |
|
|
|
); |
|
|
|
if (!latitude || latitude == "" || latitude == "0") { |
|
|
|
latitude = 39.9088810666821; |
|
|
|
longitude = 116.39743841556731; |
|
|
|
} |
|
|
|
console.log(latitude,longitude); |
|
|
|
var center = new window.TMap.LatLng(latitude, longitude); |
|
|
|
// 定义map变量,调用 TMap.Map() 构造函数创建地图 |
|
|
|
map = new window.TMap.Map(document.getElementById("map_app"), { |
|
|
|
map = new window.TMap.Map(document.getElementById("map_add"), { |
|
|
|
center: center, // 设置地图中心点坐标 |
|
|
|
zoom: 17.2, // 设置地图缩放级别 |
|
|
|
pitch: 43.5, // 设置俯仰角 |
|
|
@ -353,12 +355,14 @@ export default { |
|
|
|
geometries: [], |
|
|
|
}); |
|
|
|
infoWindowList = Array(10); |
|
|
|
|
|
|
|
geocoder = new TMap.service.Geocoder(); // 新建一个正逆地址解析类 |
|
|
|
|
|
|
|
// 监听地图平移结束 |
|
|
|
map.on("panend", () => { |
|
|
|
this.handleMoveCenter(); |
|
|
|
}); |
|
|
|
this.handleMoveCenter(); |
|
|
|
// this.handleMoveCenter() |
|
|
|
this.convert(); |
|
|
|
}, |
|
|
|
handleMoveCenter() { |
|
|
@ -381,7 +385,6 @@ export default { |
|
|
|
// 在地图显示范围内以给定的关键字搜索地点 |
|
|
|
search |
|
|
|
.searchRectangle({ |
|
|
|
// keyword: this.keyWords, |
|
|
|
keyword: this.dataForm.address, |
|
|
|
bounds: map.getBounds(), |
|
|
|
}) |
|
|
@ -391,6 +394,7 @@ export default { |
|
|
|
const { |
|
|
|
location: { lat, lng }, |
|
|
|
} = data[0]; |
|
|
|
|
|
|
|
map.setCenter(new TMap.LatLng(lat, lng)); |
|
|
|
this.setMarker(lat, lng); |
|
|
|
this.dataForm.latitude = lat; |
|
|
@ -424,8 +428,14 @@ export default { |
|
|
|
geocoder |
|
|
|
.getAddress({ location: location }) // 将给定的坐标位置转换为地址 |
|
|
|
.then((result) => { |
|
|
|
this.dataForm.address = result.result.address; |
|
|
|
this.dataForm.address = |
|
|
|
this.dataForm.address !== "" && |
|
|
|
this.dataForm.address !== null && |
|
|
|
(this.dataForm.longitude === "" || this.dataForm.longitude === null) |
|
|
|
? this.dataForm.address |
|
|
|
: result.result.address; |
|
|
|
// 显示搜索到的地址 |
|
|
|
console.log(this.dataForm.address); |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
@ -461,8 +471,6 @@ export default { |
|
|
|
if (this.dataForm.id) { |
|
|
|
this.getInfo(); |
|
|
|
} else { |
|
|
|
this.dataForm.longitude = "120.38945519"; |
|
|
|
this.dataForm.latitude = "36.0722275"; |
|
|
|
this.initMap(); |
|
|
|
} |
|
|
|
}); |
|
|
@ -479,6 +487,8 @@ export default { |
|
|
|
...this.dataForm, |
|
|
|
...res.data, |
|
|
|
}; |
|
|
|
this.morningTime = [res.data.moStartTime,res.data.moEndTime] |
|
|
|
this.afterTime = [res.data.afStartTime,res.data.afEndTime] |
|
|
|
if(res.data.moStartTime !== ''){ |
|
|
|
this.morningTime = [res.data.moStartTime,res.data.moEndTime] |
|
|
|
this.afterTime = [res.data.afStartTime,res.data.afEndTime] |
|
|
|