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
<template> <template>
<v-full-layout> <v-full-layout>
<template slot="breadcrumb"> <template slot="breadcrumb">
<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">
<div class="search-box" :class="resultBoxHidden?'active':''"> <div class="search-box" :class="resultBoxHidden?'active':''">
<h3>轨迹回放</h3> <h3>轨迹回放</h3>
<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"> <el-button size="mini" type="text" @click="pickDate(-6)">近6小时</el-button>
<el-button size="mini" type="text" @click="pickDate(-6)">近6小时</el-button> <el-button size="mini" type="text" @click="pickDate(3)">近3天</el-button>
<el-button size="mini" type="text" @click="pickDate(3)">近3天</el-button> <el-button size="mini" type="text" @click="pickDate(90)">近90天</el-button>
<el-button size="mini" type="text" @click="pickDate(90)">近90天</el-button> </div>
</div> </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 v-for="item in form.speedOpts" :key="item.value" :label="item.label" :value="item.value">
<el-option </el-option>
v-for="item in form.speedOpts" </el-select>
:key="item.value" </el-form-item>
:label="item.label" <el-form-item label="定位类型">
:value="item.value"> <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">
</el-select> </el-option>
</el-form-item> </el-select>
<el-form-item label="定位类型"> </el-form-item>
<el-select v-model="form.replayType" placeholder="请选择" style="width: 80px"> </el-form>
<el-option <p>
v-for="item in form.replayTypeOpts" <el-button size="mini" type="primary" v-show="!replayIng" @click="replayStart" :loading="replayIniting">播放 <i class="fa fa-play"></i>
:key="item.value" </el-button>
:label="item.label" <el-button size="mini" type="primary" @click="replayPause" v-show="replayIng" class="clearMargin">暂停 <i class="fa fa-pause"></i>
:value="item.value"> </el-button>
</el-option> <el-button size="mini" @click="replayReresh" type="primary"><i class="fa fa-refresh"></i>
</el-select> </el-button>
</el-form-item> </p>
</el-form> <p>
<p> <el-button size="mini" type="primary" plain @click="exportReplay" :loading="exporting">导出轨迹(.csv) <i class="fa fa-download"></i></el-button>
<el-button size="mini" <el-button size="mini" type="primary" plain @click="resultBoxHidden=false">停留点</el-button>
type="primary" </p>
v-show="!replayIng"
@click="replayStart" <p class="replay-addr" v-show="replayAddr">暂停地址:<span>{{replayAddr}}</span></p>
:loading="replayIniting">播放 <i class="fa fa-play"></i> </div>
</el-button> <div class="result-box" :class="resultBoxHidden?'':'active'">
<el-button <div class="result-box-head">
size="mini" <el-button class="pull-left" size="mini" type="text" @click="resultBoxHidden=true;">返回“查询”</el-button>
type="primary" <el-button class="pull-right" size="mini" type="text" @click="exportExcel" :loading="exportLocationIng">导出Excel</el-button>
@click="replayPause" <span>停留点</span>
v-show="replayIng" </div>
class="clearMargin">暂停 <i class="fa fa-pause"></i> <div class="result-box-filter text-center">
</el-button> <el-button class="" size="mini" type="text" @click="sortByTime">停留时间<i class="fa fa-sort"></i></el-button>
<el-button <el-button class="" size="mini" type="text" @click="sortByStay">停留时长<i class="fa fa-sort"></i></el-button>
size="mini" </div>
@click="replayReresh" <ul class="stay-list">
type="primary" ><i class="fa fa-refresh"></i> <li class="stay-list-item" v-for="item in resultList" @click="openMapInfoWindow(item.idx)" :key="item.idx">
</el-button> <p class="addr">{{item.transferAddress}}</p>
</p> <p class="datetime"><span>{{item.begintime}}</span><span class="pull-right">{{item.duration}}</span></p>
<p> </li>
<el-button size="mini" type="primary" plain @click="exportReplay" :loading="exporting">导出轨迹(.csv) <i class="fa fa-download"></i></el-button> <li v-show="!resultList.length">
<el-button size="mini" type="primary" plain @click="resultBoxHidden=false">停留点</el-button> <p class="text-center">无数据</p>
</p> </li>
<infinite-loading v-if="needInfinite" @infinite="infiniteHandler" ref="infiniteLoading">
<p class="replay-addr" v-show="replayAddr">暂停地址:<span>{{replayAddr}}</span></p> <span slot="no-more">没有更多数据了</span>
</div> <span slot="no-results">无结果</span>
<div class="result-box" :class="resultBoxHidden?'':'active'"> </infinite-loading>
<div class="result-box-head"> </ul>
<el-button class="pull-left" size="mini" type="text" @click="resultBoxHidden=true;">返回“查询”</el-button> </div>
<el-button class="pull-right" size="mini" type="text" @click="exportExcel" :loading="exportLocationIng">导出Excel</el-button> </div>
<span>停留点</span> </div>
</div> </template>
<div class="result-box-filter text-center"> </v-full-layout>
<el-button class="" size="mini" type="text" @click="sortByTime">停留时间<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>
<ul class="stay-list">
<li class="stay-list-item" v-for="item in resultList" @click="openMapInfoWindow(item.idx)">
<p class="addr">{{item.transferAddress}}</p>
<p class="datetime"><span>{{item.begintime}}</span><span class="pull-right">{{item.duration}}</span></p>
</li>
<li v-show="!resultList.length">
<p class="text-center">无数据</p>
</li>
<infinite-loading v-if="needInfinite" @infinite="infiniteHandler" ref="infiniteLoading">
<span slot="no-more">没有更多数据了</span>
<span slot="no-results">无结果</span>
</infinite-loading>
</ul>
</div>
</div>
</div>
</template>
</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 InfiniteLoading from "vue-infinite-loading";
import MapControll from "./MapControll.vue";
export default {
data() {
let checkDaterange = (rule, vaule, cb) => {
const dateRange = this.form.dateRange;
if (!dateRange || !dateRange.length) {
cb(new Error("请选择日期"));
} else {
let min = dateRange[0];
let max = dateRange[1];
if (!moment.isMoment(min)) {
min = moment(min);
}
if (!moment.isMoment(max)) {
max = moment(max);
}
import {CONSTANT} from '../../constant' if (min.isBefore(moment(max).subtract(90, "days"), "minute")) {
import InfiniteLoading from 'vue-infinite-loading'; cb(new Error("日期范围不能超过90天"));
import MapControll from './MapControll.vue' }
}
cb();
};
export default{ return {
data(){ AMap: null,
let checkDaterange = (rule, vaule, cb)=>{ mapObj: null,
mapLoading: false,
isInitMap: false,
searchText: "",
searchType: "sn",
isSearching: false,
resultBoxHidden: true,
form: {
dateRange: [this.$route.query.startTime||moment().subtract(6, "hours"), this.$route.query.endTime||moment()],
timerange: "1",
replaySpeed: 1,
speedOpts: [
{
value: 0,
label: "慢",
},
{
value: 1,
label: "正常",
},
{
value: 2,
label: "快",
},
{
value: 3,
label: "很快",
},
],
replayType: "RtTrack",
replayTypeOpts: [
{
value: "RtTrack",
label: "GPS",
},
{
value: "MobileBase",
label: "基站",
},
],
},
replayData: [],
replayIniting: false,
sn: this.$route.query.sn,
name: this.$route.query.name,
standno: this.$route.query.standno,
replayIng: false,
replayBeginDate: "",
replayEndDate: "",
replayAddr: "",
lastReplayBeginDate: "",
lastReplayEndDate: "",
exporting: false,
rules: {
daterange: [{ validator: checkDaterange }],
},
currentPage: 1,
pageSize: 10,
total: 100,
maxPage: 10,
resultList: [],
sortByTimeIsPositive: true,
sortByStayIsPositive: true,
isInitFence: this.$route.query.isInitFence === "1" ? true : false,
fenceId: this.$route.query.fenceId,
};
},
mounted() {
store.dispatch("setFullsize", true);
if (this.$route.query.begintime && this.$route.query.endtime) {
this.form.dateRange = [
moment(this.$route.query.begintime),
moment(this.$route.query.endtime),
];
}
},
watch: {
"form.replaySpeed"(newVal) {
EventBus.$emit("uiMap.replay.speedChange", newVal);
},
"form.replayType"(newVal) {
if (!this.isReplayParamsSame()) {
this.replayIng = false;
EventBus.$emit("uiMap.replay.pause");
}
},
"form.dateRange"(newVal) {
if (!this.isReplayParamsSame()) {
this.replayIng = false;
EventBus.$emit("uiMap.replay.pause");
}
},
},
methods: {
initMap() {
let _this = this;
let check = () => {
_this.checkMapLoaded && window.clearTimeout(_this.checkMapLoaded);
const dateRange = this.form.dateRange; return setTimeout(() => {
if(!dateRange || !dateRange.length){ if (
cb(new Error('请选择日期')) "AMap" in window &&
}else{ typeof AMap.Map == "function" &&
let min = dateRange[0]; !_this.mapObj
let max = dateRange[1]; ) {
window.AMap = AMap;
if(!moment.isMoment(min)){ _this.mapObj = mapService.init("map");
min = moment(min)
}
if(!moment.isMoment(max)){
max = moment(max)
}
if(min.isBefore( moment(max).subtract(90, 'days'), 'minute')){
cb(new Error('日期范围不能超过90天'))
}
}
cb()
}
return {
AMap: null,
mapObj: null,
mapLoading: false,
isInitMap: false,
searchText: '',
searchType: 'sn',
isSearching: false,
resultBoxHidden: true,
form: {
dateRange: [moment().subtract(6, 'hours'), moment()],
timerange: '1',
replaySpeed: 1,
speedOpts: [{
value: 0,
label: '慢'
},{
value: 1,
label: '正常'
},{
value: 2,
label: '快'
},{
value: 3,
label: '很快'
}],
replayType: 'RtTrack',
replayTypeOpts: [{
value: 'RtTrack',
label: 'GPS'
},{
value: 'MobileBase',
label: '基站'
}],
},
replayData: [],
replayIniting: false,
sn: this.$route.query.sn,
name: this.$route.query.name,
standno: this.$route.query.standno,
replayIng: false,
replayBeginDate: '',
replayEndDate: '',
replayAddr: '',
lastReplayBeginDate: '',
lastReplayEndDate: '',
exporting: false,
rules: {
daterange: [{validator: checkDaterange}]
},
currentPage: 1,
pageSize: 10,
total: 100,
maxPage: 10,
resultList: [],
sortByTimeIsPositive: true,
sortByStayIsPositive: true,
isInitFence: this.$route.query.isInitFence === '1'?true:false,
fenceId: this.$route.query.fenceId
}
},
mounted(){
store.dispatch('setFullsize', true);console.log(typeof 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)]
}
},
watch: {
'form.replaySpeed'(newVal){
EventBus.$emit('uiMap.replay.speedChange', newVal)
},
'form.replayType'(newVal){
if(!this.isReplayParamsSame()){
this.replayIng = false;
EventBus.$emit('uiMap.replay.pause')
}
},
'form.dateRange'(newVal){
if(!this.isReplayParamsSame()){
this.replayIng = false;
EventBus.$emit('uiMap.replay.pause')
}
},
},
methods: {
initMap(){
let check = ()=>{
this.checkMapLoaded && window.clearTimeout(this.checkMapLoaded);
return setTimeout(()=>{ //this.bindEvent();
if('AMap' in window && typeof AMap.Map == 'function' && !this.mapObj){ _this.isInitMap = true;
window.AMap = AMap; //_this.drawPoi();
this.mapObj = mapService.init('map'); if (_this.isInitFence) {
//_this.drawFence();
//this.bindEvent(); console.log("666666666666666666666");
this.isInitMap = true; _this.getFence();
this.drawPoi() }
if(this.isInitFence){ } else {
this.drawFence() _this.checkMapLoaded = check();
} }
}else{ }, 100);
this.checkMapLoaded = check() };
} _this.checkMapLoaded = check();
}, 100) },
} pickDate(recentHoursOrDays) {
this.checkMapLoaded = check(); let unit = "days";
}, if (/^\-\d+$/.test(recentHoursOrDays)) {
pickDate(recentHoursOrDays){ unit = "hours";
let unit = 'days'; recentHoursOrDays = -recentHoursOrDays;
if(/^\-\d+$/.test(recentHoursOrDays)){ }
unit = 'hours'; this.form.dateRange = [
recentHoursOrDays = -recentHoursOrDays; 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);
this.getReplay(); this.getReplay();
this.getHistoryLocation(); this.getHistoryLocation();
this.lastReplayBeginDate = this.form.dateRange[0]; this.lastReplayBeginDate = this.form.dateRange[0];
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() {
}, if (
isReplayParamsSame(){ moment(this.form.dateRange[0]).format("YYYY-MM-DD HH:mm:ss") ===
if(moment(this.form.dateRange[0]).format('YYYY-MM-DD HH:mm:ss') === moment(this.lastReplayBeginDate).format('YYYY-MM-DD HH:mm:ss') moment(this.lastReplayBeginDate).format("YYYY-MM-DD HH:mm:ss") &&
&& 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[1]).format("YYYY-MM-DD HH:mm:ss") ===
&& this.form.replayType === this.lastReplayType){ moment(this.lastReplayEndDate).format("YYYY-MM-DD HH:mm:ss") &&
return true this.form.replayType === this.lastReplayType
} ) {
return false; return true;
}, }
replayPause(){ return false;
EventBus.$emit('uiMap.replay.pause', true); },
this.replayIng = false; replayPause() {
}, EventBus.$emit("uiMap.replay.pause", true);
replayReresh(){ this.replayIng = false;
if(this.replayData.length && !this.replayIniting){ },
EventBus.$emit('uiMap.replay.refresh'); replayReresh() {
this.replayIng = true; if (this.replayData.length && !this.replayIniting) {
} EventBus.$emit("uiMap.replay.refresh");
}, this.replayIng = true;
getReplay(){ }
if(!this.sn) return; },
const params = {}; getReplay() {
params.sn = this.sn; if (!this.sn) return;
params.startTime = moment(this.form.dateRange[0]).format('YYYY-MM-DD HH:mm:ss'); const params = {};
params.endTime = moment(this.form.dateRange[1]).format('YYYY-MM-DD HH:mm:ss'); params.sn = this.sn;
params.startTime = moment(this.form.dateRange[0]).format(
"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) {
infiniteHandler($state){return; return;
if(this.currentPage> this.maxPage){ 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) },
]);
return; }, 10000);
DEVICE_SERVICE.getDeviceList(this.params).then((res)=>{
const data = res.data;
if(data && data.length){
const arr = []
data.forEach((item) => {
arr.push({
label: item.name,
value: item.id
})
})
if(this.options[0] && 'label' in this.options[0]){
this.options = this.options.concat(arr);
}else{
this.options = arr
}
this.total = res.recordsTotal;
this.maxPage = Math.ceil(this.total/this.pageSize);
this.currentPage++;
this.$refs.infiniteLoading.$emit('$InfiniteLoading:loaded');
}else{
this.$refs.infiniteLoading.$emit('$InfiniteLoading:complete');
this.options = []
}
})
},
exportReplay(){
if(this.exporting) return;
if(this.replayData.length && !this.replayIniting){ return;
this.exporting = true; DEVICE_SERVICE.getDeviceList(this.params).then((res) => {
if(!this.replayData[0].transferAddress){ const data = res.data;
EventBus.$emit('uiMap.replay.transferAdr', this.replayData); if (data && data.length) {
const arr = [];
return; data.forEach((item) => {
} arr.push({
this.exportCsv(); label: item.name,
}else{ value: item.id,
this.$message({ });
type: 'info', });
message: '数据为空,不能下载' if (this.options[0] && "label" in this.options[0]) {
}); this.options = this.options.concat(arr);
} } else {
this.options = arr;
}, }
exportCsv(){
let paramArr = [];
this.replayData.forEach((dataItem)=>{ this.total = res.recordsTotal;
let paramItem = {}; this.maxPage = Math.ceil(this.total / this.pageSize);
this.currentPage++;
this.$refs.infiniteLoading.$emit("$InfiniteLoading:loaded");
} else {
this.$refs.infiniteLoading.$emit("$InfiniteLoading:complete");
this.options = [];
}
});
},
exportReplay() {
if (this.exporting) return;
for(let key in dataItem){ if (this.replayData.length && !this.replayIniting) {
switch(key){ this.exporting = true;
case 'carName': if (!this.replayData[0].transferAddress) {
case 'standNo': EventBus.$emit("uiMap.replay.transferAdr", this.replayData);
case 'sn':
case 'dateTime':
case 'speed':
case 'userTel':
case 'activeTime':
paramItem[key] = dataItem[key]?dataItem[key]:'';
break;
case 'transferAddress': return;
paramItem.address = dataItem.transferAddress?dataItem.transferAddress:''; }
break; this.exportCsv();
} else {
this.$message({
type: "info",
message: "数据为空,不能下载",
});
}
},
exportCsv() {
let paramArr = [];
case 'status': this.replayData.forEach((dataItem) => {
paramItem.status = dataItem.speed>0?'行驶':'停驶'; let paramItem = {};
break;
} for (let key in dataItem) {
switch (key) {
case "carName":
case "standNo":
case "sn":
case "dateTime":
case "speed":
case "userTel":
case "activeTime":
paramItem[key] = dataItem[key] ? dataItem[key] : "";
break;
} case "transferAddress":
paramItem.lnglat = `${dataItem.elng},${dataItem.elat}`; paramItem.address = dataItem.transferAddress
paramItem.locateMode = this.form.replayType == 'RtTrack'?'GPS':'基站'; ? dataItem.transferAddress
paramArr.push(paramItem); : "";
}); break;
exportExcel('/devicemonitor/monitor/exporttrackpoint', { case "status":
expData: encodeURI(JSON.stringify(paramArr)), paramItem.status = dataItem.speed > 0 ? "行驶" : "停驶";
startTime: moment(this.form.dateRange[0]).format('YYYY-MM-DD HH:mm:ss'), break;
endTime: moment(this.form.dateRange[1]).format('YYYY-MM-DD HH:mm:ss'), }
locationType: this.form.replayType == 'RtTrack' ? 0 : 1, }
sn: this.sn paramItem.lnglat = `${dataItem.elng},${dataItem.elat}`;
}, 'post', ()=>{ paramItem.locateMode =
this.exporting = false; this.form.replayType == "RtTrack" ? "GPS" : "基站";
paramArr.push(paramItem);
});
exportExcel(
"/devicemonitor/monitor/exporttrackpoint",
{
expData: encodeURI(JSON.stringify(paramArr)),
startTime: moment(this.form.dateRange[0]).format(
"YYYY-MM-DD HH:mm:ss"
),
endTime: moment(this.form.dateRange[1]).format("YYYY-MM-DD HH:mm:ss"),
locationType: this.form.replayType == "RtTrack" ? 0 : 1,
sn: this.sn,
},
"post",
() => {
this.exporting = false;
}
);
},
getHistoryLocation() {
this.resultList = [];
MONITOR_SERVICE.getHistoryLocation({
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',//
endTime: moment(this.form.dateRange[1])
.endOf("day")
.format("YYYY-MM-DD HH:mm:ss"), //'2019-10-27 09:56:45',//
times: "0",
locationType: this.form.replayType == "RtTrack" ? 0 : 1,
}).then((res) => {
console.log(res);
if (res.code == 200) {
const data = res.data;
if (data.length) {
data.forEach((item, idx) => {
item.idx = idx;
});
this.resultList = data;
}
EventBus.$emit("uiMap.replay.drawLocation", data);
this.isSearching = false;
}
});
},
exportExcel() {
if (!this.resultList.length) {
this.$message({
type: "info",
message: "数据为空,不能下载",
});
} else {
let arr = [];
this.resultList.forEach((item) => {
item.address = item.transferAddress;
arr.push(item);
});
exportExcel(
"/devicemonitor/monitor/exportstaypoint",
{
sn: this.sn,
vin: this.standno,
name: this.name,
locationType: this.form.replayType == "RtTrack" ? 0 : 1,
expData: encodeURI(JSON.stringify(arr)),
},
"post"
);
}
},
sortByTime() {
let sortArr = this.resultList.sort((a, b) => {
return moment(a.begintime).isBefore(moment(b.begintime))
? this.sortByTimeIsPositive
? -1
: 1
: this.sortByTimeIsPositive
? 1
: -1;
});
this.sortByTimeIsPositive = !this.sortByTimeIsPositive;
this.resultList = [].concat(sortArr);
},
sortByStay() {
let sortArr = this.resultList.sort((a, b) => {
let aTime =
new Date(a.endtime).getTime() - new Date(a.begintime).getTime();
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.resultList = [].concat(sortArr);
},
openMapInfoWindow(idx) {
EventBus.$emit("uiMap.replay.openInfoWindow", idx);
},
drawPoi() {
let _this = this;
BUSINESS_SERVICE.getPOI({ sn: _this.sn }).then((res) => {
console.log("666666666666");
console.log(res);
if (res.returnCode === "0") {
if (res.data && res.data.length) {
res.data.forEach((item) => {
let marker = mapService.createPOIMarker(
mapService.getLngLat(item.lng, item.lat),
this.mapObj
);
let infoWindow = mapService.bindPOIInfoWindow(
marker,
this.mapObj,
item
);
});
}
}
});
},
drawFence() {
MONITOR_SERVICE.getSingleFence({
sn: this.sn,
fenceId: parseInt(this.fenceId),
}).then((res) => {
if (res.returnCode == 0) {
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);
getHistoryLocation(){ }
this.resultList = []; }
MONITOR_SERVICE.getHistoryLocation({ }
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',// });
endTime: moment(this.form.dateRange[1]).endOf('day').format('YYYY-MM-DD HH:mm:ss'),//'2019-10-27 09:56:45',// },
times: '0', drawDistrict(areaCode) {
locationType: this.form.replayType == 'RtTrack' ? 0 : 1 this._drawDistrictTimeoutId && clearTimeout(this._drawDistrictTimeoutId);
}).then((res)=>{
console.log(res) this._drawDistrictTimeoutId = setTimeout(() => {
if(res.code == 200){ EventBus.$emit("uiMap.fence.drawDistrict", areaCode);
const data = res.data; }, 500);
if(data.length){ },
data.forEach((item, idx)=>{ drawPolygon(path) {
item.idx = idx; EventBus.$emit("uiMap.fence.drawPolygon", {
}); path,
this.resultList = data; isEdit: false,
});
} },
EventBus.$emit('uiMap.replay.drawLocation', data);
this.isSearching = false; // 获取围栏信息-并画围栏
} getFence() {
}); MONITOR_SERVICE.getFenceInfo({
}, sn: this.sn,
exportExcel(){ }).then((res) => {
if(!this.resultList.length){ console.log(res);
this.$message({ let list = res.data || [];
type: 'info', if (res.code != 200) {
message: '数据为空,不能下载' return false;
}); // const data = res.data || [];
}else{ // if (data) {
let arr = []; // if (data.shapeType === 2) {
this.resultList.forEach((item)=>{ // EventBus.$emit("uiMap.fence.createFenceCircle", {
item.address = item.transferAddress; // lng: data.lng,
arr.push(item); // lat: data.lat,
}); // radius: data.radius,
// isEdit: false,
exportExcel('/devicemonitor/monitor/exportstaypoint', { // });
sn: this.sn, // } else if (data.shapeType === 3) {
vin: this.standno, // this.drawDistrict(data.areaCode);
name: this.name, // } else if (data.shapeType === 5) {
locationType: this.form.replayType == 'RtTrack' ? 0 : 1, // if (data.lnglat) {
expData: encodeURI(JSON.stringify(arr)) // let polygonPath = data.lnglat.split("|").map((item) => {
}, 'post'); // return [item.split(",")[0], item.split(",")[1]];
} // });
}, // this.drawPolygon(polygonPath);
sortByTime(){ // }
let sortArr = this.resultList.sort((a,b)=>{ // }
return moment(a.begintime).isBefore(moment(b.begintime))?(this.sortByTimeIsPositive?-1:1):(this.sortByTimeIsPositive?1:-1); // }
}); }
this.sortByTimeIsPositive = !this.sortByTimeIsPositive;
this.resultList = [].concat(sortArr);
},
sortByStay(){
let sortArr = this.resultList.sort((a,b)=>{
let aTime = (new Date(a.endtime)).getTime() - (new Date(a.begintime)).getTime();
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.resultList = [].concat(sortArr);
},
openMapInfoWindow(idx){
EventBus.$emit('uiMap.replay.openInfoWindow', idx)
},
drawPoi(){
BUSINESS_SERVICE.getPOI({
sn: this.sn
}).then((res)=>{
if(res.returnCode === '0'){
if(res.data && res.data.length){
res.data.forEach((item)=>{
let marker = mapService.createPOIMarker(mapService.getLngLat(item.lng, item.lat), this.mapObj)
let infoWindow = mapService.bindPOIInfoWindow(marker, this.mapObj, item)
})
}
}
})
},
drawFence(){
MONITOR_SERVICE.getSingleFence({
sn: this.sn,
fenceId: parseInt(this.fenceId)
}).then((res)=>{
if(res.returnCode == 0){
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)
}
}
}
}
});
},
drawDistrict(areaCode){
this._drawDistrictTimeoutId && clearTimeout(this._drawDistrictTimeoutId);
this._drawDistrictTimeoutId = setTimeout(()=>{ // 循环画围栏
EventBus.$emit('uiMap.fence.drawDistrict', areaCode); list.map((k) => {
}, 500); // 圆形围栏
}, if (k.shapeType == 1) {
drawPolygon(path){ EventBus.$emit("uiMap.fence.createFenceCircle", {
EventBus.$emit('uiMap.fence.drawPolygon', { lng: k.lnglat.split(",")[0],
path, lat: k.lnglat.split(",")[1],
isEdit: false radius: k.radius,
}) isEdit: false,
} });
}, }
created () {
if(window.AMap){
this.initMap();
}else{
remoteLoad(`${CONSTANT.AMAP_URL}`).then(()=>{
remoteLoad(`https://webapi.amap.com/ui/1.0/main.js?v=1.0.11`).then(()=>{
this.initMap();
})
})
}
//轨迹播放当前位置地址显示 // 多边形围栏
EventBus.$on('uiMap.replay.currAddress', (adr)=>{ if (k.shapeType == 3) {
this.replayAddr = adr; let polygonPath = k.lnglat.split("|").map((item) => {
}); return [item.split(",")[0], item.split(",")[1]];
});
this.drawPolygon(polygonPath);
}
});
});
},
},
created() {
if (window.AMap) {
this.initMap();
} else {
remoteLoad(`${CONSTANT.AMAP_URL}`).then(() => {
remoteLoad(`https://webapi.amap.com/ui/1.0/main.js?v=1.0.11`).then(
() => {
this.initMap();
}
);
});
}
//轨迹初始化完成 //轨迹播放当前位置地址显示
EventBus.$on('uiMap.replay.initDone', ()=>{ EventBus.$on("uiMap.replay.currAddress", (adr) => {
this.replayIniting = false; this.replayAddr = adr;
this.replayIng = true; });
});
//轨迹播放结束 //轨迹初始化完成
EventBus.$on('uiMap.replay.done', ()=>{ EventBus.$on("uiMap.replay.initDone", () => {
this.replayIng = false; this.replayIniting = false;
this.$alert(`<p>开始时间: ${this.replayData[0].dateTime}</p><p>结束时间: ${this.replayData[this.replayData.length-1].dateTime}</p>`, '轨迹播放完成', { this.replayIng = true;
type: 'success', });
confirmButtonText: '确定',
dangerouslyUseHTMLString: true
});
});
//轨迹解析结束 //轨迹播放结束
EventBus.$on('uiMap.replay.transferAdrDone', ()=>{ EventBus.$on("uiMap.replay.done", () => {
if(this.exporting){ this.replayIng = false;
this.exportCsv(); this.$alert(
} `<p>开始时间: ${this.replayData[0].dateTime}</p><p>结束时间: ${
}); this.replayData[this.replayData.length - 1].dateTime
}</p>`,
"轨迹播放完成",
{
type: "success",
confirmButtonText: "确定",
dangerouslyUseHTMLString: true,
}
);
});
EventBus.$on('uiMap.historyLocation.transferSuccess', (data)=>{ //轨迹解析结束
this.resultList = [].concat(data); EventBus.$on("uiMap.replay.transferAdrDone", () => {
}); if (this.exporting) {
this.exportCsv();
}
});
EventBus.$on('uiMap.replay.replayIng', (data)=>{ EventBus.$on("uiMap.historyLocation.transferSuccess", (data) => {
this.replayIng = data; this.resultList = [].concat(data);
}); });
},
beforeDestroy(){
}, EventBus.$on("uiMap.replay.replayIng", (data) => {
components: { this.replayIng = data;
MapControll });
} },
} beforeDestroy() {},
components: {
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!