饮用水点位修正

This commit is contained in:
weicw
2022-02-07 18:04:18 +08:00
parent 072e889860
commit b62b755d21
7 changed files with 2522 additions and 1980 deletions

View File

@@ -61,6 +61,10 @@ const updateRiverCorrectLocation = function (data) { //
const updateLakeCorrectLocation = function (data) { //
return axios.post("/water/visualiz/updateLakePointLocation", data)
}
const updateDrinkCorrectLocation = function (data) { //
return axios.post("/water/visualiz/updateDrinkPointLocation", data)
}
export {
getLakePlace,
getAirGis,
@@ -75,5 +79,6 @@ export {
waterCounty,
waterVillage,
updateRiverCorrectLocation,
updateLakeCorrectLocation
updateLakeCorrectLocation,
updateDrinkCorrectLocation
}

View File

@@ -26,10 +26,16 @@
<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>
import {
updateDrinkCorrectLocation,
waterCity,
waterCounty,
waterVillage
@@ -72,7 +78,8 @@ export default {
searchKey: "",
searchId: -1,
regionLevel: "城市",
nominalList: [{
nominalList: [
{
"text": "I类",
"color": "#80BC1C",
"common": "I",
@@ -102,7 +109,11 @@ export default {
"color": "#DA251C",
"common": "劣Ⅴ",
"desc": "劣五类"
}]
}],
// 字典表单
visibleRoadMap: false,
roadMapTitle: "选择坐标",
form: {},
}
},
mounted() {
@@ -212,7 +223,7 @@ export default {
}
})
// eslint-disable-next-line no-undef
var myCompOverlay = new ComplexCustomOverlay(new BMap.Point(item.longitude, item.latitude), index, color);
var myCompOverlay = new ComplexCustomOverlay(new BMap.Point(item.correctLng?item.correctLng: item.longitude, item.correctLat?item.correctLat: item.latitude), index, color);
that.map.addOverlay(myCompOverlay);//将标注添加到地图中
myCompOverlay.addEventListener('mouseover', function (e) {
let currentId = e.target.getAttribute("id")
@@ -242,11 +253,19 @@ export default {
that.currentY = 0
that.tipFlag = false
},true)
myCompOverlay.addEventListener('contextmenu',function (e){
console.log("右键")
let currentId = e.target.getAttribute("id")
const {longitude, latitude, correctLng, correctLat,pointDictId,waterSourceType} = that.pointData[currentId.substring(2, currentId.length)]
that.form = {longitude, latitude, correctLng, correctLat,pointDictId,waterSourceType}
that.showRoadMap(that.form);
})
})
},
whereChange(e) {
whereChange() {
that.map.clearOverlays();
let type = e ? e.target.value : "城市"
let type = this.regionLevel
if (type == "城市") {
// eslint-disable-next-line no-undef
that.map.centerAndZoom(new BMap.Point(108.33, 22.84), that.zoom);
@@ -297,6 +316,84 @@ 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,pointDictId,waterSourceType} = that.form;
const reqData = {correctLng, correctLat,id:pointDictId};
if(this.regionLevel == "城市"){
reqData.type = "city"
}else if(this.regionLevel == "区县"){
reqData.type = "county"+waterSourceType
}else if(this.regionLevel == "农村"){
reqData.type = "village"+waterSourceType
}
updateDrinkCorrectLocation(reqData).then(res=>{
if(res.data.code == 0){
this.whereChange()
this.visibleRoadMap = false
}
})
}
}
}

View File

@@ -20,7 +20,8 @@
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-space>
<a-button type="primary" @click="reload">查询</a-button>
<a-button @click="reset" style="background: #FFA200FF; border-color: #FFA200FF;color: #FFFFFF">重置</a-button>
<a-button @click="reset" style="background: #FFA200FF; border-color: #FFA200FF;color: #FFFFFF">重置
</a-button>
<a-button @click="exportData" type="primary">按年份导出</a-button>
</a-space>
</a-col>
@@ -109,6 +110,24 @@
<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="sortNum">
<a-input-number v-model:value="form.sortNum" placeholder="排序" allow-clear/>
</a-form-item>
@@ -169,7 +188,8 @@
type="primary"
shape="round"
size="small"
>修改</a-button
>修改
</a-button
>
<a-popconfirm
:title="`确认删除这条数据吗?`"
@@ -178,7 +198,8 @@
@confirm="remove(record)"
>
<a-button type="primary" danger shape="round" size="small"
>删除</a-button
>删除
</a-button
>
</a-popconfirm>
</a-space>
@@ -205,6 +226,7 @@ import {
// import moment from "moment";
import {DownOutlined} from '@ant-design/icons-vue';
import XLSX from "xlsx";
export default {
name: "DrinkWaterDict",
components: {DownOutlined},
@@ -230,7 +252,14 @@ export default {
{title: "水源地性质", dataIndex: "waterSourceProperty", sorter: true},
{title: "经度(°)", dataIndex: "longitude", sorter: true,},
{title: "纬度(°)", dataIndex: "latitude", sorter: true,},
{title: "饮用水类型",dataIndex: "drinkingWaterType",sorter: true,customRender: ({text})=> text == 1?"在用":"备用"},
{title: "修正经度", dataIndex: "correctLng"},
{title: "修正纬度", dataIndex: "correctLat"},
{
title: "饮用水类型",
dataIndex: "drinkingWaterType",
sorter: true,
customRender: ({text}) => text == 1 ? "在用" : "备用"
},
{
title: "操作",
key: "action",
@@ -264,6 +293,8 @@ export default {
showNYear: false,
cYear: undefined,
nYear: undefined,
visibleRoadMap: false,
roadMapTitle: "选择坐标",
};
},
mounted() {
@@ -412,7 +443,67 @@ export default {
let sheet = XLSX.utils.aoa_to_sheet(arr);
console.log(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);
}
})
},
},
};
</script>

View File

@@ -20,7 +20,8 @@
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-space>
<a-button type="primary" @click="reload">查询</a-button>
<a-button @click="reset" style="background: #FFA200FF; border-color: #FFA200FF;color: #FFFFFF">重置</a-button>
<a-button @click="reset" style="background: #FFA200FF; border-color: #FFA200FF;color: #FFFFFF">重置
</a-button>
<!-- <a-button @click="exportData" type="primary">按年份导出</a-button> -->
</a-space>
</a-col>
@@ -109,6 +110,24 @@
<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="sortNum">
<a-input-number v-model:value="form.sortNum" placeholder="排序" allow-clear/>
</a-form-item>
@@ -169,7 +188,8 @@
type="primary"
shape="round"
size="small"
>修改</a-button
>修改
</a-button
>
<a-popconfirm
:title="`确认删除这条数据吗?`"
@@ -178,7 +198,8 @@
@confirm="remove(record)"
>
<a-button type="primary" danger shape="round" size="small"
>删除</a-button
>删除
</a-button
>
</a-popconfirm>
</a-space>
@@ -205,6 +226,7 @@ import {
// import moment from "moment";
import {DownOutlined} from '@ant-design/icons-vue';
import XLSX from "xlsx";
export default {
name: "DrinkWaterDict",
components: {DownOutlined},
@@ -230,6 +252,8 @@ export default {
{title: "水源地性质", dataIndex: "waterSourceProperty", sorter: true},
{title: "经度(°)", dataIndex: "longitude", sorter: true,},
{title: "纬度(°)", dataIndex: "latitude", sorter: true,},
{title: "修正经度", dataIndex: "correctLng"},
{title: "修正纬度", dataIndex: "correctLat"},
// {title: "饮用水类型",dataIndex: "drinkingWaterType",sorter: true,customRender: ({text})=> text == 1?"在用":"备用"},
{
title: "操作",
@@ -265,6 +289,8 @@ export default {
showNYear: false,
cYear: undefined,
nYear: undefined,
visibleRoadMap: false,
roadMapTitle: "选择坐标",
};
},
mounted() {
@@ -415,7 +441,67 @@ export default {
let sheet = XLSX.utils.aoa_to_sheet(arr);
console.log(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);
}
})
},
},
};
</script>

View File

@@ -20,7 +20,8 @@
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-space>
<a-button type="primary" @click="reload">查询</a-button>
<a-button @click="reset" style="background: #FFA200FF; border-color: #FFA200FF;color: #FFFFFF">重置</a-button>
<a-button @click="reset" style="background: #FFA200FF; border-color: #FFA200FF;color: #FFFFFF">重置
</a-button>
<a-button @click="exportData" type="primary">按年份导出</a-button>
</a-space>
</a-col>
@@ -106,6 +107,24 @@
<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="sortNum">
<a-input-number v-model:value="form.sortNum" placeholder="排序" allow-clear/>
</a-form-item>
@@ -166,7 +185,8 @@
type="primary"
shape="round"
size="small"
>修改</a-button
>修改
</a-button
>
<a-popconfirm
:title="`确认删除这条数据吗?`"
@@ -175,7 +195,8 @@
@confirm="remove(record)"
>
<a-button type="primary" danger shape="round" size="small"
>删除</a-button
>删除
</a-button
>
</a-popconfirm>
</a-space>
@@ -202,6 +223,7 @@ import {
// import moment from "moment";
import {DownOutlined} from '@ant-design/icons-vue';
import XLSX from "xlsx";
export default {
name: "DrinkWaterDict",
components: {DownOutlined},
@@ -226,7 +248,14 @@ export default {
{title: "水源地性质", dataIndex: "waterSourceProperty", sorter: true},
{title: "经度(°)", dataIndex: "longitude", sorter: true,},
{title: "纬度(°)", dataIndex: "latitude", sorter: true,},
{title: "饮用水类型",dataIndex: "drinkingWaterType",sorter: true,customRender: ({text})=> text == 1?"在用":"备用"},
{title: "修正经度", dataIndex: "correctLng"},
{title: "修正纬度", dataIndex: "correctLat"},
{
title: "饮用水类型",
dataIndex: "drinkingWaterType",
sorter: true,
customRender: ({text}) => text == 1 ? "在用" : "备用"
},
{
title: "操作",
key: "action",
@@ -260,6 +289,8 @@ export default {
showNYear: false,
cYear: undefined,
nYear: undefined,
visibleRoadMap: false,
roadMapTitle: "选择坐标",
};
},
mounted() {
@@ -410,7 +441,67 @@ export default {
let sheet = XLSX.utils.aoa_to_sheet(arr);
console.log(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);
}
})
},
},
};
</script>

View File

@@ -20,7 +20,8 @@
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-space>
<a-button type="primary" @click="reload">查询</a-button>
<a-button @click="reset" style="background: #FFA200FF; border-color: #FFA200FF;color: #FFFFFF">重置</a-button>
<a-button @click="reset" style="background: #FFA200FF; border-color: #FFA200FF;color: #FFFFFF">重置
</a-button>
<a-button @click="exportData" type="primary">按年份导出</a-button>
</a-space>
</a-col>
@@ -100,6 +101,24 @@
<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="sortNum">
<a-input-number v-model:value="form.sortNum" placeholder="排序" allow-clear/>
</a-form-item>
@@ -163,7 +182,8 @@
type="primary"
shape="round"
size="small"
>修改</a-button
>修改
</a-button
>
<a-popconfirm
:title="`确认删除这条数据吗?`"
@@ -172,7 +192,8 @@
@confirm="remove(record)"
>
<a-button type="primary" danger shape="round" size="small"
>删除</a-button
>删除
</a-button
>
</a-popconfirm>
</a-space>
@@ -198,6 +219,7 @@ import {
// import moment from "moment";
import {DownOutlined} from '@ant-design/icons-vue';
import XLSX from "xlsx";
export default {
name: "DrinkWaterDict",
components: {DownOutlined},
@@ -222,6 +244,8 @@ export default {
// {title: "湖库(是/否)",dataIndex: "lakeLibraryFlag",sorter: true,},
{title: "经度(°)", dataIndex: "longitude", sorter: true,},
{title: "纬度(°)", dataIndex: "latitude", sorter: true,},
{title: "修正经度", dataIndex: "correctLng"},
{title: "修正纬度", dataIndex: "correctLat"},
{title: "服务人口数量(人)", dataIndex: "numberServingPopulation", sorter: true,},
{title: "日供水规模(吨)", dataIndex: "dailyWaterSupplyScale", sorter: true,},
{
@@ -257,6 +281,8 @@ export default {
showNYear: false,
cYear: undefined,
nYear: undefined,
visibleRoadMap: false,
roadMapTitle: "选择坐标",
};
},
mounted() {
@@ -405,7 +431,67 @@ export default {
let sheet = XLSX.utils.aoa_to_sheet(arr);
console.log(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);
}
})
},
},
};
</script>

View File

@@ -20,7 +20,8 @@
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-space>
<a-button type="primary" @click="reload">查询</a-button>
<a-button @click="reset" style="background: #FFA200FF; border-color: #FFA200FF;color: #FFFFFF">重置</a-button>
<a-button @click="reset" style="background: #FFA200FF; border-color: #FFA200FF;color: #FFFFFF">重置
</a-button>
<a-button @click="exportData" type="primary">按年份导出</a-button>
</a-space>
</a-col>
@@ -100,6 +101,24 @@
<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="sortNum">
<a-input-number v-model:value="form.sortNum" placeholder="排序" allow-clear/>
</a-form-item>
@@ -164,7 +183,8 @@
type="primary"
shape="round"
size="small"
>修改</a-button
>修改
</a-button
>
<a-popconfirm
:title="`确认删除这条数据吗?`"
@@ -173,7 +193,8 @@
@confirm="remove(record)"
>
<a-button type="primary" danger shape="round" size="small"
>删除</a-button
>删除
</a-button
>
</a-popconfirm>
</a-space>
@@ -198,6 +219,7 @@ import {
// import moment from "moment";
import {DownOutlined} from '@ant-design/icons-vue';
import XLSX from "xlsx";
export default {
name: "DrinkWaterDict",
components: {DownOutlined},
@@ -222,6 +244,8 @@ export default {
{title: "湖库(是/否)", dataIndex: "lakeLibraryFlag", sorter: true,},
{title: "经度(°)", dataIndex: "longitude", sorter: true,},
{title: "纬度(°)", dataIndex: "latitude", sorter: true,},
{title: "修正经度", dataIndex: "correctLng"},
{title: "修正纬度", dataIndex: "correctLat"},
{title: "服务人口数量(人)", dataIndex: "numberServingPopulation", sorter: true,},
{title: "日供水规模(吨)", dataIndex: "dailyWaterSupplyScale", sorter: true,},
{
@@ -257,6 +281,8 @@ export default {
showNYear: false,
cYear: undefined,
nYear: undefined,
visibleRoadMap: false,
roadMapTitle: "选择坐标",
};
},
mounted() {
@@ -405,7 +431,67 @@ export default {
let sheet = XLSX.utils.aoa_to_sheet(arr);
console.log(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);
}
})
},
},
};
</script>