Commit 5e859902 by zhangxw

v1.7.0版本

1 parent 19f9bdf0
...@@ -160,4 +160,13 @@ export const GET_MONITOR_ONLINELIST = params => { ...@@ -160,4 +160,13 @@ export const GET_MONITOR_ONLINELIST = params => {
// 获取高德地图的省市区 // 获取高德地图的省市区
export const GET_AMAP_PROVINCE = params => { export const GET_AMAP_PROVINCE = params => {
return request(params, 'https://restapi.amap.com/v3/config/district', 'get') return request(params, 'https://restapi.amap.com/v3/config/district', 'get')
}
// 历史停留列表
export const GET_HISTORY_LOCATION = params => {
return request(params, '/trialdrive/monitor/stayPointList', 'get')
}
// 常驻地数据
export const GET_RESIDENT_LOCATION = params => {
return request(params, '/trialdrive/monitor/residentList', 'get')
} }
\ No newline at end of file \ No newline at end of file
...@@ -16,6 +16,9 @@ ...@@ -16,6 +16,9 @@
margin-left: 20px; margin-left: 20px;
} }
} }
.map-controll.toleft{
left: 150px;
}
.map-bottom-controll { .map-bottom-controll {
position: absolute; position: absolute;
...@@ -34,7 +37,11 @@ ...@@ -34,7 +37,11 @@
font-size: 16px; font-size: 16px;
} }
} }
.map-bottom-controll.toleft{
left: 20px;
right: calc(100% - 55px);
bottom: 50px;
}
.controll-wrap { .controll-wrap {
position: absolute; position: absolute;
top: 40px; top: 40px;
...@@ -44,6 +51,15 @@ ...@@ -44,6 +51,15 @@
max-height: 716px; max-height: 716px;
} }
.controll-warp-floright {
position: absolute;
top: 40px;
right: 20px;
z-index: 101;
width: 320px;
max-height: 716px;
}
.menu-search { .menu-search {
.el-select { .el-select {
width: 100px; width: 100px;
...@@ -461,7 +477,7 @@ ...@@ -461,7 +477,7 @@
} }
} }
a.fence_btn_grey { a.fence_btn_grey,a.history_btn_grey,a.resident_btn_grey {
border: 1px solid #d8d8d8; border: 1px solid #d8d8d8;
color: #999; color: #999;
background: #f2f2f2; background: #f2f2f2;
......
import moment from '@/common/moment';
// 轨迹回放
export const replayShortcuts = [
{
text: "近6小时",
onClick(picker) {
const start = moment().subtract(6, 'hours');
const end = moment();
picker.$emit("pick", [start, end]);
}
},
{
text: "近3天",
onClick(picker) {
const start = moment().subtract(3, 'days');
const end = moment();
picker.$emit("pick", [start, end]);
},
},
{
text: "近7天",
onClick(picker) {
const start = moment().subtract(7, 'days');
const end = moment();
picker.$emit("pick", [start, end]);
},
},
{
text: "近15天",
onClick(picker) {
const start = moment().subtract(15, 'days');
const end = moment();
picker.$emit("pick", [start, end]);
},
}
]
// 历史停留
export const historyShortcuts = [
{
text: "前7天",
onClick(picker) {
const end = moment().subtract(1, 'days');
const start = moment().subtract(7, 'days');
picker.$emit("pick", [start, end]);
}
},
{
text: "前15天",
onClick(picker) {
const end = moment().subtract(1, 'days');
const start = moment().subtract(15, 'days');
picker.$emit("pick", [start, end]);
},
},
{
text: "前30天",
onClick(picker) {
const end = moment().subtract(1, 'days');
const start = moment().subtract(30, 'days');
picker.$emit("pick", [start, end]);
},
}
]
import moment from 'moment';
// 设置moment的语言环境配置
moment.locale('zh-cn', {
week: {
dow: 1,
doy: 4
}
})
export default moment
\ No newline at end of file \ No newline at end of file
<template> <template>
<div> <div :class="isNewWindowOpenPage ? 'full_wrap_layout' : ''">
<!-- <v-breadcrumb> <!-- <v-breadcrumb>
<slot name="breadcrumb"></slot> <slot name="breadcrumb"></slot>
</v-breadcrumb> --> </v-breadcrumb> -->
...@@ -12,9 +12,17 @@ ...@@ -12,9 +12,17 @@
// import vBreadcrumb from 'components/Breadcrumb.vue' // import vBreadcrumb from 'components/Breadcrumb.vue'
export default { export default {
data () {
return {
isNewWindowOpenPage: false
}
},
components: { components: {
// vBreadcrumb // vBreadcrumb
}, },
created() {
if(window.opener) this.isNewWindowOpenPage = true
}
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
......
<template> <template>
<div> <div>
<div class="map-controll"> <div :class="isTreeToright ? 'map-controll toleft' : 'map-controll'">
<el-button-group> <el-button-group>
<el-button :type="isRuler?'primary':''" size="mini" @click="toggleRuler">测距</el-button> <el-button :type="isRuler?'primary':''" size="mini" @click="toggleRuler">测距</el-button>
<el-button :type="isMapType?'primary':''" size="mini" @click="toggleMap(true)">地图</el-button> <el-button :type="isMapType?'primary':''" size="mini" @click="toggleMap(true)">地图</el-button>
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
</el-button-group> </el-button-group>
<!-- <el-button v-show="isShowFullsize" size="mini" class="fullsize-btn" :type="isFullsize?'primary':''" @click="toggleSize">全屏</el-button> --> <!-- <el-button v-show="isShowFullsize" size="mini" class="fullsize-btn" :type="isFullsize?'primary':''" @click="toggleSize">全屏</el-button> -->
</div> </div>
<div class="map-bottom-controll"> <div :class="isTreeToright ? 'map-bottom-controll toleft' : 'map-bottom-controll'">
<ul> <ul>
<li class="ctrl-item" @click="zoomIn"><i class="fa fa-plus"></i></li> <li class="ctrl-item" @click="zoomIn"><i class="fa fa-plus"></i></li>
<li class="ctrl-item" @click="zoomOut"><i class="fa fa-minus"></i></li> <li class="ctrl-item" @click="zoomOut"><i class="fa fa-minus"></i></li>
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
import store from '../../vuex/store.js' import store from '../../vuex/store.js'
import mapService from 'utils/mapService.js' import mapService from 'utils/mapService.js'
export default{ export default{
props: ['isShowFullsize'], props: ['isShowFullsize', 'isTreeToright'],
data(){ data(){
return { return {
isMapType: true, isMapType: true,
......
<template> <template>
<v-full-layout class="full_wrap_layout"> <v-full-layout>
<template slot="breadcrumb"> <template slot="breadcrumb">
<el-breadcrumb-item>电子围栏</el-breadcrumb-item> <el-breadcrumb-item>电子围栏</el-breadcrumb-item>
</template> </template>
......
...@@ -14,27 +14,23 @@ ...@@ -14,27 +14,23 @@
<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
style="width: 100%;" style="width: 100%;"
v-model="form.dateRange" v-model="form.dateRange"
type="daterange" type="daterange"
size="small" size="small"
:clearable="false" :clearable="false"
:editable="false" :editable="false"
:unlink-panels="true" :unlink-panels="true"
:picker-options="{ :picker-options="pickerOptions"
disabledDate(time){ range-separator="至"
return time.getTime() > ((new Date()).getTime()-24*60*60*1000) start-placeholder="开始日期"
} end-placeholder="结束日期">
}" </el-date-picker>
range-separator="至" <!-- <div class="date-filter">
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
<div class="date-filter">
<el-button size="mini" type="text" @click="pickDate(7)">前7天</el-button> <el-button size="mini" type="text" @click="pickDate(7)">前7天</el-button>
<el-button size="mini" type="text" @click="pickDate(15)">前15天</el-button> <el-button size="mini" type="text" @click="pickDate(15)">前15天</el-button>
<el-button size="mini" type="text" @click="pickDate(30)">前30天</el-button> <el-button size="mini" type="text" @click="pickDate(30)">前30天</el-button>
</div> </div> -->
</el-form-item> </el-form-item>
<el-form-item label="查询时段" prop="timerange"> <el-form-item label="查询时段" prop="timerange">
<el-select v-model="form.timerange" placeholder="请选择" size="small" style="width: 280px"> <el-select v-model="form.timerange" placeholder="请选择" size="small" style="width: 280px">
...@@ -76,7 +72,7 @@ ...@@ -76,7 +72,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, index) in resultList" :key="index" @click="openMapInfoWindow(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>
...@@ -109,6 +105,9 @@ ...@@ -109,6 +105,9 @@
const MONITOR_SERVICE = services.monitor; const MONITOR_SERVICE = services.monitor;
import {exportExcel} from 'utils'; import {exportExcel} from 'utils';
import MapControll from './MapControll.vue' import MapControll from './MapControll.vue'
import AMapLoader from '@amap/amap-jsapi-loader'
import {historyShortcuts} from '@/common/index'
import {GET_HISTORY_LOCATION} from "@/api/services/monitor"
const BUSINESS_SERVICE = services.business; const BUSINESS_SERVICE = services.business;
export default{ export default{
...@@ -175,12 +174,26 @@ ...@@ -175,12 +174,26 @@
name: this.$route.query.name, name: this.$route.query.name,
standno: this.$route.query.standno, standno: this.$route.query.standno,
sortByTimeIsPositive: true, sortByTimeIsPositive: true,
sortByStayIsPositive: true sortByStayIsPositive: true,
pickerOptions: {
disabledDate(time){
return time.getTime() > ((new Date()).getTime()-24*60*60*1000)
},
shortcuts: historyShortcuts
}
} }
}, },
mounted(){ mounted(){
store.dispatch('setFullsize', true) // store.dispatch('setFullsize', true)
let _this = this
AMapLoader.load({
key: CONSTANT.MAP_KEY,
version: '1.4.2',
plugins: CONSTANT.MAP_PLUGINS
}).then((AMap) => {
window.AMap = AMap
_this.initMap()
})
}, },
methods: { methods: {
initMap(){ initMap(){
...@@ -212,23 +225,48 @@ ...@@ -212,23 +225,48 @@
let params = { let params = {
sn: this.sn, sn: this.sn,
sTime: moment(this.form.dateRange[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss'), startTime: moment(this.form.dateRange[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss'),
eTime: moment(this.form.dateRange[1]).endOf('day').format('YYYY-MM-DD HH:mm:ss'), endTime: moment(this.form.dateRange[1]).endOf('day').format('YYYY-MM-DD HH:mm:ss'),
times: this.form.timerange, times: this.form.timerange,
} }
if(this.form.stayMax !== ''){ if(this.form.stayMax !== ''){
params.maxtime = this.form.stayMax; params.maxTime = this.form.stayMax;
} }
if(this.form.stayMin !== ''){ if(this.form.stayMin !== ''){
params.mintime = this.form.stayMin; params.minTime = this.form.stayMin;
} }
this.params = params
EventBus.$emit('uiMap.historyLocation.destroy'); EventBus.$emit('uiMap.historyLocation.destroy');
MONITOR_SERVICE.getHistoryLocation(params).then((res)=>{ let res = mock.getResidentByRealTime
if (res.returnCode == 0) {
const data = res.data
if (data.length) {
data.forEach((item, idx) => {
item.idx = idx
})
this.resultList = data
EventBus.$emit('uiMap.historyLocation.draw', data)
this.resultBoxHidden = false
} else {
this.$message({
type: 'info',
message: '暂无数据'
})
}
this.isSearching = false
}
GET_HISTORY_LOCATION(params).then((res)=>{
if(res.returnCode == 0){ if(res.returnCode == 0){
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;
item.name = item.ownerName
item.standno = item.workOrderNo
item.begintime = item.beginTime
item.endtime = item.endTime
}); });
this.resultList = data; this.resultList = data;
...@@ -314,16 +352,25 @@ ...@@ -314,16 +352,25 @@
this.resultList = [].concat(sortArr); this.resultList = [].concat(sortArr);
}, },
exportExcel(){ exportExcel(){
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('track/exportVMData', { // exportExcel('track/exportVMData', {
vmExportType: 6, // vmExportType: 6,
jsonStr: encodeURI(JSON.stringify(arr)) // jsonStr: encodeURI(JSON.stringify(arr))
}, 'post'); // }, 'post');
if (this.resultList.length) {
exportExcel('/trialdrive/monitor/exportStayPoint', {...this.params}, 'get');
} else {
this.$message({
type: 'error',
message: '导出数据为空'
});
}
}, },
openMapInfoWindow(idx){ openMapInfoWindow(idx){
EventBus.$emit('uiMap.historyLocation.openInfoWindow', idx) EventBus.$emit('uiMap.historyLocation.openInfoWindow', idx)
...@@ -344,16 +391,16 @@ ...@@ -344,16 +391,16 @@
} }
}, },
async created () { async created () {
if(window.AMap){ // if(window.AMap){
this.initMap(); // this.initMap();
}else{ // }else{
await remoteLoad(`${CONSTANT.AMAP_URL}`).then(()=>{ // await 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.historyLocation.transferSuccess', (data)=>{ EventBus.$on('uiMap.historyLocation.transferSuccess', (data)=>{
this.resultList = [].concat(data); this.resultList = [].concat(data);
}); });
......
...@@ -6,8 +6,9 @@ ...@@ -6,8 +6,9 @@
<template slot="main"> <template slot="main">
<div class="map-wrap" v-loading="mapLoading"> <div class="map-wrap" v-loading="mapLoading">
<div id="map" class="map-container"></div> <div id="map" class="map-container"></div>
<map-controll isShowFullsize="true"></map-controll> <!-- v1.7.0版本 组织树右移 地图控件位置调整 isTreeToright-->
<div class="controll-wrap"> <map-controll isShowFullsize="true" isTreeToright="true"></map-controll>
<div class="controll-warp-floright">
<div class="menu-search"> <div class="menu-search">
<!-- <el-autocomplete <!-- <el-autocomplete
ref="autocomplete" ref="autocomplete"
...@@ -19,8 +20,8 @@ ...@@ -19,8 +20,8 @@
:trigger-on-focus="false" :trigger-on-focus="false"
:placeholder="'请输入'+['6位以上设备号','6位以上车架号','2位以上姓名'][searchType-1]" :placeholder="'请输入'+['6位以上设备号','6位以上车架号','2位以上姓名'][searchType-1]"
@select="handleSelect"> --> @select="handleSelect"> -->
<el-input placeholder="请输入对应条件值" v-model.trim="searchText" size="small" class="input-with-select" @keyup.enter.native='searchSubmit'> <el-input :placeholder="placeholderText" v-model.trim="searchText" size="small" class="input-with-select" @keyup.enter.native='searchSubmit'>
<el-select v-model="searchType" slot="prepend" placeholder="请选择" size="small"> <el-select v-model="searchType" @change="selectChange" slot="prepend" placeholder="请选择" size="small">
<el-option label="设备号" value="1"></el-option> <el-option label="设备号" value="1"></el-option>
<el-option label="车架号" value="2"></el-option> <el-option label="车架号" value="2"></el-option>
<el-option label="姓名" value="3"></el-option> <el-option label="姓名" value="3"></el-option>
...@@ -249,6 +250,7 @@ export default { ...@@ -249,6 +250,7 @@ export default {
pageSizeList: {}, pageSizeList: {},
pageSize: 10, pageSize: 10,
loadingMore: false, loadingMore: false,
placeholderText: '请输入6位以上车架号'
}; };
}, },
computed: { computed: {
...@@ -326,7 +328,22 @@ export default { ...@@ -326,7 +328,22 @@ export default {
this.isTreeChecked = checked; this.isTreeChecked = checked;
//this.expandedKeys = []; //this.expandedKeys = [];
}, },
// 切换查询类型
selectChange(data) {
let tex = ''
switch(data) {
case '1':
tex = '请输入4位以上设备号'
break
case '2':
tex = '请输入6位以上车架号'
break
case '3':
tex = '请输入1位以上汉字'
break
}
this.placeholderText = tex
},
// 勾选树 // 勾选树
handleCheck(data, node) { handleCheck(data, node) {
let list = this.monitorList.itemArr; let list = this.monitorList.itemArr;
......
<template> <template>
<v-full-layout class="full_wrap_layout"> <v-full-layout>
<template slot="breadcrumb"> <template slot="breadcrumb">
<el-breadcrumb-item>车辆监控</el-breadcrumb-item> <el-breadcrumb-item>车辆监控</el-breadcrumb-item>
</template> </template>
...@@ -13,17 +13,15 @@ ...@@ -13,17 +13,15 @@
<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 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="{ <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="pickerOptions" end-placeholder="结束日期">
disabledDate(time){
return time.getTime() > (new Date()).getTime()
}
}" 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(7)">近7天</el-button>
<el-button size="mini" type="text" @click="pickDate(15)">近15天</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="播放速度">
...@@ -98,6 +96,7 @@ import { exportExcel } from "utils"; ...@@ -98,6 +96,7 @@ 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";
import {replayShortcuts} from '@/common/index'
import { GET_ELECFENCE_INFO } from "@/api/services/fence"; import { GET_ELECFENCE_INFO } from "@/api/services/fence";
export default { export default {
...@@ -117,8 +116,8 @@ export default { ...@@ -117,8 +116,8 @@ export default {
max = moment(max); max = moment(max);
} }
if (min.isBefore(moment(max).subtract(90, "days"), "minute")) { if (min.isBefore(moment(max).subtract(30, "days"), "minute")) {
cb(new Error("日期范围不能超过90天")); cb(new Error("日期范围不能超过30天"));
} }
} }
cb(); cb();
...@@ -194,6 +193,12 @@ export default { ...@@ -194,6 +193,12 @@ export default {
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,
pickerOptions: {
disabledDate(time){
return time.getTime() > (new Date()).getTime()
},
shortcuts: replayShortcuts
}
}; };
}, },
mounted() { mounted() {
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
</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, index) in resultList" :key="index" @click="openMapInfoWindow(item.idx)">
<p class="addr">{{item.transferAddress}}</p> <p class="addr">{{item.transferAddress}}</p>
<p class="datetime">驻留次数:<span>{{item.totalTimes}}次</span> | 驻留时长:<span>{{item.totalDurationString}}</span></p> <p class="datetime">驻留次数:<span>{{item.totalTimes}}次</span> | 驻留时长:<span>{{item.totalDurationString}}</span></p>
</li> </li>
...@@ -74,13 +74,15 @@ ...@@ -74,13 +74,15 @@
import InfiniteLoading from 'vue-infinite-loading'; import InfiniteLoading from 'vue-infinite-loading';
import {exportExcel} from 'utils'; import {exportExcel} from 'utils';
import MapControll from './MapControll.vue' import MapControll from './MapControll.vue'
import AMapLoader from '@amap/amap-jsapi-loader'
import {GET_RESIDENT_LOCATION} from "@/api/services/monitor"
export default{ export default{
data(){ data(){
return { return {
sn: this.$route.query.sn, sn: this.$route.query.sn,
name: this.$route.query.name, name: this.$route.query.name,
standno: this.$route.query.standno, standno: this.$route.query.standno,
locationType: this.$route.query.locationType,
AMap: null, AMap: null,
mapObj: null, mapObj: null,
mapLoading: false, mapLoading: false,
...@@ -103,7 +105,16 @@ ...@@ -103,7 +105,16 @@
} }
}, },
mounted(){ mounted(){
store.dispatch('setFullsize', true) // store.dispatch('setFullsize', true)
let _this = this
AMapLoader.load({
key: CONSTANT.MAP_KEY,
version: '1.4.2',
plugins: CONSTANT.MAP_PLUGINS
}).then((AMap) => {
window.AMap = AMap
_this.initMap()
})
}, },
methods: { methods: {
...@@ -137,15 +148,38 @@ ...@@ -137,15 +148,38 @@
let params = { let params = {
sn: this.sn, sn: this.sn,
timeRange: this.form.daterange, timeRange: this.form.daterange,
times: this.form.timerange, locationType: this.locationType === 'bsLocation' ? 2 : this.locationType === 'gpsLocation' ? 1 : ''
// times: this.form.timerange,
} }
this.params = params
MONITOR_SERVICE.getResidentByRealTime(params).then((res)=>{ let res = mock.getResidentByRealTime
if(res.returnCode == 0){
const data = res.data;
if(data.length){
data.forEach((item, idx)=>{
item.idx = idx;
});
this.resultList = data;
EventBus.$emit('uiMap.resident.draw', data);
this.resultBoxHidden = false;
}else{
this.$message({
type: 'info',
message: '暂无数据'
});
EventBus.$emit('uiMap.resident.destroy', data);
}
this.isSearching = false;
}
GET_RESIDENT_LOCATION(params).then((res)=>{
if(res.returnCode == 0){ if(res.returnCode == 0){
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;
item.name = item.ownerName
item.standNo = item.workOrderNo
}); });
this.resultList = data; this.resultList = data;
EventBus.$emit('uiMap.resident.draw', data); EventBus.$emit('uiMap.resident.draw', data);
...@@ -217,42 +251,43 @@ ...@@ -217,42 +251,43 @@
exportExcel(){ exportExcel(){
if(this.exporting) return; if(this.exporting) return;
if(this.resultList.length){ if(this.resultList.length){
let paramArr = []; // let paramArr = [];
this.resultList.forEach((dataItem)=>{ // this.resultList.forEach((dataItem)=>{
let paramItem = {}; // let paramItem = {};
for(let key in dataItem){ // for(let key in dataItem){
switch(key){ // switch(key){
case 'name': // case 'name':
case 'shopName': // case 'shopName':
case 'sn': // case 'sn':
case 'sqbh': // case 'sqbh':
case 'standNo': // case 'standNo':
case 'totalDurationString': // case 'totalDurationString':
case 'transferAddress': // case 'transferAddress':
paramItem[key] = dataItem[key]?dataItem[key]:''; // paramItem[key] = dataItem[key]?dataItem[key]:'';
break; // break;
case 'totalTimes': // case 'totalTimes':
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;*/
} // }
} // }
paramArr.push(paramItem); // paramArr.push(paramItem);
}); // });
exportExcel('track/exportVMData', { // exportExcel('track/exportVMData', {
jsonStr: encodeURI(JSON.stringify(paramArr)), // jsonStr: encodeURI(JSON.stringify(paramArr)),
vmExportType: 4 // vmExportType: 4
}, 'post'); // }, 'post');
this.exporting = false; exportExcel('/trialdrive/monitor/exportResident', {...this.params}, 'get');
}else{ this.exporting = false;
this.$message({ }else{
type: 'error', this.$message({
message: '导出数据为空' type: 'error',
}); message: '导出数据为空'
} });
}
}, },
openMapInfoWindow(idx){ openMapInfoWindow(idx){
EventBus.$emit('uiMap.resident.openInfoWindow', idx) EventBus.$emit('uiMap.resident.openInfoWindow', idx)
...@@ -273,16 +308,16 @@ ...@@ -273,16 +308,16 @@
} }
}, },
async created () { async created () {
if(window.AMap){ // if(window.AMap){
this.initMap(); // this.initMap();
}else{ // }else{
await remoteLoad(`${CONSTANT.AMAP_URL}`).then(()=>{ // await 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.historyLocation.transferSuccess', (data)=>{ EventBus.$on('uiMap.historyLocation.transferSuccess', (data)=>{
......
...@@ -392,20 +392,30 @@ MapService.prototype = { ...@@ -392,20 +392,30 @@ MapService.prototype = {
} }
// 通用参数 // 通用参数
let queryCode = `sn=${info.sn}&name=${encodeURI(info.name)}&standno=${info.standNo}`; let queryCode = `sn=${info.sn}&name=${encodeURI(info.name)}&standno=${info.standNo}&locationType=${info.eLocateType}`;
// 跳转到历史停留页面 // 跳转到历史停留页面 无线设备不能跳转历史停留 isSource:1有线,其他无线
let historyBtn = infoDiv.querySelector('[data-history]'); let historyBtn = infoDiv.querySelector('[data-history]');
if (historyBtn) { if (historyBtn) {
if (info.isSource != 1) {
historyBtn.classList.add('history_btn_grey');
}
historyBtn.onclick = function () { historyBtn.onclick = function () {
mapService.openPage(`#/monitor/historyLocation?${queryCode}`) if (info.isSource == 1) {
mapService.openPage(`#/monitor/historyLocation?${queryCode}`)
}
} }
} }
// 跳转到常住地 // 跳转到常住地 无线设备不能跳转常住地 isSource:1有线,其他无线
let residentBtn = infoDiv.querySelector('[data-resident]'); let residentBtn = infoDiv.querySelector('[data-resident]');
if (residentBtn) { if (residentBtn) {
if (info.isSource != 1) {
residentBtn.classList.add('resident_btn_grey');
}
residentBtn.onclick = function () { residentBtn.onclick = function () {
mapService.openPage(`#/monitor/resident?${queryCode}`) if (info.isSource == 1) {
mapService.openPage(`#/monitor/resident?${queryCode}`)
}
} }
} }
...@@ -419,7 +429,6 @@ MapService.prototype = { ...@@ -419,7 +429,6 @@ MapService.prototype = {
// 跳转到电子围栏页面 无线设备不能跳转电子围栏 isSource:1有线,其他无线 // 跳转到电子围栏页面 无线设备不能跳转电子围栏 isSource:1有线,其他无线
let fenceBtn = infoDiv.querySelector('[data-fence]'); let fenceBtn = infoDiv.querySelector('[data-fence]');
if (fenceBtn) { if (fenceBtn) {
if (info.isSource != 1) { if (info.isSource != 1) {
fenceBtn.classList.add('fence_btn_grey'); fenceBtn.classList.add('fence_btn_grey');
...@@ -623,6 +632,8 @@ MapService.prototype = { ...@@ -623,6 +632,8 @@ MapService.prototype = {
<p class="redirect-row"> <p class="redirect-row">
<a class="redirect-btn" id="btn_replay" data-replay>轨迹回放</a> <a class="redirect-btn" id="btn_replay" data-replay>轨迹回放</a>
<a class="redirect-btn" id="btn_fence" data-fence>电子围栏</a> <a class="redirect-btn" id="btn_fence" data-fence>电子围栏</a>
<a class="redirect-btn" id="btn_resident" data-resident>常驻地</a>
<a class="redirect-btn" id="btn_history" data-history>历史停留</a>
</p> </p>
</div>`; </div>`;
......
...@@ -80,7 +80,7 @@ const replay = { ...@@ -80,7 +80,7 @@ const replay = {
} }
}); });
replay.dis = AMap.GeometryUtil.distanceOfLine(replayData) / 1000 // 算出轨迹的距离(km)
replay.pathSimplifierIns.setData([{ replay.pathSimplifierIns.setData([{
path: replayData path: replayData
}]); }]);
...@@ -90,7 +90,7 @@ const replay = { ...@@ -90,7 +90,7 @@ const replay = {
replay.navg = replay.pathSimplifierIns.createPathNavigator(0, //关联第1条轨迹 replay.navg = replay.pathSimplifierIns.createPathNavigator(0, //关联第1条轨迹
{ {
loop: false, //循环播放 loop: false, //循环播放
speed: replay.getSpeed(replay.speed), speed: replay.getSpeed(replay.speed, replay.dis),
pathNavigatorStyle: { pathNavigatorStyle: {
width: 36, width: 36,
height: 22, height: 22,
...@@ -222,7 +222,7 @@ const replay = { ...@@ -222,7 +222,7 @@ const replay = {
//播放轨迹,速度改变 //播放轨迹,速度改变
EventBus.$on('uiMap.replay.speedChange', function(data){ EventBus.$on('uiMap.replay.speedChange', function(data){
let speed = replay.getSpeed(data) let speed = replay.getSpeed(data, replay.dis)
if(replay.navg){ if(replay.navg){
replay.navg.setSpeed(speed) replay.navg.setSpeed(speed)
...@@ -277,20 +277,24 @@ const replay = { ...@@ -277,20 +277,24 @@ const replay = {
//mapService.setFitView(MAP); //mapService.setFitView(MAP);
}, },
getSpeed(idx){ getSpeed(idx, dis){ // 根据路径距离和回放时间 算出回放的speed
let speed; let speed;
switch(idx){ switch(idx){
case 1: case 1:
speed = 2000; // speed = 2000
speed = dis >= 100 ? Math.floor((dis / 30) * 3600) : dis > 10 && dis < 100 ? Math.floor((dis / 20) * 3600) : Math.floor((dis / 12) * 3600);
break; break;
case 2: case 2:
speed = 5000; // speed = 5000;
speed = dis >= 100 ? Math.floor((dis / 20) * 3600) : dis > 10 && dis < 100 ? Math.floor((dis / 12) * 3600) : Math.floor((dis / 8) * 3600);
break; break;
case 3: case 3:
speed = 10000; // speed = 10000;
speed = dis >= 100 ? Math.floor((dis / 5) * 3600) : dis > 10 && dis < 100 ? Math.floor((dis / 3) * 3600) : Math.floor((dis / 2) * 3600);
break; break;
default: default:
speed = 500; // speed = 500;
speed = dis >= 100 ? Math.floor((dis / 40) * 3600) : dis > 10 && dis < 100 ? Math.floor((dis / 30) * 3600) : Math.floor((dis / 16) * 3600);
break; break;
} }
return speed; return speed;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!