Commit 78f8633c by 张杰

修复新增围栏(多边形围栏和行政区域报错的问题)

1 parent 01990e91
<template> <template>
<div> <div>
<!-- <v-breadcrumb> <!-- <v-breadcrumb>
<slot name="breadcrumb"></slot> <slot name="breadcrumb"></slot>
</v-breadcrumb> --> </v-breadcrumb> -->
<div class="main-wrap full-width"> <div class="main-wrap full-width">
<slot name="main"></slot> <slot name="main"></slot>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
// import vBreadcrumb from 'components/Breadcrumb.vue' // import vBreadcrumb from 'components/Breadcrumb.vue'
export default{ export default {
components: { components: {
// vBreadcrumb // vBreadcrumb
} },
} };
</script> </script>
<style lang="scss"> <style lang="scss">
h1,h2,h3,h4,h5{ h1,
margin: 0px; h2,
} h3,
.main-wrap.full-width{ h4,
position: fixed; h5 {
width: calc(100% - 200px); margin: 0px;
height: calc(100% - 60px); }
top: 60px; .main-wrap.full-width {
left: 200px; position: fixed;
background: #fff; width: calc(100% - 200px);
padding: 0; height: calc(100% - 60px);
} top: 60px;
.ibox{ left: 200px;
background-color: #fff; background: #fff;
border-top: 2px solid #e7eaec; padding: 0;
padding: 10px; }
margin-bottom: 20px; .ibox {
.ibox-title{ background-color: #fff;
padding-bottom: 10px; border-top: 2px solid #e7eaec;
padding: 10px;
} margin-bottom: 20px;
.ibox-content{ .ibox-title {
padding: 20px 20px 0px; padding-bottom: 10px;
margin: 0px -10px; }
border-top: 1px solid #e7eaec; .ibox-content {
} padding: 20px 20px 0px;
.count{ margin: 0px -10px;
font-size: 20px; border-top: 1px solid #e7eaec;
} }
} .count {
font-size: 20px;
}
}
.full_wrap_layout {
.full-width {
width: 100%;
height: 100%;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
}
</style> </style>
\ No newline at end of file \ No newline at end of file
<template> <template>
<v-full-layout> <v-full-layout class="full_wrap_layout">
<template slot="breadcrumb"> <template slot="breadcrumb">
<el-breadcrumb-item>电子围栏</el-breadcrumb-item> <el-breadcrumb-item>电子围栏</el-breadcrumb-item>
</template> </template>
......
...@@ -22,7 +22,7 @@ const fence = { ...@@ -22,7 +22,7 @@ const fence = {
}); });
EventBus.$on('uiMap.fence.updateFenceRadius', (data) => { EventBus.$on('uiMap.fence.updateFenceRadius', (data) => {
console.log('监听围栏更新',data) console.log('监听围栏更新', data)
this.updateFenceInfo(data) this.updateFenceInfo(data)
}); });
//this.circle.setRadius(data * 1); //this.circle.setRadius(data * 1);
...@@ -66,12 +66,11 @@ const fence = { ...@@ -66,12 +66,11 @@ const fence = {
// 行政区域 // 行政区域
drawDistrict(data) { drawDistrict(data) {
const MAP = mapService.map;
this.destroy();
if (!data || data.length <= 0) { if (!data || data.length <= 0) {
return false; return false;
} }
const MAP = mapService.map;
this.destroy();
var opts = { var opts = {
subdistrict: 0, //返回下一级行政区 subdistrict: 0, //返回下一级行政区
extensions: 'all', extensions: 'all',
...@@ -335,10 +334,10 @@ const fence = { ...@@ -335,10 +334,10 @@ const fence = {
let mapInterval = setInterval(function () { let mapInterval = setInterval(function () {
if (MAP) { if (MAP) {
clearInterval(mapInterval); clearInterval(mapInterval);
MAP.clearMap(); if (_this.fenceCircle) {
MAP.remove(_this.fenceCircle)
}
_this.fenceType = data.fenceType; _this.fenceType = data.fenceType;
_this.polyEditor && _this.polyEditor.close(); _this.polyEditor && _this.polyEditor.close();
_this.mouseTool && _this.mouseTool.close(); _this.mouseTool && _this.mouseTool.close();
...@@ -358,27 +357,6 @@ const fence = { ...@@ -358,27 +357,6 @@ const fence = {
_this.createFenceCircle(data); _this.createFenceCircle(data);
return false; return false;
} }
// 更新行政区域围栏
if (data.fenceType === "area") {
_this.areaCode = data.areaCode;
_this.drawDistrict(data);
return false
}
// 更新多边形围栏
if (data.fenceType === "polygon") {
if (data) {
if (Array.isArray(data)) {
this.polygonPath = data;
this.isEditMode = true;
} else if (('isEdit' in data) && !data.isEdit) {
this.polygonPath = data.path;
this.isEditMode = false;
}
}
_this.drawPolygon();
}
mapService.setFitView() mapService.setFitView()
MAP.setZoom(14); MAP.setZoom(14);
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!