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