bug修复

This commit is contained in:
刘旋 2023-04-25 17:21:21 +08:00
parent b370c7cc01
commit f30a3ff7dc
3 changed files with 28 additions and 10 deletions

View File

@ -59,6 +59,10 @@ onMounted(() => {
const mapOperations = { const mapOperations = {
wktParseToMap: (res) => { wktParseToMap: (res) => {
let layer = omnivore.wkt.parse(res) let layer = omnivore.wkt.parse(res)
if(featureLayerG_area.getLayers().length != 0||featureLayerG_point.getLayers().length != 0){
return;
}
layer.addTo(featureLayerG_point) layer.addTo(featureLayerG_point)
let attr = Object.values(layer._layers) let attr = Object.values(layer._layers)
@ -66,9 +70,12 @@ const mapOperations = {
// flyTo // flyTo
if (attr[0].feature.geometry.type.indexOf('Polygon') == -1) { if (attr[0].feature.geometry.type.indexOf('Polygon') == -1) {
homeMap.flyTo([attr[0].feature.geometry.coordinates[1], attr[0].feature.geometry.coordinates[0]], 3) homeMap.flyTo([attr[0].feature.geometry.coordinates[1], attr[0].feature.geometry.coordinates[0]], 3)
variableStore.layerGroupPoint=res;
return {'layer':layer,'location':[attr[0].feature.geometry.coordinates[1],attr[0].feature.geometry.coordinates[0]]}
} }
// fly // fly
else { else {
variableStore.layerGroupPoly=res;
let polygons = []; let polygons = [];
for (let i = 0; i < attr[0].feature.geometry.coordinates.length; i++) { for (let i = 0; i < attr[0].feature.geometry.coordinates.length; i++) {
console.log(attr[0].feature.geometry.coordinates[i]) console.log(attr[0].feature.geometry.coordinates[i])
@ -83,8 +90,9 @@ const mapOperations = {
let final_center = turf.center(turf.featureCollection(features)) let final_center = turf.center(turf.featureCollection(features))
// console.log(final_center) // console.log(final_center)
homeMap.flyTo([final_center.geometry.coordinates[1], final_center.geometry.coordinates[0]], 3) homeMap.flyTo([final_center.geometry.coordinates[1], final_center.geometry.coordinates[0]], 3)
return {'layer':layer,'location':null}
} }
return layer // return layer
}, },
/** /**
@ -313,6 +321,11 @@ const mapOperations = {
}) })
e.layer.addTo(featureLayerG_area) e.layer.addTo(featureLayerG_area)
polygon = e.layer polygon = e.layer
let features = featureLayerG_area.toGeoJSON().features
variableStore.layerGroupPoly = features.map(function (feature) {
return WKT.convert(feature.geometry)
})
variableStore.layerGroupPoly = variableStore.layerGroupPoly.join('\n')
}) })
// featureLayerG_area.clearLayers() // featureLayerG_area.clearLayers()
// variableStore.layerGroupPoly=null; // variableStore.layerGroupPoly=null;

View File

@ -4,7 +4,7 @@ import qs from 'qs';
import { Session } from '/@/utils/storage'; import { Session } from '/@/utils/storage';
// export const moduleName = 'zqq-biz-vordm'; // export const moduleName = 'zqq-biz-vordm';
export const moduleName = 'biz-vordm'; export const moduleName = 'glj-biz-vordm';
export const crawlModule = 'vordm-crawl'; export const crawlModule = 'vordm-crawl';
// 配置新建一个 axios 实例 // 配置新建一个 axios 实例
const service = axios.create({ const service = axios.create({

View File

@ -111,7 +111,7 @@
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</div> </div>
<el-dialog v-model="state.dialogVisible" title="Review" width="30%"> <el-dialog v-model="state.dialogVisible" title="Approval" width="30%">
<el-container style="margin-top: -2%;margin-bottom: 2%;"> <el-container style="margin-top: -2%;margin-bottom: 2%;">
<el-radio v-model="state.radio" label='1' @click="mapEvents('1')">Point</el-radio> <el-radio v-model="state.radio" label='1' @click="mapEvents('1')">Point</el-radio>
<el-radio v-model="state.radio" label='2' @click="mapEvents('2')">Area</el-radio> <el-radio v-model="state.radio" label='2' @click="mapEvents('2')">Area</el-radio>
@ -238,7 +238,10 @@ const onOpenEditRole = (type, row) => {
if(state.wktPoint_Poly){ if(state.wktPoint_Poly){
mapRef.value.mapOperations.removeLayer(state.wktPoint_Poly) mapRef.value.mapOperations.removeLayer(state.wktPoint_Poly)
} }
state.wktPoint_Poly= mapRef.value.mapOperations.wktParseToMap(row.geometry) let wkt=mapRef.value.mapOperations.wktParseToMap(row.geometry)
state.wktPoint_Poly= wkt.layer
console.log(wkt.location)
changelatlon(wkt.location[0],wkt.location[1]);
// mapRef.value.mapOperations.on("click", (res)=>{ // mapRef.value.mapOperations.on("click", (res)=>{
// mapRef.value.mapOperations.clearPolygon() // mapRef.value.mapOperations.clearPolygon()
// mapRef.value.mapOperations.removeLayer( state.wktPoint_Poly) // mapRef.value.mapOperations.removeLayer( state.wktPoint_Poly)
@ -251,7 +254,7 @@ const mapEvents = (ev)=>{
if(ev == '1'){ if(ev == '1'){
// mapRef.value.mapOperations.clearPolygon() // mapRef.value.mapOperations.clearPolygon()
mapRef.value.mapOperations.on("click", mapClick) mapRef.value.mapOperations.on("click", mapClick)
mapRef.value.mapOperations.on("mousemove", changelatlon) // mapRef.value.mapOperations.on("mousemove", changelatlon)
mapRef.value.mapOperations.clearPolygon() mapRef.value.mapOperations.clearPolygon()
}else if(ev == '2'){ }else if(ev == '2'){
@ -275,8 +278,8 @@ const ClearSubmit = () => {
} }
const mapClick=(res)=>{ const mapClick=(res)=>{
mapRef.value.mapOperations.removeLayer( state.wktPoint_Poly ) mapRef.value.mapOperations.removeLayer( state.wktPoint_Poly )
changelatlon(res); changelatlon(res.latlng.lat.toFixed(3),res.latlng.lng.toFixed(3));
state.wktPoint_Poly=mapRef.value.mapOperations.addInteractMarker(res.latlng.lat.toFixed(3),res.latlng.lng.toFixed(3)) mapRef.value.mapOperations.addInteractMarker(res.latlng.lat.toFixed(3),res.latlng.lng.toFixed(3))
// console.log(state.wktPoint_Poly) // console.log(state.wktPoint_Poly)
} }
const reviews = (index) => { const reviews = (index) => {
@ -307,10 +310,12 @@ const onHandleCurrentChange = (val) => {
state.tableData.param.pageNum = val; state.tableData.param.pageNum = val;
getTableData(); getTableData();
}; };
const changelatlon = (e) => { const changelatlon = (lat,lon) => {
//e //e
state.dislat = e.latlng.lat.toFixed(3); // state.dislat = e.latlng.lat.toFixed(3);
state.dislon= e.latlng.lng.toFixed(3); // state.dislon= e.latlng.lng.toFixed(3);
state.dislat = lat;
state.dislon= lon;
// if (state.lon < 0) { // if (state.lon < 0) {
// state.lon = state.lon + 360; // state.lon = state.lon + 360;
// } // }