道路经纬度
This commit is contained in:
@@ -90,6 +90,27 @@
|
|||||||
<a-form-item label="测点纬度" name="placeLat">
|
<a-form-item label="测点纬度" name="placeLat">
|
||||||
<a-input v-model:value="form.placeLat" placeholder="请输入测点纬度" allow-clear/>
|
<a-input v-model:value="form.placeLat" placeholder="请输入测点纬度" allow-clear/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
<a-form-item label="道路起点" name="roadStartLng">
|
||||||
|
<a-input-search @search="showRoadMap('start',form.roadStartLng,form.roadStartLat)" :value="`[${form.roadStartLng},${form.roadStartLat}]`" placeholder="请选择道路起点" allow-clear>
|
||||||
|
<template #enterButton>
|
||||||
|
<a-button>选择位置</a-button>
|
||||||
|
</template>
|
||||||
|
</a-input-search>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="道路终点" name="roadEndLat">
|
||||||
|
<a-input-search @search="showRoadMap('end',form.roadStartLng,form.roadStartLat)" :value="`[${form.roadEndLng},${form.roadEndLat}]`" placeholder="请选择道路终点" >
|
||||||
|
<template #enterButton>
|
||||||
|
<a-button>选择位置</a-button>
|
||||||
|
</template>
|
||||||
|
</a-input-search>
|
||||||
|
</a-form-item>
|
||||||
|
<a-modal :closable="false" :destroy-on-close="true" :width="1000" :body-style="{height:'700px'}" v-model:visible="visibleRoadMap" :title="roadMapTitle"
|
||||||
|
>
|
||||||
|
<div style="width: 100%;height: 100%;" ref="roadMap" id="roadMap"></div>
|
||||||
|
<template #footer>
|
||||||
|
<a-button key="submit" type="primary" @click="visibleRoadMap = false">确定</a-button>
|
||||||
|
</template>
|
||||||
|
</a-modal>
|
||||||
<a-form-item label="点位等级" name="regionLevel">
|
<a-form-item label="点位等级" name="regionLevel">
|
||||||
<a-input v-model:value="form.regionLevel" placeholder="请输入点位等级" allow-clear/>
|
<a-input v-model:value="form.regionLevel" placeholder="请输入点位等级" allow-clear/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
@@ -194,6 +215,8 @@ import {DownOutlined} from '@ant-design/icons-vue';
|
|||||||
import XLSX from "xlsx";
|
import XLSX from "xlsx";
|
||||||
import {Modal} from "ant-design-vue";
|
import {Modal} from "ant-design-vue";
|
||||||
// import moment from "moment";
|
// import moment from "moment";
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
const BBMap = BMap;
|
||||||
export default {
|
export default {
|
||||||
name: "RoadNoisePlace",
|
name: "RoadNoisePlace",
|
||||||
components: {DownOutlined},
|
components: {DownOutlined},
|
||||||
@@ -231,6 +254,9 @@ export default {
|
|||||||
// 表格选中数据
|
// 表格选中数据
|
||||||
selectionList: [],
|
selectionList: [],
|
||||||
// 是否显示编辑弹窗
|
// 是否显示编辑弹窗
|
||||||
|
visibleRoadMap: false,
|
||||||
|
roadMapTitle: "选择坐标",
|
||||||
|
roadMapPoint: {},
|
||||||
showEdit: false,
|
showEdit: false,
|
||||||
showNYear: false,
|
showNYear: false,
|
||||||
cYear: undefined,
|
cYear: undefined,
|
||||||
@@ -247,6 +273,7 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
||||||
this.getOptions();
|
this.getOptions();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -256,6 +283,73 @@ export default {
|
|||||||
this.$refs.table.reload({
|
this.$refs.table.reload({
|
||||||
where: this.where,
|
where: this.where,
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
showRoadMap(roadAttr,lng,lat) {
|
||||||
|
this.visibleRoadMap = true
|
||||||
|
if(roadAttr === "start"){
|
||||||
|
this.roadMapTitle = "选择道路起点"
|
||||||
|
}else {
|
||||||
|
this.roadMapTitle = "选择道路终点"
|
||||||
|
}
|
||||||
|
this.$nextTick(() => {
|
||||||
|
console.log(lat,lng)
|
||||||
|
console.log(this.$refs.roadMap)
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
var map = new BBMap.Map(this.$refs.roadMap); // 创建Map实例
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
map.addControl(new BBMap.NavigationControl()); //初始化地图控件
|
||||||
|
map.addControl(new BBMap.ScaleControl());
|
||||||
|
map.addControl(new BBMap.OverviewMapControl());
|
||||||
|
var point = new BBMap.Point(lng?lng:108.33, lat?lat:22.84);
|
||||||
|
map.centerAndZoom(point, 13);//初始化地图中心点
|
||||||
|
var marker = new BBMap.Marker(point); //初始化地图标记
|
||||||
|
marker.enableDragging(); //标记开启拖拽
|
||||||
|
|
||||||
|
var gc = new BBMap.Geocoder();//地址解析类
|
||||||
|
//添加标记拖拽监听
|
||||||
|
marker.addEventListener("dragend", (e)=> {
|
||||||
|
//获取地址信息
|
||||||
|
if(roadAttr === "start"){
|
||||||
|
this.form['roadStartLng'] = e.point.lng
|
||||||
|
this.form['roadStartLat'] = e.point.lat
|
||||||
|
}else {
|
||||||
|
this.form['roadEndLng'] = e.point.lng
|
||||||
|
this.form['roadEndLat'] = e.point.lat
|
||||||
|
}
|
||||||
|
|
||||||
|
gc.getLocation(e.point, function (rs) {
|
||||||
|
showLocationInfo(e.point, rs);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
//添加标记点击监听
|
||||||
|
marker.addEventListener("click", function (e) {
|
||||||
|
gc.getLocation(e.point, function (rs) {
|
||||||
|
showLocationInfo(e.point, rs);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
map.centerAndZoom(point, 15); //设置中心点坐标和地图级别
|
||||||
|
map.addOverlay(marker); //将标记添加到地图中
|
||||||
|
//显示地址信息窗口
|
||||||
|
function showLocationInfo(pt, rs){
|
||||||
|
var opts = {
|
||||||
|
width : 250, //信息窗口宽度
|
||||||
|
height: 100, //信息窗口高度
|
||||||
|
title : "" //信息窗口标题
|
||||||
|
}
|
||||||
|
var addComp = rs.addressComponents;
|
||||||
|
var addr = "当前位置:" + addComp.province + ", " + addComp.city + ", " + addComp.district + ", " + addComp.street + ", " + addComp.streetNumber + "<br/>";
|
||||||
|
addr += "纬度: " + pt.lat + ", " + "经度:" + pt.lng;
|
||||||
|
|
||||||
|
var infoWindow = new BBMap.InfoWindow(addr, opts); //创建信息窗口对象
|
||||||
|
marker.openInfoWindow(infoWindow);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
},
|
||||||
|
handleRoadMapOk() {
|
||||||
|
|
||||||
},
|
},
|
||||||
getOptions() {
|
getOptions() {
|
||||||
getColumnOptions("year").then(res => {
|
getColumnOptions("year").then(res => {
|
||||||
|
|||||||
Reference in New Issue
Block a user