|
|
|
@ -35,13 +35,10 @@
|
|
|
|
|
|
|
|
|
|
</el-form>
|
|
|
|
|
<div>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-button type="primary" @click="createPolygon">新增多边形</el-button>
|
|
|
|
|
|
|
|
|
|
<el-button type="primary" @click="createCircle">新增圆</el-button>
|
|
|
|
|
<el-button type="primary" @click="clear">清空</el-button>
|
|
|
|
|
<el-button type="primary" @click="submitForm">保存</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-button type="primary" @click="createPolygon">新增多边形</el-button>
|
|
|
|
|
<el-button type="primary" @click="createCircle">新增圆</el-button>
|
|
|
|
|
<el-button type="primary" @click="clear">清空</el-button>
|
|
|
|
|
<el-button type="primary" @click="submitForm">保存</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="map" class="map"></div>
|
|
|
|
@ -55,12 +52,14 @@ import {
|
|
|
|
|
updateElectronicFence,
|
|
|
|
|
getEditedScenes
|
|
|
|
|
} from "@/api/business/electronicFence";
|
|
|
|
|
import {
|
|
|
|
|
gcj02towgs84,
|
|
|
|
|
wgs84togcj02
|
|
|
|
|
} from '@/utils/coordtransform'
|
|
|
|
|
|
|
|
|
|
let map = null
|
|
|
|
|
let polyEditor = null
|
|
|
|
|
let CircleEditor = null
|
|
|
|
|
let path = [[116.390969, 39.911592], [116.391496, 39.909008], [116.389264, 39.909765], [116.38802, 39.911016]]
|
|
|
|
|
let path1 = [[116.391969, 39.912592], [116.392496, 39.910008], [116.390264, 39.910765], [116.38902, 39.912016]]
|
|
|
|
|
export default {
|
|
|
|
|
dicts: ['hw_fence_trigger_status'],
|
|
|
|
|
components: {},
|
|
|
|
@ -195,7 +194,11 @@ export default {
|
|
|
|
|
CircleEditor.setTarget();
|
|
|
|
|
CircleEditor.open()
|
|
|
|
|
},
|
|
|
|
|
setPolygon(e) {
|
|
|
|
|
setPolygon(val) {
|
|
|
|
|
let e = val.map(r => {
|
|
|
|
|
let [lng, lat] = wgs84togcj02(r[0], r[1])
|
|
|
|
|
return [lng, lat]
|
|
|
|
|
})
|
|
|
|
|
let thisPolygon = new AMap.Polygon({path: e});
|
|
|
|
|
thisPolygon.on('dblclick', () => {
|
|
|
|
|
polyEditor.setTarget(thisPolygon);
|
|
|
|
@ -208,7 +211,10 @@ export default {
|
|
|
|
|
map.add(thisPolygon)
|
|
|
|
|
map.setFitView()
|
|
|
|
|
},
|
|
|
|
|
setCircle(e) {
|
|
|
|
|
setCircle(val) {
|
|
|
|
|
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});
|
|
|
|
|
thisCircle.on('dblclick', () => {
|
|
|
|
|
CircleEditor.setTarget(thisCircle);
|
|
|
|
@ -227,7 +233,7 @@ export default {
|
|
|
|
|
let list = polygons.map(e => e._opts.path)//多边形
|
|
|
|
|
let list1 = circles.map(e => {//圆形
|
|
|
|
|
return {
|
|
|
|
|
center: e._opts.center,
|
|
|
|
|
center: Array.isArray(e._opts.center) ? e._opts.center : [e._opts.center.lng, e._opts.center.lat],
|
|
|
|
|
radius: e._opts.radius
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
@ -235,16 +241,18 @@ export default {
|
|
|
|
|
let params1 = []
|
|
|
|
|
list.forEach((e, index) => {
|
|
|
|
|
e.forEach(val => {
|
|
|
|
|
let [lng, lat] = gcj02towgs84(val[0], val[1])
|
|
|
|
|
params.push({
|
|
|
|
|
longitude: val[0],
|
|
|
|
|
latitude: val[1],
|
|
|
|
|
longitude: lng,
|
|
|
|
|
latitude: lat,
|
|
|
|
|
index: index
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
list1.forEach((e, index) => {
|
|
|
|
|
let [lng, lat] = gcj02towgs84(e.center[0], e.center[1])
|
|
|
|
|
params1.push({
|
|
|
|
|
center: e.center,
|
|
|
|
|
center: [lng, lat],
|
|
|
|
|
radius: e.radius,
|
|
|
|
|
index: index
|
|
|
|
|
})
|
|
|
|
@ -278,7 +286,6 @@ export default {
|
|
|
|
|
})
|
|
|
|
|
polygonData.forEach(e => {
|
|
|
|
|
this.setPolygon(e)
|
|
|
|
|
console.log(e)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
circleAreaList.forEach(e => {
|
|
|
|
|