江河点位修正

This commit is contained in:
weicw
2022-02-07 15:20:17 +08:00
parent 98511f212a
commit 072e889860
5 changed files with 737 additions and 465 deletions

View File

@@ -55,8 +55,11 @@ const waterVillage = function (data) { // 农村
}
const updateRiverCorrectLocation = function (data) { // 江河水质数据查询
return axios.post("/water/visualiz/updatePointLocation", data)
const updateRiverCorrectLocation = function (data) { //
return axios.post("/water/visualiz/updateRiverPointLocation", data)
}
const updateLakeCorrectLocation = function (data) { //
return axios.post("/water/visualiz/updateLakePointLocation", data)
}
export {
getLakePlace,
@@ -71,5 +74,6 @@ export {
waterCity,
waterCounty,
waterVillage,
updateRiverCorrectLocation
updateRiverCorrectLocation,
updateLakeCorrectLocation
}

View File

@@ -25,6 +25,11 @@
<mapNominal :param="nominalList"></mapNominal>
<!-- <map-table-center :rowData="pointData"></map-table-center>-->
<map-table :rowData="pointData"></map-table>
<a-modal @ok="updateCorrectLocation" :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>
</a-modal>
</div>
</template>
<script>
@@ -32,7 +37,8 @@ import {
getLakePlace,
getLakePlaceInnerCity,
getLakeYear,
getInnerLakeYear
getInnerLakeYear,
updateLakeCorrectLocation
} from "@/api/gis/gisApi";
// import {
// getColumnOptions,
@@ -100,7 +106,11 @@ export default {
value: '',
result: [],
searchKey: "",
searchId: -1
searchId: -1,
// 字典表单
visibleRoadMap: false,
roadMapTitle: "选择坐标",
form: {},
};
},
mounted() {
@@ -255,6 +265,12 @@ export default {
that.currentY = 0
that.tipFlag = false
},true)
myCompOverlay.addEventListener('contextmenu',function (e){
let currentId = e.target.getAttribute("id")
const {longitude, latitude, correctLng, correctLat,placeDictId} = that.pointData[currentId.substring(2, currentId.length)]
that.form = {longitude, latitude, correctLng, correctLat,placeDictId}
that.showRoadMap(that.form);
})
})
},
whereChange(e) {
@@ -298,7 +314,10 @@ export default {
'regionLevel': item.regionLevel,
'longitude': item.longitude,
'latitude': item.latitude,
'waterType' : item.waterType
'waterType' : item.waterType,
placeDictId: item.placeDictId,
correctLng: item.correctLng,
correctLat:item.correctLat
})
})
}
@@ -323,7 +342,10 @@ export default {
'regionLevel': item.regionLevel,
'longitude': item.longitude,
'latitude': item.latitude,
'waterType' : item.waterType
'waterType' : item.waterType,
placeDictId: item.placeDictId,
correctLng: item.correctLng,
correctLat:item.correctLat
})
})
}
@@ -333,6 +355,83 @@ export default {
})
}
},
showRoadMap(form) {
const {longitude, latitude, correctLng, correctLat} = form
this.visibleRoadMap = true
// this.roadMapTitle = "选择修正后的道路坐标"
this.$nextTick(() => {
console.log(this.$refs.roadMap)
// eslint-disable-next-line no-undef
var map = new BMap.Map(this.$refs.roadMap); // 创建Map实例
// eslint-disable-next-line no-undef
map.addControl(new BMap.NavigationControl()); //初始化地图控件
// eslint-disable-next-line no-undef
map.addControl(new BMap.ScaleControl());
// eslint-disable-next-line no-undef
map.addControl(new BMap.OverviewMapControl());
// eslint-disable-next-line no-undef
var point = new BMap.Point(correctLng ? correctLng : longitude ? longitude : 108.33, correctLat ? correctLat : latitude ? latitude : 22.84);
// var point = new BBMap.Point(form.longitude ? form.longitude : 108.33, form.latitude ? form.latitude : 22.84);
map.centerAndZoom(point, 13);//初始化地图中心点
// eslint-disable-next-line no-undef
var marker = new BMap.Marker(point); //初始化地图标记
marker.enableDragging(); //标记开启拖拽
// eslint-disable-next-line no-undef
var gc = new BMap.Geocoder();//地址解析类
//添加标记拖拽监听
marker.addEventListener("dragend", (e) => {
//获取地址信息
this.form['correctLng'] = e.point.lng
this.form['correctLat'] = 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;
// eslint-disable-next-line no-undef
var infoWindow = new BMap.InfoWindow(addr, opts); //创建信息窗口对象
marker.openInfoWindow(infoWindow);
}
})
},
updateCorrectLocation(){
const {correctLng, correctLat,placeDictId} = that.form;
const reqData = {correctLng, correctLat,id:placeDictId};
console.log(that.form)
if(this.where.type == "0"){
reqData.type = "city"
}else{
reqData.type = "special"
}
updateLakeCorrectLocation(reqData).then(res=>{
if(res.data.code == 0){
this.visibleRoadMap = false
this.whereChange();
}
})
}
}
}

View File

@@ -297,7 +297,7 @@ export default {
})
// eslint-disable-next-line no-undef
var myCompOverlay = new ComplexCustomOverlay(new BMap.Point(Number(item.longitude), Number(item.latitude)), index, color);
var myCompOverlay = new ComplexCustomOverlay(new BMap.Point(Number(item.correctLng?item.correctLng: item.longitude), Number(item.correctLat?item.correctLat:item.latitude)), index, color);
that.map.addOverlay(myCompOverlay);//将标注添加到地图中
myCompOverlay.addEventListener('mouseover', function (e) {
let currentId = e.target.getAttribute("id")
@@ -480,6 +480,7 @@ export default {
updateRiverCorrectLocation(reqData).then(res=>{
if(res.data.code == 0){
this.requestFun()
this.visibleRoadMap = false
}
})

View File

@@ -56,6 +56,23 @@
<a-form-item label="纬度" name="latitude">
<a-input v-model:value="form.latitude" placeholder="请输入点位纬度" allow-clear />
</a-form-item>
<a-form-item label="修正位置" name="correctLocation">
<a-input-search @search="showRoadMap(form)"
:value="`[${form.correctLng},${form.correctLat}]`" placeholder="`[${form.longitude},${form.latitude}]`" allow-clear>
<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="type">
<a-input v-model:value="form.type" placeholder="请输入类别" allow-clear />
</a-form-item>
@@ -156,6 +173,8 @@
title: "点位纬度",
dataIndex: "latitude",
},
{title: "修正经度", dataIndex: "correctLng"},
{title: "修正纬度", dataIndex: "correctLat"},
{
title: "类别",
dataIndex: "type",
@@ -220,6 +239,8 @@
showNYear: false,
cYear: undefined,
nYear: undefined,
visibleRoadMap: false,
roadMapTitle: "选择坐标",
};
},
mounted() {
@@ -369,7 +390,67 @@
let sheet = XLSX.utils.aoa_to_sheet(arr);
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
}
},
showRoadMap(form) {
const {longitude,latitude,correctLng,correctLat} = form
this.visibleRoadMap = true
this.roadMapTitle = "选择修正后的道路坐标"
this.$nextTick(() => {
console.log(this.$refs.roadMap)
// eslint-disable-next-line no-undef
var map = new BMap.Map(this.$refs.roadMap); // 创建Map实例
// eslint-disable-next-line no-undef
map.addControl(new BMap.NavigationControl()); //初始化地图控件
// eslint-disable-next-line no-undef
map.addControl(new BMap.ScaleControl());
// eslint-disable-next-line no-undef
map.addControl(new BMap.OverviewMapControl());
// eslint-disable-next-line no-undef
var point = new BMap.Point(correctLng?correctLng:longitude?longitude:108.33,correctLat?correctLat:latitude?latitude:22.84);
// var point = new BBMap.Point(form.longitude ? form.longitude : 108.33, form.latitude ? form.latitude : 22.84);
map.centerAndZoom(point, 13);//初始化地图中心点
// eslint-disable-next-line no-undef
var marker = new BMap.Marker(point); //初始化地图标记
marker.enableDragging(); //标记开启拖拽
// eslint-disable-next-line no-undef
var gc = new BMap.Geocoder();//地址解析类
//添加标记拖拽监听
marker.addEventListener("dragend", (e) => {
//获取地址信息
this.form['correctLng'] = e.point.lng
this.form['correctLat'] = 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;
// eslint-disable-next-line no-undef
var infoWindow = new BMap.InfoWindow(addr, opts); //创建信息窗口对象
marker.openInfoWindow(infoWindow);
}
})
},
},
};

File diff suppressed because it is too large Load Diff