修改地图

dev
夜笙歌 1 year ago
parent 24975487c6
commit 15a5c13d70

@ -194,12 +194,12 @@ export default {
CircleEditor.setTarget();
CircleEditor.open()
},
setPolygon(val) {
setPolygon(val, id) {
let e = val.map(r => {
let [lng, lat] = wgs84togcj02(r[0], r[1])
return [lng, lat]
})
let thisPolygon = new AMap.Polygon({path: e});
let thisPolygon = new AMap.Polygon({path: e, extData: {id: id}});
thisPolygon.on('dblclick', () => {
polyEditor.setTarget(thisPolygon);
polyEditor.open();
@ -211,11 +211,11 @@ export default {
map.add(thisPolygon)
map.setFitView()
},
setCircle(val) {
setCircle(val, id) {
let e = val
let [lng, lat] = wgs84togcj02(val.center[0], val.center[1])
e.center = [lng, lat]
let thisCircle = new AMap.Circle({center: e.center, radius: e.radius});
let thisCircle = new AMap.Circle({center: e.center, radius: e.radius, extData: {id: id}});
thisCircle.on('dblclick', () => {
CircleEditor.setTarget(thisCircle);
CircleEditor.open();
@ -230,31 +230,39 @@ export default {
getAreaData() {
let polygons = map.getAllOverlays('polygon');
let circles = map.getAllOverlays('circle');
let list = polygons.map(e => e._opts.path)//
let list1 = circles.map(e => {//
let list = polygons.map(e => {
return {
center: Array.isArray(e._opts.center) ? e._opts.center : [e._opts.center.lng, e._opts.center.lat],
radius: e._opts.radius
coordinates: e._opts.path,
id: e._opts?.extData?.id || null
}
})
let params = []
let params1 = []
list.forEach((e, index) => {
e.forEach(val => {
})//
let params = list.map(e => {
let data = e.coordinates.map(val => {
let [lng, lat] = gcj02towgs84(val[0], val[1])
params.push({
return {
longitude: lng,
latitude: lat,
index: index
})
}
})
return {
coordinates: data,
fenceAreaId: e.id || null
}
})
let list1 = circles.map(e => {//
return {
center: Array.isArray(e._opts.center) ? e._opts.center : [e._opts.center.lng, e._opts.center.lat],
radius: e._opts.radius,
id: e._opts?.extData?.id || null
}
})
let params1 = []
list1.forEach((e, index) => {
let [lng, lat] = gcj02towgs84(e.center[0], e.center[1])
params1.push({
center: [lng, lat],
radius: e.radius,
index: index
fenceAreaId: e.id || null
})
})
@ -278,27 +286,18 @@ export default {
polygonAreaListArr.forEach(e1 => {
let polygonAreaListJson = JSON.parse(e1);
let polyJsonArr = JSON.parse(polygonAreaListJson["polyJsonArr"]);
let fenceAreaId = polygonAreaListJson["fenceAreaId"];
polyJsonArr.forEach(e => {
if (polygonData1[e.index]) {
polygonData1[e.index].push([e.longitude, e.latitude])
} else {
polygonData1[e.index] = [[e.longitude, e.latitude]]
}
})
})
Object.keys(polygonData1).forEach(e => {
polygonData[e] = polygonData1[e]
})
polygonData.forEach(e => {
this.setPolygon(e)
let fenceAreaId = polygonAreaListJson["fenceAreaId"] || null;
console.log(polyJsonArr)
this.setPolygon(polyJsonArr.map(e => {
return [e.longitude, e.latitude]
}), fenceAreaId)
})
circleAreaList.forEach(e => {
let fenceAreaId = e.fenceAreaId;
let fenceAreaId = e.fenceAreaId || null;
let center = JSON.parse(e.center);
let radius = e.radius;
this.setCircle({center, radius})
this.setCircle({center, radius}, fenceAreaId)
})
});
} else {

@ -35,9 +35,10 @@ module.exports = {
proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: {
target: `http://127.0.0.1:9080`,
// target: `http://10.11.40.120:9080`,
// target: `http://127.0.0.1:9080`,
target: `http://10.11.40.120:9080`,
// target: `http://10.11.43.111:8080`,
// target: `http://175.27.215.92:9080`,
changeOrigin: true,
pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: ''

Loading…
Cancel
Save