新增添加电子围栏

master
wuxiaolong 2023-11-27 15:09:33 +08:00
parent 65419e532d
commit 7e6fe5583e
3 changed files with 128 additions and 12 deletions

View File

@ -1,9 +1,24 @@
import request from '@/utils/request'
// 查询参数列表
// 查询围栏标签列表
export function list() {
return request({
url: '/fence/fenceTag/list',
method: 'get'
})
}
// 查询所属围栏列表
export function selectIdFenceList(fenceTagId) {
return request({
url: '/fence/fenceTag/selectIdFence/' + fenceTagId,
method: 'get'
})
}
//添加电子围栏数据
export function insertFenceObject(form) {
return request({
url: '/fence/fence/insert',
method: 'post',
data: form,
})
}

View File

@ -6,46 +6,122 @@
<el-table-column label="围栏标签主键id" width="180">
<template slot-scope="scope">
<i class="el-icon-time"></i>
<span style="margin-left: 10px">{{ scope.row.fenceTagId }}</span>
</template>
</el-table-column>
<el-table-column label="围栏标签名称" width="180">
<template slot-scope="scope">
<i class="el-icon-time"></i>
<span style="margin-left: 10px">{{ scope.row.fenceTagName}}</span>
</template>
</el-table-column>
<el-table-column label="创建人" width="180">
<template slot-scope="scope">
<i class="el-icon-time"></i>
<span style="margin-left: 10px">{{ scope.row.createdBy }}</span>
</template>
</el-table-column>
<el-table-column label="创建时间" width="180">
<template slot-scope="scope">
<i class="el-icon-time"></i>
<span style="margin-left: 10px">{{ scope.row.createdTime}}</span>
</template>
</el-table-column>
<el-table-column label="更新人" width="180">
<template slot-scope="scope">
<i class="el-icon-time"></i>
<span style="margin-left: 10px">{{scope.row.updatedBy}}</span>
</template>
</el-table-column>
<el-table-column label="更新时间" width="180">
<template slot-scope="scope">
<i class="el-icon-time"></i>
<span style="margin-left: 10px">{{scope.row.updatedTime}}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="420">
<template slot-scope="scope">
<el-button type="primary" @click="selectIdFence(scope.row)"></el-button>
<!-- 查看这个标签下所属的围栏-->
<el-dialog title="电子围栏" :visible.sync="dialogTableVisible" style="text-align: center">
<el-table :data="gridData" style="width: 1000px">
<el-table-column label="围栏主键id" width="110">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.fenceId }}</span>
</template>
</el-table-column>
<el-table-column label="围栏名称" width="110">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.fenceName }}</span>
</template>
</el-table-column>
<el-table-column label="围栏数据" width="210">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.fenceData }}</span>
</template>
</el-table-column>
<el-table-column label="围栏状态" width="180">
<template slot-scope="scope">
<i v-if="scope.row.status==1">
已开启
</i>
<i v-if="scope.row.status==0">
未开启
</i>
</template>
</el-table-column>
<el-table-column label="告警类型" width="180">
<template slot-scope="scope">
<i v-if="scope.row.alarmType==1">
驶出警告
</i>
<i v-if="scope.row.alarmType==0">
驶入警告
</i>
</template>
</el-table-column>
<el-table-column label="操作" width="110">
<template slot-scope="scope">
<el-button type="text" @click="">绘制围栏</el-button>
</template>
</el-table-column>
</el-table>
</el-dialog>
<!-- <el-input v-model="form.fenceData" autocomplete="off"></el-input>-->
<el-button type="primary" @click="openInsert(scope.row)"></el-button>
<!-- 添加这个标签下所属的围栏-->
<el-dialog title="添加围栏" :visible.sync="dialogFormVisible">
<el-form :model="form">
<el-form-item label="围栏名称" :label-width="formLabelWidth">
<el-input v-model="form.fenceName" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="围栏状态" :label-width="formLabelWidth">
<el-select v-model="form.status" placeholder="请选择围栏状态">
<el-option label="未开启" value="0"></el-option>
<el-option label="已开启" value="1"></el-option>
</el-select>
</el-form-item>
<el-form-item label="报警类型" :label-width="formLabelWidth">
<el-select v-model="form.alarmType" placeholder="请选择报警类型">
<el-option label="驶入警告" value="0"></el-option>
<el-option label="驶出警告" value="1"></el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false"> </el-button>
<el-button type="primary" @click="insertFence"> </el-button>
</div>
</el-dialog>
</template>
</el-table-column>
</el-table>
</div>
@ -54,7 +130,7 @@
<script>
//jsjsjson,
//import from ',
import { list } from "@/api/system/fence";
import { list,selectIdFenceList,insertFenceObject } from "@/api/system/fence";
export default {
//import使"
@ -64,6 +140,9 @@ export default {
//"
return {
gridData: [],
dialogTableVisible: false,
dialogFormVisible: false,
form:{
fenceName: null,
fenceData: null,
@ -72,6 +151,7 @@ export default {
fenceTagId: null,
},
tableData:[],
formLabelWidth: '320px',
};
},
// data",
@ -80,16 +160,34 @@ export default {
watch: {},
//",
methods: {
FenceList() {
FenceTagList() {
list().then(res => {
console.log(res.data)
this.tableData=res.data
})
},
selectIdFence(val) {
this.dialogTableVisible = true
selectIdFenceList(val.fenceTagId).then(res=>{
this.gridData=res.data
})
},
openInsert(val) {
this.dialogFormVisible=true
this.form.fenceTagId=val.fenceTagId
console.log(this.form)
},
insertFence() {
this.dialogFormVisible = false
console.log(this.form)
insertFenceObject(this.form).then(res=>{
alert(res.msg);
})
},
},
// - 访this",
created() {
this.FenceList();
this.FenceTagList();
},
// - 访DOM",
mounted() {
@ -111,5 +209,8 @@ export default {
};
</script>
<style scoped>
#container {
width: 100%;
height: 850px;
}
</style>

View File

@ -31,7 +31,7 @@ import AMapLoader from '@amap/amap-jsapi-loader';
methods: {
initAMap() {
AMapLoader.load({
key: "0b5f26b194361cbc9571101bc2856962", // WebKey load
key: "164dc573bc4daf5bf1f1ebcebdae0717", // WebKey load
version: "2.0", // JSAPI 1.4.15
plugins: ['AMap.MouseTool'], // 使'AMap.Scale'
})