修改电子围栏

master
夜笙歌 2 years ago
parent 66485002d0
commit ecc536bc74

@ -1,7 +1,7 @@
<template> <template>
<div class="indexBg" style="background-repeat: no-repeat;background-size: 100% 100%"> <div class="indexBg" style="background-repeat: no-repeat;background-size: 100% 100%">
<el-container> <el-container>
<el-aside style="background-color: rgba(0,0,0,0.3);padding-bottom: 0;" width="350px"> <el-aside style="background-color: rgba(0,0,0,0.3);margin-bottom: 0;" width="350px">
<div id="carCharts" style="height:150px;width:150px;display: inline-block;margin-top: 20px"/> <div id="carCharts" style="height:150px;width:150px;display: inline-block;margin-top: 20px"/>
<div <div
style="width: 150px;display: inline-block;vertical-align: top;color:#fff;text-align: center;margin-top: 20px"> style="width: 150px;display: inline-block;vertical-align: top;color:#fff;text-align: center;margin-top: 20px">
@ -110,7 +110,7 @@
</div> </div>
</el-footer> </el-footer>
</el-container> </el-container>
<el-aside style="background-color: rgba(0,0,0,0.3);overflow: auto;height:80vh" width="350px"> <el-aside style="background-color: rgba(0,0,0,0.3);overflow: auto;margin-bottom: 0;height: calc(100vh - 84px)" width="350px">
<div v-for="i in 60" style="position:relative;color:#fff;height: 120px;"> <div v-for="i in 60" style="position:relative;color:#fff;height: 120px;">
<img src="../assets/icons/highTemperature.png" <img src="../assets/icons/highTemperature.png"
style="width: 40px;height: 40px;position: absolute;top: 10px;left: 0px"> style="width: 40px;height: 40px;position: absolute;top: 10px;left: 0px">
@ -638,6 +638,13 @@ export default {
}, },
], ],
}) })
},
getErrInfo(){
if( typeof(WebSocket) != "function" ) {
alert("您的浏览器不支持Websocket通信协议")
return
}
} }
} }
} }

@ -8,10 +8,11 @@
</el-form-item> </el-form-item>
<el-form-item label="选择车辆" prop="internationalization8"> <el-form-item label="选择车辆" prop="internationalization8">
<el-cascader <el-cascader
v-model="form.carId"
:options="options" :options="options"
:props="{ multiple: true, checkStrictly: true,value:'id',label:'title',children:'baseCarList', }" :props="{ multiple: true, value:'id',label:'title',children:'baseCarList', }"
clearable clearable
@change="cascaderChange"></el-cascader> @change="cascaderChange" />
</el-form-item> </el-form-item>
<el-form-item label="第一轴高气压阀值" prop="z1PressureHigh;"> <el-form-item label="第一轴高气压阀值" prop="z1PressureHigh;">
<el-input-number v-model="form.z1PressureHigh" :min="0" :step="5"/> <el-input-number v-model="form.z1PressureHigh" :min="0" :step="5"/>
@ -71,6 +72,7 @@ const form = ref({
zPressureHigh: 0, zPressureHigh: 0,
zPressureLow: 0, zPressureLow: 0,
temperatureHigh: 0, temperatureHigh: 0,
carId:null,
time: parseTime(new Date()), time: parseTime(new Date()),
}) })
const setDisabled = (arr) => { const setDisabled = (arr) => {
@ -84,10 +86,11 @@ const setDisabled = (arr) => {
listBaseCar().then(e => { listBaseCar().then(e => {
let res = JSON.stringify(e.rows) let res = JSON.stringify(e.rows)
let newObj = JSON.parse(res.replace(/"carLicense":/g, '"title":')) let newObj = JSON.parse(res.replace(/"carLicense":/g, '"title":'))
setDisabled(newObj) // setDisabled(newObj)
options.value = newObj options.value = newObj
}) })
const cascaderChange = (e) => { const cascaderChange = (e) => {
console.log(e)
let lastIds = ids.value || [] let lastIds = ids.value || []
let nowIds = e.map(val => val.at(-1)) let nowIds = e.map(val => val.at(-1))
let nowClick = nowIds.filter(val => !(lastIds.includes(val)))?.[0] let nowClick = nowIds.filter(val => !(lastIds.includes(val)))?.[0]
@ -133,4 +136,16 @@ const handleQuery = (e) => {
proxy.$modal.msgSuccess("操作成功"); proxy.$modal.msgSuccess("操作成功");
}) })
} }
const resetQuery = () => {
form.value = {
z1PressureHigh: 0,
z1PressureLow: 0,
zPressureHigh: 0,
zPressureLow: 0,
temperatureHigh: 0,
carId:null,
time: parseTime(new Date()),
}
ids.value=[]
}
</script> </script>

@ -24,6 +24,7 @@
<el-form-item label=" "> <el-form-item label=" ">
<el-button icon="Search" type="primary" @click="handleQuery">{{ t('option.search') }}</el-button> <el-button icon="Search" type="primary" @click="handleQuery">{{ t('option.search') }}</el-button>
<el-button icon="Refresh" @click="resetQuery">{{ t('option.reset') }}</el-button> <el-button icon="Refresh" @click="resetQuery">{{ t('option.reset') }}</el-button>
<el-button icon="Refresh" @click="getLine"></el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -44,10 +45,9 @@ const queryParams = ref({})
let map = null let map = null
let polyline = null
let passedPolyline = null
let mouseTool = null
let path = [[116.390969, 39.911592], [116.391496, 39.909008], [116.389264, 39.909765], [116.38802, 39.911016]] let path = [[116.390969, 39.911592], [116.391496, 39.909008], [116.389264, 39.909765], [116.38802, 39.911016]]
let path2 = [[116.400969, 39.921592], [116.401496, 39.919008], [116.399264, 39.919765], [116.39802, 39.921016]]
const areaPath = ref([path,path2])
let marketPath = [116.390669, 39.911147] let marketPath = [116.390669, 39.911147]
AMapLoader.load({ AMapLoader.load({
key: "ba8fb8d8bae1b280b93406d5959d492f", // WebKey load key: "ba8fb8d8bae1b280b93406d5959d492f", // WebKey load
@ -75,7 +75,7 @@ AMapLoader.load({
marker.setLabel({ marker.setLabel({
direction: 'top', direction: 'top',
offset: new AMap.Pixel(0, -10), // offset: new AMap.Pixel(0, -10), //
content: "" + AMap.GeometryUtil.isPointInRing(marketPath,path), content: "" + AMap.GeometryUtil.isPointInRing(marketPath,path,path2),
}); });
marker.setMap(map); marker.setMap(map);
@ -91,32 +91,47 @@ AMapLoader.load({
// //
map.addControl(new AMap.MapType()); map.addControl(new AMap.MapType());
areaPath.value.forEach( (e,index)=> {
let polygon = new AMap.Polygon({path: path}); let polygon = new AMap.Polygon({path: e});
map.add([polygon]); map.add([polygon]);
let polyEditor = new AMap.PolygonEditor(map); let polyEditor = new AMap.PolygonEditor(map);
polyEditor.addAdsorbPolygons([polygon]); polyEditor.addAdsorbPolygons([polygon]);
polyEditor.on('add', function (data) { polyEditor.on('add', function (data) {
console.log(data); console.log(data);
let polygon = data.target; let polygon = data.target;
polyEditor.addAdsorbPolygons(polygon); polyEditor.addAdsorbPolygons(polygon);
}) })
polyEditor.on('addnode', function (data) { polyEditor.on('addnode', function (data) {
// //
console.log(polyEditor.getTarget()._opts.path) areaPath.value[index] = polyEditor.getTarget()._opts.path
}) })
polyEditor.on('adjust', function (data) { polyEditor.on('adjust', function (data) {
// //
console.log(polyEditor.getTarget()._opts.path) areaPath.value[index] = polyEditor.getTarget()._opts.path
})
polyEditor.setTarget(polygon);
polyEditor.open();
}) })
polyEditor.setTarget(polygon);
polyEditor.open();
// map.setFitView();
}).catch(e => { }).catch(e => {
console.log(e); console.log(e);
}) })
const getLine = () => {
let list = areaPath.value
let params = []
list.forEach((e,index)=>{
e.forEach(val => {
params.push({
longitude:val[0],
latitude:val[1],
index:index
})
})
})
console.log(params)
}
</script> </script>
<style> <style>
#container4 { #container4 {
@ -125,4 +140,4 @@ AMapLoader.load({
width: 100%; width: 100%;
height: calc(100vh - 190px); height: calc(100vh - 190px);
} }
</style> </style>

Loading…
Cancel
Save