Commit 03291bc1 by jack

1.3.0

1 parent c44c4bac
This diff could not be displayed because it is too large.
...@@ -101,8 +101,9 @@ export default { ...@@ -101,8 +101,9 @@ export default {
addPOI(request = {}) { addPOI(request = {}) {
return api.post('vepoi/add', request) return api.post('vepoi/add', request)
}, },
getPOI(request = {}) { getPOI(params = {}) {
return api.get('vepoi/getVehiclePoi', request) //return api.get('vepoi/getVehiclePoi', request)
return request(params, '/vepoi/getVehiclePoi', 'get')
}, },
deletePOI(request = {}) { deletePOI(request = {}) {
return api.get('vepoi/del/'+request.id) return api.get('vepoi/del/'+request.id)
......
...@@ -52,6 +52,13 @@ export default { ...@@ -52,6 +52,13 @@ export default {
getOrgTree(params) { getOrgTree(params) {
return request(params, '/usercenter/organization/orgtree') return request(params, '/usercenter/organization/orgtree')
}, },
// 根据sn 获取围栏信息接口
getFenceInfo(params) {
return request(params, '/trialdrive/fence/getBySn')
},
// 旧虎哥 // 旧虎哥
/*车辆监控*/ /*车辆监控*/
// getCriteriaTreeList (request = {}) { // getCriteriaTreeList (request = {}) {
......
.icon {display: inline-block;background-image: url(~sprite.png);background-size: 119px 97px; vertical-align: middle;} .icon {display: inline-block;background-image: url(~sprite.png);background-size: 119px 97px; vertical-align: middle;}
.icon-battery_empty { width: 42px; height: 20px; background-position: 0px 0px; } .icon-battery_empty { width: 42px; height: 20px; background-position: 0px 0px; }
.icon-battery_enough { width: 42px; height: 20px; background-position: 0px -20px; } .icon-battery_enough { width: 42px; height: 20px; background-position: 0px -20px; }
.icon-fullsize.active { width: 18px; height: 18px; background-position: -18px -79px; } .icon-fullsize.active { width: 18px; height: 18px; background-position: 0px -79px; }
.icon-fullsize:active { width: 18px; height: 18px; background-position: -18px -79px; } .icon-fullsize:active { width: 18px; height: 18px; background-position: 0px -79px; }
.icon-fullsize:hover { background-position: -18px -79px; } .icon-fullsize:hover { background-position: 0px -79px; }
.icon-fullsize { width: 18px; height: 18px; background-position: 0px -79px; } .icon-fullsize { width: 18px; height: 18px; background-position: -18px -79px; }
.icon-icon_zoom_out.active { width: 18px; height: 18px; background-position: -72px -79px; } .icon-icon_zoom_out.active { width: 18px; height: 18px; background-position: -36px -79px; }
.icon-icon_zoom_out:active { width: 18px; height: 18px; background-position: -72px -79px; } .icon-icon_zoom_out:active { width: 18px; height: 18px; background-position: -36px -79px; }
.icon-icon_zoom_out:hover { background-position: -72px -79px; } .icon-icon_zoom_out:hover { background-position: -36px -79px; }
.icon-icon_zoom_out { width: 18px; height: 18px; background-position: -54px -79px; } .icon-icon_zoom_out { width: 18px; height: 18px; background-position: -54px -79px; }
.icon-info_copy.active { width: 16px; height: 16px; background-position: -101px -36px; } .icon-info_copy.active { width: 16px; height: 16px; background-position: -101px -36px; }
.icon-info_copy:active { width: 16px; height: 16px; background-position: -101px -36px; } .icon-info_copy:active { width: 16px; height: 16px; background-position: -101px -36px; }
.icon-info_copy:hover { background-position: -101px -36px; } .icon-info_copy:hover { background-position: -101px -36px; }
.icon-info_copy { width: 16px; height: 16px; background-position: -101px -52px; } .icon-info_copy { width: 16px; height: 16px; background-position: -101px -52px; }
.icon-info_device_alarm { width: 20px; height: 20px; background-position: -62px -20px; } .icon-info_device_alarm { width: 20px; height: 20px; background-position: -42px 0px; }
.icon-info_device_status { width: 20px; height: 20px; background-position: -62px 0px; } .icon-info_device_status { width: 20px; height: 20px; background-position: -42px -20px; }
.icon-info_device { width: 20px; height: 20px; background-position: -40px -40px; } .icon-info_device { width: 20px; height: 20px; background-position: 0px -40px; }
.icon-info_location { width: 20px; height: 20px; background-position: -20px -40px; } .icon-info_location { width: 20px; height: 20px; background-position: -20px -40px; }
.icon-info_stop { width: 20px; height: 20px; background-position: 0px -40px; } .icon-info_stop { width: 20px; height: 20px; background-position: -40px -40px; }
.icon-info_time { width: 20px; height: 20px; background-position: -42px -20px; } .icon-info_time { width: 20px; height: 20px; background-position: -62px 0px; }
.icon-info_type { width: 20px; height: 20px; background-position: -42px 0px; } .icon-info_type { width: 20px; height: 20px; background-position: -62px -20px; }
.icon-locate.active { width: 19px; height: 19px; background-position: 0px -60px; } .icon-locate.active { width: 19px; height: 19px; background-position: -62px -40px; }
.icon-locate:active { width: 19px; height: 19px; background-position: 0px -60px; } .icon-locate:active { width: 19px; height: 19px; background-position: -62px -40px; }
.icon-locate:hover { background-position: 0px -60px; } .icon-locate:hover { background-position: -62px -40px; }
.icon-locate { width: 19px; height: 19px; background-position: -19px -60px; } .icon-locate { width: 19px; height: 19px; background-position: 0px -60px; }
.icon-minisize.active { width: 18px; height: 19px; background-position: -82px -19px; } .icon-minisize.active { width: 18px; height: 19px; background-position: -82px -19px; }
.icon-minisize:active { width: 18px; height: 19px; background-position: -82px -19px; } .icon-minisize:active { width: 18px; height: 19px; background-position: -82px -19px; }
.icon-minisize:hover { background-position: -82px -19px; } .icon-minisize:hover { background-position: -82px -19px; }
.icon-minisize { width: 18px; height: 18px; background-position: -36px -79px; } .icon-minisize { width: 18px; height: 18px; background-position: -72px -79px; }
.icon-refresh.active { width: 18px; height: 19px; background-position: -82px -38px; } .icon-refresh.active { width: 18px; height: 19px; background-position: -82px -38px; }
.icon-refresh:active { width: 18px; height: 19px; background-position: -82px -38px; } .icon-refresh:active { width: 18px; height: 19px; background-position: -82px -38px; }
.icon-refresh:hover { background-position: -82px -38px; } .icon-refresh:hover { background-position: -82px -38px; }
.icon-refresh { width: 18px; height: 19px; background-position: -82px -57px; } .icon-refresh { width: 18px; height: 19px; background-position: -82px -57px; }
.icon-ruler.active { width: 19px; height: 19px; background-position: -57px -60px; } .icon-ruler.active { width: 19px; height: 19px; background-position: -19px -60px; }
.icon-ruler:active { width: 19px; height: 19px; background-position: -57px -60px; } .icon-ruler:active { width: 19px; height: 19px; background-position: -19px -60px; }
.icon-ruler:hover { background-position: -57px -60px; } .icon-ruler:hover { background-position: -19px -60px; }
.icon-ruler { width: 19px; height: 19px; background-position: -82px 0px; } .icon-ruler { width: 19px; height: 19px; background-position: -38px -60px; }
.icon-satellite.active { width: 18px; height: 18px; background-position: -101px 0px; } .icon-satellite.active { width: 18px; height: 18px; background-position: -101px 0px; }
.icon-satellite:active { width: 18px; height: 18px; background-position: -101px 0px; } .icon-satellite:active { width: 18px; height: 18px; background-position: -101px 0px; }
.icon-satellite:hover { background-position: -101px 0px; } .icon-satellite:hover { background-position: -101px 0px; }
.icon-satellite { width: 18px; height: 18px; background-position: -101px -18px; } .icon-satellite { width: 18px; height: 18px; background-position: -101px -18px; }
.icon-zoom_in.active { width: 19px; height: 19px; background-position: -38px -60px; }
.icon-zoom_in:active { width: 19px; height: 19px; background-position: -38px -60px; }
.icon-zoom_in:hover { background-position: -38px -60px; }
.icon-zoom_in { width: 19px; height: 19px; background-position: -62px -40px; }
\ No newline at end of file \ No newline at end of file
.icon-zoom_in.active { width: 19px; height: 19px; background-position: -57px -60px; }
.icon-zoom_in:active { width: 19px; height: 19px; background-position: -57px -60px; }
.icon-zoom_in:hover { background-position: -57px -60px; }
.icon-zoom_in { width: 19px; height: 19px; background-position: -82px 0px; }
\ No newline at end of file \ No newline at end of file

8.81 KB | W: | H:

8.86 KB | W: | H:

src/assets/spritesmith-generated/sprite.png
src/assets/spritesmith-generated/sprite.png
src/assets/spritesmith-generated/sprite.png
src/assets/spritesmith-generated/sprite.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<el-breadcrumb-item>车辆监控</el-breadcrumb-item> <el-breadcrumb-item>车辆监控</el-breadcrumb-item>
</template> </template>
<template slot="main"> <template slot="main">
<div class="map-wrap" > <div class="map-wrap">
<div id="map" class="map-container" v-loading="mapLoading"></div> <div id="map" class="map-container" v-loading="mapLoading"></div>
<map-controll></map-controll> <map-controll></map-controll>
<div class="controll-wrap"> <div class="controll-wrap">
...@@ -13,22 +13,11 @@ ...@@ -13,22 +13,11 @@
<p class="info">{{name}}/{{standno}}/{{sn}}</p> <p class="info">{{name}}/{{standno}}/{{sn}}</p>
<el-form ref="form" :model="form" :rules="rules" :inline="false" size="mini" class="form"> <el-form ref="form" :model="form" :rules="rules" :inline="false" size="mini" class="form">
<el-form-item label="查询范围" prop="daterange"> <el-form-item label="查询范围" prop="daterange">
<el-date-picker <el-date-picker class="pull-left" style="width: 100%;" v-model="form.dateRange" type="datetimerange" range-separator="至" start-placeholder="开始日期" format="yyyy-MM-dd HH:mm" :clearable="false" :editable="false" :picker-options="{
class="pull-left"
style="width: 100%;"
v-model="form.dateRange"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
format="yyyy-MM-dd HH:mm"
:clearable="false"
:editable="false"
:picker-options="{
disabledDate(time){ disabledDate(time){
return time.getTime() > (new Date()).getTime() return time.getTime() > (new Date()).getTime()
} }
}" }" end-placeholder="结束日期">
end-placeholder="结束日期">
</el-date-picker> </el-date-picker>
<div class="pull-left"> <div class="pull-left">
...@@ -39,43 +28,23 @@ ...@@ -39,43 +28,23 @@
</el-form-item> </el-form-item>
<el-form-item label="播放速度"> <el-form-item label="播放速度">
<el-select v-model="form.replaySpeed" placeholder="请选择" style="width: 80px"> <el-select v-model="form.replaySpeed" placeholder="请选择" style="width: 80px">
<el-option <el-option v-for="item in form.speedOpts" :key="item.value" :label="item.label" :value="item.value">
v-for="item in form.speedOpts"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="定位类型"> <el-form-item label="定位类型">
<el-select v-model="form.replayType" placeholder="请选择" style="width: 80px"> <el-select v-model="form.replayType" placeholder="请选择" style="width: 80px">
<el-option <el-option v-for="item in form.replayTypeOpts" :key="item.value" :label="item.label" :value="item.value">
v-for="item in form.replayTypeOpts"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-form> </el-form>
<p> <p>
<el-button size="mini" <el-button size="mini" type="primary" v-show="!replayIng" @click="replayStart" :loading="replayIniting">播放 <i class="fa fa-play"></i>
type="primary"
v-show="!replayIng"
@click="replayStart"
:loading="replayIniting">播放 <i class="fa fa-play"></i>
</el-button> </el-button>
<el-button <el-button size="mini" type="primary" @click="replayPause" v-show="replayIng" class="clearMargin">暂停 <i class="fa fa-pause"></i>
size="mini"
type="primary"
@click="replayPause"
v-show="replayIng"
class="clearMargin">暂停 <i class="fa fa-pause"></i>
</el-button> </el-button>
<el-button <el-button size="mini" @click="replayReresh" type="primary"><i class="fa fa-refresh"></i>
size="mini"
@click="replayReresh"
type="primary" ><i class="fa fa-refresh"></i>
</el-button> </el-button>
</p> </p>
<p> <p>
...@@ -96,7 +65,7 @@ ...@@ -96,7 +65,7 @@
<el-button class="" size="mini" type="text" @click="sortByStay">停留时长<i class="fa fa-sort"></i></el-button> <el-button class="" size="mini" type="text" @click="sortByStay">停留时长<i class="fa fa-sort"></i></el-button>
</div> </div>
<ul class="stay-list"> <ul class="stay-list">
<li class="stay-list-item" v-for="item in resultList" @click="openMapInfoWindow(item.idx)"> <li class="stay-list-item" v-for="item in resultList" @click="openMapInfoWindow(item.idx)" :key="item.idx">
<p class="addr">{{item.transferAddress}}</p> <p class="addr">{{item.transferAddress}}</p>
<p class="datetime"><span>{{item.begintime}}</span><span class="pull-right">{{item.duration}}</span></p> <p class="datetime"><span>{{item.begintime}}</span><span class="pull-right">{{item.duration}}</span></p>
</li> </li>
...@@ -115,80 +84,87 @@ ...@@ -115,80 +84,87 @@
</v-full-layout> </v-full-layout>
</template> </template>
<script> <script>
import store from '../../vuex/store.js' import store from "../../vuex/store.js";
import remoteLoad from 'utils/remoteLoad.js' import remoteLoad from "utils/remoteLoad.js";
import mapService from 'utils/mapService.js' import mapService from "utils/mapService.js";
import 'utils/mapEvent.js' import "utils/mapEvent.js";
import EventBus from '../../event-bus' import EventBus from "../../event-bus";
import {services} from '../../api' import { services } from "../../api";
import mock from '../../mock' import mock from "../../mock";
const MONITOR_SERVICE = services.monitor; const MONITOR_SERVICE = services.monitor;
const BUSINESS_SERVICE = services.business; const BUSINESS_SERVICE = services.business;
import {exportExcel} from 'utils' import { exportExcel } from "utils";
import {CONSTANT} from '../../constant' import { CONSTANT } from "../../constant";
import InfiniteLoading from 'vue-infinite-loading'; import InfiniteLoading from "vue-infinite-loading";
import MapControll from './MapControll.vue' import MapControll from "./MapControll.vue";
export default{ export default {
data(){ data() {
let checkDaterange = (rule, vaule, cb)=>{ let checkDaterange = (rule, vaule, cb) => {
const dateRange = this.form.dateRange; const dateRange = this.form.dateRange;
if(!dateRange || !dateRange.length){ if (!dateRange || !dateRange.length) {
cb(new Error('请选择日期')) cb(new Error("请选择日期"));
}else{ } else {
let min = dateRange[0]; let min = dateRange[0];
let max = dateRange[1]; let max = dateRange[1];
if(!moment.isMoment(min)){ if (!moment.isMoment(min)) {
min = moment(min) min = moment(min);
} }
if(!moment.isMoment(max)){ if (!moment.isMoment(max)) {
max = moment(max) max = moment(max);
} }
if(min.isBefore( moment(max).subtract(90, 'days'), 'minute')){ if (min.isBefore(moment(max).subtract(90, "days"), "minute")) {
cb(new Error('日期范围不能超过90天')) cb(new Error("日期范围不能超过90天"));
}
} }
cb()
} }
cb();
};
return { return {
AMap: null, AMap: null,
mapObj: null, mapObj: null,
mapLoading: false, mapLoading: false,
isInitMap: false, isInitMap: false,
searchText: '', searchText: "",
searchType: 'sn', searchType: "sn",
isSearching: false, isSearching: false,
resultBoxHidden: true, resultBoxHidden: true,
form: { form: {
dateRange: [moment().subtract(6, 'hours'), moment()], dateRange: [this.$route.query.startTime||moment().subtract(6, "hours"), this.$route.query.endTime||moment()],
timerange: '1', timerange: "1",
replaySpeed: 1, replaySpeed: 1,
speedOpts: [{ speedOpts: [
{
value: 0, value: 0,
label: '慢' label: "慢",
},{ },
{
value: 1, value: 1,
label: '正常' label: "正常",
},{ },
{
value: 2, value: 2,
label: '快' label: "快",
},{ },
{
value: 3, value: 3,
label: '很快' label: "很快",
}], },
replayType: 'RtTrack', ],
replayTypeOpts: [{ replayType: "RtTrack",
value: 'RtTrack', replayTypeOpts: [
label: 'GPS' {
},{ value: "RtTrack",
value: 'MobileBase', label: "GPS",
label: '基站' },
}], {
value: "MobileBase",
label: "基站",
},
],
}, },
replayData: [], replayData: [],
replayIniting: false, replayIniting: false,
...@@ -196,14 +172,14 @@ ...@@ -196,14 +172,14 @@
name: this.$route.query.name, name: this.$route.query.name,
standno: this.$route.query.standno, standno: this.$route.query.standno,
replayIng: false, replayIng: false,
replayBeginDate: '', replayBeginDate: "",
replayEndDate: '', replayEndDate: "",
replayAddr: '', replayAddr: "",
lastReplayBeginDate: '', lastReplayBeginDate: "",
lastReplayEndDate: '', lastReplayEndDate: "",
exporting: false, exporting: false,
rules: { rules: {
daterange: [{validator: checkDaterange}] daterange: [{ validator: checkDaterange }],
}, },
currentPage: 1, currentPage: 1,
pageSize: 10, pageSize: 10,
...@@ -212,80 +188,92 @@ ...@@ -212,80 +188,92 @@
resultList: [], resultList: [],
sortByTimeIsPositive: true, sortByTimeIsPositive: true,
sortByStayIsPositive: true, sortByStayIsPositive: true,
isInitFence: this.$route.query.isInitFence === '1'?true:false, isInitFence: this.$route.query.isInitFence === "1" ? true : false,
fenceId: this.$route.query.fenceId fenceId: this.$route.query.fenceId,
} };
}, },
mounted(){ mounted() {
store.dispatch('setFullsize', true);console.log(typeof this.$route.query.endtime) store.dispatch("setFullsize", true);
if(this.$route.query.begintime && this.$route.query.endtime){ if (this.$route.query.begintime && this.$route.query.endtime) {
this.form.dateRange = [moment(this.$route.query.begintime), moment(this.$route.query.endtime)] this.form.dateRange = [
moment(this.$route.query.begintime),
moment(this.$route.query.endtime),
];
} }
}, },
watch: { watch: {
'form.replaySpeed'(newVal){ "form.replaySpeed"(newVal) {
EventBus.$emit('uiMap.replay.speedChange', newVal) EventBus.$emit("uiMap.replay.speedChange", newVal);
}, },
'form.replayType'(newVal){ "form.replayType"(newVal) {
if(!this.isReplayParamsSame()){ if (!this.isReplayParamsSame()) {
this.replayIng = false; this.replayIng = false;
EventBus.$emit('uiMap.replay.pause') EventBus.$emit("uiMap.replay.pause");
} }
}, },
'form.dateRange'(newVal){ "form.dateRange"(newVal) {
if(!this.isReplayParamsSame()){ if (!this.isReplayParamsSame()) {
this.replayIng = false; this.replayIng = false;
EventBus.$emit('uiMap.replay.pause') EventBus.$emit("uiMap.replay.pause");
} }
}, },
}, },
methods: { methods: {
initMap(){ initMap() {
let check = ()=>{ let _this = this;
this.checkMapLoaded && window.clearTimeout(this.checkMapLoaded); let check = () => {
_this.checkMapLoaded && window.clearTimeout(_this.checkMapLoaded);
return setTimeout(()=>{
if('AMap' in window && typeof AMap.Map == 'function' && !this.mapObj){ return setTimeout(() => {
if (
"AMap" in window &&
typeof AMap.Map == "function" &&
!_this.mapObj
) {
window.AMap = AMap; window.AMap = AMap;
this.mapObj = mapService.init('map'); _this.mapObj = mapService.init("map");
//this.bindEvent(); //this.bindEvent();
this.isInitMap = true; _this.isInitMap = true;
this.drawPoi() //_this.drawPoi();
if(this.isInitFence){ if (_this.isInitFence) {
this.drawFence() //_this.drawFence();
} console.log("666666666666666666666");
}else{ _this.getFence();
this.checkMapLoaded = check() }
} } else {
}, 100) _this.checkMapLoaded = check();
} }
this.checkMapLoaded = check(); }, 100);
};
_this.checkMapLoaded = check();
}, },
pickDate(recentHoursOrDays){ pickDate(recentHoursOrDays) {
let unit = 'days'; let unit = "days";
if(/^\-\d+$/.test(recentHoursOrDays)){ if (/^\-\d+$/.test(recentHoursOrDays)) {
unit = 'hours'; unit = "hours";
recentHoursOrDays = -recentHoursOrDays; recentHoursOrDays = -recentHoursOrDays;
} }
this.form.dateRange = [moment().subtract(recentHoursOrDays, unit), moment()] this.form.dateRange = [
moment().subtract(recentHoursOrDays, unit),
moment(),
];
}, },
replayStart(){ replayStart() {
this.$refs.form.validate((valid, field)=>{ this.$refs.form.validate((valid, field) => {
if(valid){ if (valid) {
if(this.isReplayParamsSame()){ if (this.isReplayParamsSame()) {
if(this.replayData.length){ if (this.replayData.length) {
this.replayIng = true; this.replayIng = true;
EventBus.$emit('uiMap.replay.play'); EventBus.$emit("uiMap.replay.play");
}else{ } else {
this.$confirm('<p>暂无轨迹数据!</p>', '提示', { this.$confirm("<p>暂无轨迹数据!</p>", "提示", {
confirmButtonText: '确定', confirmButtonText: "确定",
showCancelButton: false, showCancelButton: false,
dangerouslyUseHTMLString: true dangerouslyUseHTMLString: true,
}); });
} }
}else{ } else {
this.replayIniting = true; this.replayIniting = true;
//this.replayData = mock.getTrackHistory.data; //this.replayData = mock.getTrackHistory.data;
//EventBus.$emit('uiMap.replay.init', this.replayData); //EventBus.$emit('uiMap.replay.init', this.replayData);
...@@ -295,353 +283,452 @@ ...@@ -295,353 +283,452 @@
this.lastReplayEndDate = this.form.dateRange[1]; this.lastReplayEndDate = this.form.dateRange[1];
this.lastReplayType = this.form.replayType; this.lastReplayType = this.form.replayType;
} }
}else{ } else {
return false; return false;
} }
}); });
}, },
isReplayParamsSame(){ isReplayParamsSame() {
if(moment(this.form.dateRange[0]).format('YYYY-MM-DD HH:mm:ss') === moment(this.lastReplayBeginDate).format('YYYY-MM-DD HH:mm:ss') if (
&& moment(this.form.dateRange[1]).format('YYYY-MM-DD HH:mm:ss') === moment(this.lastReplayEndDate).format('YYYY-MM-DD HH:mm:ss') moment(this.form.dateRange[0]).format("YYYY-MM-DD HH:mm:ss") ===
&& this.form.replayType === this.lastReplayType){ moment(this.lastReplayBeginDate).format("YYYY-MM-DD HH:mm:ss") &&
return true moment(this.form.dateRange[1]).format("YYYY-MM-DD HH:mm:ss") ===
moment(this.lastReplayEndDate).format("YYYY-MM-DD HH:mm:ss") &&
this.form.replayType === this.lastReplayType
) {
return true;
} }
return false; return false;
}, },
replayPause(){ replayPause() {
EventBus.$emit('uiMap.replay.pause', true); EventBus.$emit("uiMap.replay.pause", true);
this.replayIng = false; this.replayIng = false;
}, },
replayReresh(){ replayReresh() {
if(this.replayData.length && !this.replayIniting){ if (this.replayData.length && !this.replayIniting) {
EventBus.$emit('uiMap.replay.refresh'); EventBus.$emit("uiMap.replay.refresh");
this.replayIng = true; this.replayIng = true;
} }
}, },
getReplay(){ getReplay() {
if(!this.sn) return; if (!this.sn) return;
const params = {}; const params = {};
params.sn = this.sn; params.sn = this.sn;
params.startTime = moment(this.form.dateRange[0]).format('YYYY-MM-DD HH:mm:ss'); params.startTime = moment(this.form.dateRange[0]).format(
params.endTime = moment(this.form.dateRange[1]).format('YYYY-MM-DD HH:mm:ss'); "YYYY-MM-DD HH:mm:ss"
);
params.endTime = moment(this.form.dateRange[1]).format(
"YYYY-MM-DD HH:mm:ss"
);
this.replayIniting = true; this.replayIniting = true;
//const resource = this.form.replayType == 'RtTrack'?MONITOR_SERVICE.getTrackHistory:MONITOR_SERVICE.getBaseStationHistory; //const resource = this.form.replayType == 'RtTrack'?MONITOR_SERVICE.getTrackHistory:MONITOR_SERVICE.getBaseStationHistory;
params.locationType = this.form.replayType == 'RtTrack' ? 0 : 1 params.locationType = this.form.replayType == "RtTrack" ? 0 : 1;
MONITOR_SERVICE.getTrackHistory(params).then((result)=>{ MONITOR_SERVICE.getTrackHistory(params).then((result) => {
//result = mock.getTrackHistory //result = mock.getTrackHistory
console.log(result) console.log(result);
if(result.code == '200'){ if (result.code == "200") {
let data = result.data; let data = result.data;
this.replayData = data; this.replayData = data;
if(data&&data.length){ if (data && data.length) {
EventBus.$emit('uiMap.replay.init', data, this.form.replaySpeed); EventBus.$emit("uiMap.replay.init", data, this.form.replaySpeed);
}else{ } else {
EventBus.$emit("uiMap.replay.destroy");
EventBus.$emit('uiMap.replay.destroy'); this.$confirm(`<p>${"暂无轨迹数据!"}</p>`, "提示", {
this.$confirm(`<p>${'暂无轨迹数据!'}</p>`, '提示', { confirmButtonText: "确定",
confirmButtonText: '确定',
showCancelButton: false, showCancelButton: false,
dangerouslyUseHTMLString: true dangerouslyUseHTMLString: true,
}); });
this.replayIniting = false; this.replayIniting = false;
} }
} }
}); });
}, },
infiniteHandler($state){return; infiniteHandler($state) {
if(this.currentPage> this.maxPage){ return;
if (this.currentPage > this.maxPage) {
$state.complete(); $state.complete();
return; return;
} }
this.currentPage++; this.currentPage++;
$state.loaded(); $state.loaded();
setTimeout(()=>{ setTimeout(() => {
this.resultList = this.resultList.concat([{ this.resultList = this.resultList.concat([
addr: '甘肃省酒泉市肃州区海马福仕达中瑞汽车', {
date: '2018-11-20 15:19:21', addr: "甘肃省酒泉市肃州区海马福仕达中瑞汽车",
restTime: '25小时26分钟25秒' date: "2018-11-20 15:19:21",
}]) restTime: "25小时26分钟25秒",
},10000) },
]);
}, 10000);
return; return;
DEVICE_SERVICE.getDeviceList(this.params).then((res)=>{ DEVICE_SERVICE.getDeviceList(this.params).then((res) => {
const data = res.data; const data = res.data;
if(data && data.length){ if (data && data.length) {
const arr = [] const arr = [];
data.forEach((item) => { data.forEach((item) => {
arr.push({ arr.push({
label: item.name, label: item.name,
value: item.id value: item.id,
}) });
}) });
if(this.options[0] && 'label' in this.options[0]){ if (this.options[0] && "label" in this.options[0]) {
this.options = this.options.concat(arr); this.options = this.options.concat(arr);
}else{ } else {
this.options = arr this.options = arr;
} }
this.total = res.recordsTotal; this.total = res.recordsTotal;
this.maxPage = Math.ceil(this.total/this.pageSize); this.maxPage = Math.ceil(this.total / this.pageSize);
this.currentPage++; this.currentPage++;
this.$refs.infiniteLoading.$emit('$InfiniteLoading:loaded'); this.$refs.infiniteLoading.$emit("$InfiniteLoading:loaded");
}else{ } else {
this.$refs.infiniteLoading.$emit('$InfiniteLoading:complete'); this.$refs.infiniteLoading.$emit("$InfiniteLoading:complete");
this.options = [] this.options = [];
} }
}) });
}, },
exportReplay(){ exportReplay() {
if(this.exporting) return; if (this.exporting) return;
if(this.replayData.length && !this.replayIniting){ if (this.replayData.length && !this.replayIniting) {
this.exporting = true; this.exporting = true;
if(!this.replayData[0].transferAddress){ if (!this.replayData[0].transferAddress) {
EventBus.$emit('uiMap.replay.transferAdr', this.replayData); EventBus.$emit("uiMap.replay.transferAdr", this.replayData);
return; return;
} }
this.exportCsv(); this.exportCsv();
}else{ } else {
this.$message({ this.$message({
type: 'info', type: "info",
message: '数据为空,不能下载' message: "数据为空,不能下载",
}); });
} }
}, },
exportCsv(){ exportCsv() {
let paramArr = []; let paramArr = [];
this.replayData.forEach((dataItem)=>{ this.replayData.forEach((dataItem) => {
let paramItem = {}; let paramItem = {};
for(let key in dataItem){ for (let key in dataItem) {
switch(key){ switch (key) {
case 'carName': case "carName":
case 'standNo': case "standNo":
case 'sn': case "sn":
case 'dateTime': case "dateTime":
case 'speed': case "speed":
case 'userTel': case "userTel":
case 'activeTime': case "activeTime":
paramItem[key] = dataItem[key]?dataItem[key]:''; paramItem[key] = dataItem[key] ? dataItem[key] : "";
break; break;
case 'transferAddress': case "transferAddress":
paramItem.address = dataItem.transferAddress?dataItem.transferAddress:''; paramItem.address = dataItem.transferAddress
? dataItem.transferAddress
: "";
break; break;
case 'status': case "status":
paramItem.status = dataItem.speed>0?'行驶':'停驶'; paramItem.status = dataItem.speed > 0 ? "行驶" : "停驶";
break; break;
} }
} }
paramItem.lnglat = `${dataItem.elng},${dataItem.elat}`; paramItem.lnglat = `${dataItem.elng},${dataItem.elat}`;
paramItem.locateMode = this.form.replayType == 'RtTrack'?'GPS':'基站'; paramItem.locateMode =
this.form.replayType == "RtTrack" ? "GPS" : "基站";
paramArr.push(paramItem); paramArr.push(paramItem);
}); });
exportExcel('/devicemonitor/monitor/exporttrackpoint', { exportExcel(
"/devicemonitor/monitor/exporttrackpoint",
{
expData: encodeURI(JSON.stringify(paramArr)), expData: encodeURI(JSON.stringify(paramArr)),
startTime: moment(this.form.dateRange[0]).format('YYYY-MM-DD HH:mm:ss'), startTime: moment(this.form.dateRange[0]).format(
endTime: moment(this.form.dateRange[1]).format('YYYY-MM-DD HH:mm:ss'), "YYYY-MM-DD HH:mm:ss"
locationType: this.form.replayType == 'RtTrack' ? 0 : 1, ),
sn: this.sn endTime: moment(this.form.dateRange[1]).format("YYYY-MM-DD HH:mm:ss"),
}, 'post', ()=>{ locationType: this.form.replayType == "RtTrack" ? 0 : 1,
sn: this.sn,
},
"post",
() => {
this.exporting = false; this.exporting = false;
}); }
);
}, },
getHistoryLocation(){ getHistoryLocation() {
this.resultList = []; this.resultList = [];
MONITOR_SERVICE.getHistoryLocation({ MONITOR_SERVICE.getHistoryLocation({
sn: this.sn,//'90903010001', sn: this.sn, //'90903010001',
startTime: moment(this.form.dateRange[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss'),//'2018-03-22 09:47:43',// startTime: moment(this.form.dateRange[0])
endTime: moment(this.form.dateRange[1]).endOf('day').format('YYYY-MM-DD HH:mm:ss'),//'2019-10-27 09:56:45',// .startOf("day")
times: '0', .format("YYYY-MM-DD HH:mm:ss"), //'2018-03-22 09:47:43',//
locationType: this.form.replayType == 'RtTrack' ? 0 : 1 endTime: moment(this.form.dateRange[1])
}).then((res)=>{ .endOf("day")
console.log(res) .format("YYYY-MM-DD HH:mm:ss"), //'2019-10-27 09:56:45',//
if(res.code == 200){ times: "0",
locationType: this.form.replayType == "RtTrack" ? 0 : 1,
}).then((res) => {
console.log(res);
if (res.code == 200) {
const data = res.data; const data = res.data;
if(data.length){ if (data.length) {
data.forEach((item, idx)=>{ data.forEach((item, idx) => {
item.idx = idx; item.idx = idx;
}); });
this.resultList = data; this.resultList = data;
} }
EventBus.$emit('uiMap.replay.drawLocation', data); EventBus.$emit("uiMap.replay.drawLocation", data);
this.isSearching = false; this.isSearching = false;
} }
}); });
}, },
exportExcel(){ exportExcel() {
if(!this.resultList.length){ if (!this.resultList.length) {
this.$message({ this.$message({
type: 'info', type: "info",
message: '数据为空,不能下载' message: "数据为空,不能下载",
}); });
}else{ } else {
let arr = []; let arr = [];
this.resultList.forEach((item)=>{ this.resultList.forEach((item) => {
item.address = item.transferAddress; item.address = item.transferAddress;
arr.push(item); arr.push(item);
}); });
exportExcel('/devicemonitor/monitor/exportstaypoint', { exportExcel(
"/devicemonitor/monitor/exportstaypoint",
{
sn: this.sn, sn: this.sn,
vin: this.standno, vin: this.standno,
name: this.name, name: this.name,
locationType: this.form.replayType == 'RtTrack' ? 0 : 1, locationType: this.form.replayType == "RtTrack" ? 0 : 1,
expData: encodeURI(JSON.stringify(arr)) expData: encodeURI(JSON.stringify(arr)),
}, 'post'); },
"post"
);
} }
}, },
sortByTime(){ sortByTime() {
let sortArr = this.resultList.sort((a,b)=>{ let sortArr = this.resultList.sort((a, b) => {
return moment(a.begintime).isBefore(moment(b.begintime))?(this.sortByTimeIsPositive?-1:1):(this.sortByTimeIsPositive?1:-1); return moment(a.begintime).isBefore(moment(b.begintime))
? this.sortByTimeIsPositive
? -1
: 1
: this.sortByTimeIsPositive
? 1
: -1;
}); });
this.sortByTimeIsPositive = !this.sortByTimeIsPositive; this.sortByTimeIsPositive = !this.sortByTimeIsPositive;
this.resultList = [].concat(sortArr); this.resultList = [].concat(sortArr);
}, },
sortByStay(){ sortByStay() {
let sortArr = this.resultList.sort((a,b)=>{ let sortArr = this.resultList.sort((a, b) => {
let aTime = (new Date(a.endtime)).getTime() - (new Date(a.begintime)).getTime(); let aTime =
let bTime = (new Date(b.endtime)).getTime() - (new Date(b.begintime)).getTime(); new Date(a.endtime).getTime() - new Date(a.begintime).getTime();
return aTime>bTime?(this.sortByStayIsPositive?-1:1):(this.sortByStayIsPositive?1:-1); let bTime =
new Date(b.endtime).getTime() - new Date(b.begintime).getTime();
return aTime > bTime
? this.sortByStayIsPositive
? -1
: 1
: this.sortByStayIsPositive
? 1
: -1;
}); });
this.sortByStayIsPositive = !this.sortByStayIsPositive; this.sortByStayIsPositive = !this.sortByStayIsPositive;
this.resultList = [].concat(sortArr); this.resultList = [].concat(sortArr);
}, },
openMapInfoWindow(idx){ openMapInfoWindow(idx) {
EventBus.$emit('uiMap.replay.openInfoWindow', idx) EventBus.$emit("uiMap.replay.openInfoWindow", idx);
}, },
drawPoi(){ drawPoi() {
BUSINESS_SERVICE.getPOI({ let _this = this;
sn: this.sn BUSINESS_SERVICE.getPOI({ sn: _this.sn }).then((res) => {
}).then((res)=>{ console.log("666666666666");
if(res.returnCode === '0'){ console.log(res);
if(res.data && res.data.length){ if (res.returnCode === "0") {
res.data.forEach((item)=>{ if (res.data && res.data.length) {
let marker = mapService.createPOIMarker(mapService.getLngLat(item.lng, item.lat), this.mapObj) res.data.forEach((item) => {
let infoWindow = mapService.bindPOIInfoWindow(marker, this.mapObj, item) let marker = mapService.createPOIMarker(
}) mapService.getLngLat(item.lng, item.lat),
this.mapObj
);
let infoWindow = mapService.bindPOIInfoWindow(
marker,
this.mapObj,
item
);
});
} }
} }
}) });
}, },
drawFence(){ drawFence() {
MONITOR_SERVICE.getSingleFence({ MONITOR_SERVICE.getSingleFence({
sn: this.sn, sn: this.sn,
fenceId: parseInt(this.fenceId) fenceId: parseInt(this.fenceId),
}).then((res)=>{ }).then((res) => {
if(res.returnCode == 0){ if (res.returnCode == 0) {
const data = res.data; const data = res.data;
if(data){ if (data) {
if(data.shapeType === 2){ if (data.shapeType === 2) {
EventBus.$emit('uiMap.fence.createFenceCircle', { EventBus.$emit("uiMap.fence.createFenceCircle", {
lng: data.lng, lng: data.lng,
lat: data.lat, lat: data.lat,
radius: data.radius, radius: data.radius,
isEdit: false isEdit: false,
});
} else if (data.shapeType === 3) {
this.drawDistrict(data.areaCode);
} else if (data.shapeType === 5) {
if (data.lnglat) {
let polygonPath = data.lnglat.split("|").map((item) => {
return [item.split(",")[0], item.split(",")[1]];
}); });
}else if(data.shapeType === 3){ this.drawPolygon(polygonPath);
this.drawDistrict(data.areaCode)
}else if(data.shapeType === 5){
if(data.lnglat){
let polygonPath = data.lnglat.split('|').map((item)=>{
return [item.split(',')[0], item.split(',')[1]]
})
this.drawPolygon(polygonPath)
} }
} }
} }
} }
}); });
}, },
drawDistrict(areaCode){ drawDistrict(areaCode) {
this._drawDistrictTimeoutId && clearTimeout(this._drawDistrictTimeoutId); this._drawDistrictTimeoutId && clearTimeout(this._drawDistrictTimeoutId);
this._drawDistrictTimeoutId = setTimeout(()=>{ this._drawDistrictTimeoutId = setTimeout(() => {
EventBus.$emit('uiMap.fence.drawDistrict', areaCode); EventBus.$emit("uiMap.fence.drawDistrict", areaCode);
}, 500); }, 500);
}, },
drawPolygon(path){ drawPolygon(path) {
EventBus.$emit('uiMap.fence.drawPolygon', { EventBus.$emit("uiMap.fence.drawPolygon", {
path, path,
isEdit: false isEdit: false,
}) });
},
// 获取围栏信息-并画围栏
getFence() {
MONITOR_SERVICE.getFenceInfo({
sn: this.sn,
}).then((res) => {
console.log(res);
let list = res.data || [];
if (res.code != 200) {
return false;
// const data = res.data || [];
// if (data) {
// if (data.shapeType === 2) {
// EventBus.$emit("uiMap.fence.createFenceCircle", {
// lng: data.lng,
// lat: data.lat,
// radius: data.radius,
// isEdit: false,
// });
// } else if (data.shapeType === 3) {
// this.drawDistrict(data.areaCode);
// } else if (data.shapeType === 5) {
// if (data.lnglat) {
// let polygonPath = data.lnglat.split("|").map((item) => {
// return [item.split(",")[0], item.split(",")[1]];
// });
// this.drawPolygon(polygonPath);
// }
// }
// }
}
// 循环画围栏
list.map((k) => {
// 圆形围栏
if (k.shapeType == 1) {
EventBus.$emit("uiMap.fence.createFenceCircle", {
lng: k.lnglat.split(",")[0],
lat: k.lnglat.split(",")[1],
radius: k.radius,
isEdit: false,
});
}
// 多边形围栏
if (k.shapeType == 3) {
let polygonPath = k.lnglat.split("|").map((item) => {
return [item.split(",")[0], item.split(",")[1]];
});
this.drawPolygon(polygonPath);
} }
});
});
}, },
created () { },
if(window.AMap){ created() {
if (window.AMap) {
this.initMap(); this.initMap();
}else{ } else {
remoteLoad(`${CONSTANT.AMAP_URL}`).then(()=>{ remoteLoad(`${CONSTANT.AMAP_URL}`).then(() => {
remoteLoad(`https://webapi.amap.com/ui/1.0/main.js?v=1.0.11`).then(()=>{ remoteLoad(`https://webapi.amap.com/ui/1.0/main.js?v=1.0.11`).then(
() => {
this.initMap(); this.initMap();
}) }
}) );
});
} }
//轨迹播放当前位置地址显示 //轨迹播放当前位置地址显示
EventBus.$on('uiMap.replay.currAddress', (adr)=>{ EventBus.$on("uiMap.replay.currAddress", (adr) => {
this.replayAddr = adr; this.replayAddr = adr;
}); });
//轨迹初始化完成 //轨迹初始化完成
EventBus.$on('uiMap.replay.initDone', ()=>{ EventBus.$on("uiMap.replay.initDone", () => {
this.replayIniting = false; this.replayIniting = false;
this.replayIng = true; this.replayIng = true;
}); });
//轨迹播放结束 //轨迹播放结束
EventBus.$on('uiMap.replay.done', ()=>{ EventBus.$on("uiMap.replay.done", () => {
this.replayIng = false; this.replayIng = false;
this.$alert(`<p>开始时间: ${this.replayData[0].dateTime}</p><p>结束时间: ${this.replayData[this.replayData.length-1].dateTime}</p>`, '轨迹播放完成', { this.$alert(
type: 'success', `<p>开始时间: ${this.replayData[0].dateTime}</p><p>结束时间: ${
confirmButtonText: '确定', this.replayData[this.replayData.length - 1].dateTime
dangerouslyUseHTMLString: true }</p>`,
}); "轨迹播放完成",
{
type: "success",
confirmButtonText: "确定",
dangerouslyUseHTMLString: true,
}
);
}); });
//轨迹解析结束 //轨迹解析结束
EventBus.$on('uiMap.replay.transferAdrDone', ()=>{ EventBus.$on("uiMap.replay.transferAdrDone", () => {
if(this.exporting){ if (this.exporting) {
this.exportCsv(); this.exportCsv();
} }
}); });
EventBus.$on('uiMap.historyLocation.transferSuccess', (data)=>{ EventBus.$on("uiMap.historyLocation.transferSuccess", (data) => {
this.resultList = [].concat(data); this.resultList = [].concat(data);
}); });
EventBus.$on('uiMap.replay.replayIng', (data)=>{ EventBus.$on("uiMap.replay.replayIng", (data) => {
this.replayIng = data; this.replayIng = data;
}); });
},
beforeDestroy(){
}, },
beforeDestroy() {},
components: { components: {
MapControll MapControll,
} },
} };
</script> </script>
<style scoped> <style scoped>
/*样式写在 scss/monitor.scss*/ /*样式写在 scss/monitor.scss*/
.clearMargin{ .clearMargin {
margin-left: 0px; margin-left: 0px;
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!