完成电子围栏绘制

master
wuxiaolong 2023-11-27 22:46:08 +08:00
parent 5a0144c400
commit af922213d7
3 changed files with 38 additions and 3 deletions

View File

@ -22,3 +22,11 @@ export function insertFenceObject(form) {
data: form,
})
}
//更新电子围栏数据
export function updateIdFenceData(form) {
return request({
url: '/fence/fence/update',
method: 'post',
data: form,
})
}

View File

@ -84,7 +84,9 @@
</el-table-column>
<el-table-column label="操作" width="110">
<template slot-scope="scope">
<el-button type="text" @click="">绘制围栏</el-button>
<i v-if="scope.row.fenceData==null">
<el-button type="text" @click="gotoFence(scope.row)"></el-button>
</i>
</template>
</el-table-column>
</el-table>
@ -184,6 +186,9 @@ export default {
alert(res.msg);
})
},
gotoFence(val){
this.$router.push({path:('/electronicFence/MapContainer'), query:{fenceId:val.fenceId}})
},
},
// - 访this",
created() {

View File

@ -3,6 +3,7 @@
<div class="dashboard-text">name: {{ name }}</div>
<div id="container"></div>
<el-button type="primary" @click="drawPolygon"></el-button>
<el-button type="primary" @click="yesInsertFence"></el-button>
</div>
</template>
@ -10,7 +11,9 @@
//jsjsjson,
//import from ', AMapLoader
import AMapLoader from '@amap/amap-jsapi-loader';
export default {
import {updateIdFenceData} from "@/api/system/fence";
export default {
//import使"
components: {},
props: {},
@ -21,6 +24,10 @@ import AMapLoader from '@amap/amap-jsapi-loader';
name: "map-view",
map: null,
mouseTool: null,
form:{
fenceId: 0,
fenceData: '',
}
};
},
// data",
@ -66,11 +73,26 @@ import AMapLoader from '@amap/amap-jsapi-loader';
},
drawPolygonComplate(event){
console.log(event.obj.getPath())
alert("覆盖对象绘制完成")
console.log(event.obj.getPath().lng)
var polyPoints = event.obj.getPath();
for (var i = 0; i < polyPoints.length; i++) {
this.form.fenceData += polyPoints[i].lng + "," + polyPoints[i].lat + ";";
}
console.log(this.form.fenceData)
updateIdFenceData(this.form).then(res=>{
alert(res.msg)
this.$router.push('/electronicFence/InsertFence')
})
},
yesInsertFence() {
alert(this.form.fenceId)
}
},
// - 访this",
created() {
this.form.fenceId=this.$route.query.fenceId;
},
// - 访DOM",
mounted() {