修复轨迹的储存与查询展示

This commit is contained in:
648540858
2022-07-04 01:08:26 +08:00
parent 5d673fb033
commit 10cb58391a
16 changed files with 510 additions and 408 deletions

View File

@@ -11,6 +11,7 @@ import VectorSource from 'ol/source/Vector';
import Tile from 'ol/layer/Tile';
import VectorLayer from 'ol/layer/Vector';
import Style from 'ol/style/Style';
import Stroke from 'ol/style/Stroke';
import Icon from 'ol/style/Icon';
import View from 'ol/View';
import Feature from 'ol/Feature';
@@ -230,7 +231,12 @@ export default {
}
let line = new LineString(points)
let lineFeature = new Feature(line);
lineFeature.setStyle(new Style({
stroke: new Stroke({
width: 4 ,
color: "#0c6d6a",
})
}))
let source = new VectorSource();
source.addFeature(lineFeature);
let vectorLayer = new VectorLayer({

View File

@@ -10,8 +10,8 @@
@close="close()"
>
<div v-loading="isLoging">
<el-date-picker v-model="searchFrom" type="datetime" placeholder="选择开始日期时间" default-time="00:00:00" size="mini" style="width: 11rem;" align="right" :picker-options="pickerOptions"></el-date-picker>
<el-date-picker v-model="searchTo" type="datetime" placeholder="选择结束日期时间" default-time="00:00:00" size="mini" style="width: 11rem;" align="right" :picker-options="pickerOptions"></el-date-picker>
<el-date-picker v-model="searchFrom" type="datetime" placeholder="选择开始日期时间" default-time="00:00:00" value-format="yyyy-MM-dd HH:mm:ss" size="mini" style="width: 11rem;" align="right" :picker-options="pickerOptions"></el-date-picker>
<el-date-picker v-model="searchTo" type="datetime" placeholder="选择结束日期时间" default-time="00:00:00" value-format="yyyy-MM-dd HH:mm:ss" size="mini" style="width: 11rem;" align="right" :picker-options="pickerOptions"></el-date-picker>
<el-button icon="el-icon-search" size="mini" type="primary" @click="onSubmit">查询</el-button>
</div>
@@ -72,7 +72,11 @@ export default {
onSubmit: function () {
console.log("onSubmit");
this.isLoging = true;
this.$axios.get(`/api/position/history/${this.channel.deviceId}/${this.channel.channelId}`, {
let url = `/api/position/history/${this.channel.deviceId}?start=${this.searchFrom}&end=${this.searchTo}`;
if (this.channel.channelId) {
url+="&channelId=${this.channel.channelId}"
}
this.$axios.get(url, {
}).then((res)=> {
this.isLoging = false;
if (typeof this.callback == "function") {

View File

@@ -186,6 +186,14 @@ export default {
this.deviceService.getAllSubChannel(false, data.deviceId, data.channelId, this.channelsHandler)
}
}
},
{
label: "查询轨迹",
icon: "el-icon-map-location",
disabled: false,
onClick: () => {
this.getTrace(data)
}
}
],
event, // 鼠标事件信息
@@ -320,8 +328,8 @@ export default {
} else {
let positions = [];
for (let i = 0; i < channelPositions.length; i++) {
if (channelPositions[i].cnLng * channelPositions[i].cnLat > 0) {
positions.push([channelPositions[i].cnLng, channelPositions[i].cnLat])
if (channelPositions[i][this.longitudeStr] * channelPositions[i][this.latitudeStr] > 0) {
positions.push([channelPositions[i][this.longitudeStr], channelPositions[i][this.latitudeStr]])
}
}