|
@@ -12,10 +12,14 @@
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<bd-map :loaded="loaded" map-id="room-map"/>
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
- <el-button type="primary" @click="saveEdit">确 定</el-button>
|
|
|
- <el-button @click="cancel">取 消</el-button>
|
|
|
- </div>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button v-if="!form.id" type="primary" :disabled="drawState" @click="startDraw">
|
|
|
+ {{ drawState ? "双击退出绘制" : "绘制围栏" }}
|
|
|
+ </el-button>
|
|
|
+ <el-button type="primary" @click="saveEdit">确 定</el-button>
|
|
|
+ <el-button @click="cancel">取 消</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</template>
|
|
@@ -41,12 +45,11 @@ export default {
|
|
|
mapIns: null,
|
|
|
fencePolyLayer: null,
|
|
|
fence: {},
|
|
|
- destroyed: false,
|
|
|
+ destroyed: true,
|
|
|
playLine: null,
|
|
|
editingDrawGeom: null,
|
|
|
drawState: false,
|
|
|
drawtool: null,
|
|
|
- dialogVisible: false,
|
|
|
form: {
|
|
|
name: '',
|
|
|
},
|
|
@@ -78,6 +81,7 @@ export default {
|
|
|
this.destroyed = true;
|
|
|
},
|
|
|
loaded(map) {
|
|
|
+ debugger
|
|
|
this.markLayer = new BDLayers.Lib.Layer.CBVectorLayer('markerLayer', true);
|
|
|
map.addCustomLayers(this.markLayer, 99);
|
|
|
this.mapIns = map;
|
|
@@ -99,7 +103,6 @@ export default {
|
|
|
// 点击地图 图形取消编辑状态
|
|
|
mapIns.map.once('click', () => {
|
|
|
this.editingDrawGeom.endEdit();
|
|
|
- this.dialogVisible = true;
|
|
|
});
|
|
|
} else {
|
|
|
mapIns.map.once('click', () => {
|
|
@@ -111,11 +114,13 @@ export default {
|
|
|
this.editingDrawGeom = geom.target.geometry ? geom.target.geometry : geom.target.geom
|
|
|
? geom.target.geom
|
|
|
: geom.target;
|
|
|
- this.dialogVisible = true;
|
|
|
this.drawState = false;
|
|
|
});
|
|
|
},
|
|
|
addFence() {
|
|
|
+ if (!this.fence) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
const {
|
|
|
id,
|
|
|
defenceName,
|
|
@@ -140,6 +145,7 @@ export default {
|
|
|
name: defenceName,
|
|
|
polygon,
|
|
|
}
|
|
|
+ this.editFence(this.fence)
|
|
|
},
|
|
|
/**
|
|
|
*
|
|
@@ -174,7 +180,6 @@ export default {
|
|
|
},
|
|
|
cancelEdit() {
|
|
|
this.drawtool.clear();
|
|
|
- this.dialogVisible = false;
|
|
|
},
|
|
|
cancel() {
|
|
|
this.centerDialogVisible = false;
|
|
@@ -200,15 +205,15 @@ export default {
|
|
|
type: 'success',
|
|
|
message: '围栏保存成功',
|
|
|
});
|
|
|
+ this.$emit('onSuccess');
|
|
|
} else {
|
|
|
await updateFenceInfo(this.formatParams(this.form))
|
|
|
this.$message({
|
|
|
type: 'success',
|
|
|
message: '围栏编辑成功',
|
|
|
});
|
|
|
- this.polyLayer.removeGeometry(this.form.polygonId);
|
|
|
+ this.$emit('onSuccess');
|
|
|
}
|
|
|
- this.dialogVisible = false;
|
|
|
this.drawtool.clear();
|
|
|
this.drawPoly({
|
|
|
coordinates: coordinates,
|
|
@@ -251,13 +256,19 @@ export default {
|
|
|
this.editState = true;
|
|
|
this.editingDrawGeom.startEdit();
|
|
|
// 点击地图 图形取消编辑状态
|
|
|
- window.map.map.once('click', () => {
|
|
|
+ this.mapIns.map.once('click', () => {
|
|
|
this.editingDrawGeom.endEdit();
|
|
|
this.dialogVisible = true;
|
|
|
});
|
|
|
},
|
|
|
show(data) {
|
|
|
this.fence = data;
|
|
|
+ if (data) {
|
|
|
+ this.form = {
|
|
|
+ id: data.id,
|
|
|
+ name: data.defenceName
|
|
|
+ };
|
|
|
+ }
|
|
|
this.destroyed = false;
|
|
|
this.centerDialogVisible = true;
|
|
|
},
|
|
@@ -267,8 +278,9 @@ export default {
|
|
|
<style scoped lang="scss">
|
|
|
.trail-dialog-content {
|
|
|
display: flex;
|
|
|
- justify-content: center;
|
|
|
- align-items: center;
|
|
|
+ justify-content: flex-start;
|
|
|
+ align-items: flex-start;
|
|
|
+ flex-direction: column;
|
|
|
|
|
|
.map-ctrl {
|
|
|
display: flex;
|