Commit be817f0f by 胡悦

Merge branch 'v1.5.0' into 'develop'

V1.5.0版本需求合并到develop

See merge request !1
2 parents a87406a3 f7b29813
...@@ -172,6 +172,7 @@ module.exports = { ...@@ -172,6 +172,7 @@ module.exports = {
'scss': path.resolve(__dirname, '../src/assets/SCSS'), 'scss': path.resolve(__dirname, '../src/assets/SCSS'),
'images': path.resolve(__dirname, '../src/assets/images'), 'images': path.resolve(__dirname, '../src/assets/images'),
'./patterns': path.resolve(__dirname, '../src/assets/images'), './patterns': path.resolve(__dirname, '../src/assets/images'),
'@':path.resolve(__dirname,'../src')
}, },
extensions: ['*', '.js', '.vue', '.json'] extensions: ['*', '.js', '.vue', '.json']
}, },
......
...@@ -5,7 +5,7 @@ import store from '../vuex/store' ...@@ -5,7 +5,7 @@ import store from '../vuex/store'
import { checkStatus, showLoading } from './checkStatus'; import { checkStatus, showLoading } from './checkStatus';
const instance = axios.create({ // 创建axios实例,在这里可以设置请求的默认配置 const instance = axios.create({ // 创建axios实例,在这里可以设置请求的默认配置
timeout: 60000, // 设置超时时间60s timeout: 6*60000, // 设置超时时间60s
retry: 3, retry: 3,
retryDelay: 1000 retryDelay: 1000
}) })
......
...@@ -59,6 +59,7 @@ export default { ...@@ -59,6 +59,7 @@ export default {
return request(params, '/trialdrive/fence/getBySn') return request(params, '/trialdrive/fence/getBySn')
}, },
// 旧虎哥 // 旧虎哥
/*车辆监控*/ /*车辆监控*/
// getCriteriaTreeList (request = {}) { // getCriteriaTreeList (request = {}) {
...@@ -136,3 +137,8 @@ export default { ...@@ -136,3 +137,8 @@ export default {
// return api.get('ecFence/getFenceSnsList', request) // return api.get('ecFence/getFenceSnsList', request)
// }, // },
} }
// 根据SN获取设备列表信息
export const GET_DEVICEINFO_BYSNS = params => {
return request(params, '/trialdrive/monitor/vehiclelocation')
}
...@@ -4,26 +4,57 @@ ...@@ -4,26 +4,57 @@
<el-breadcrumb-item>激活位置</el-breadcrumb-item> <el-breadcrumb-item>激活位置</el-breadcrumb-item>
</template> </template>
<template slot="main"> <template slot="main">
<div class="device_list" v-if="deviceList && deviceList.length>1">
<div class="title">
<span>设备列表({{deviceList.length}})</span>
<!-- <i class="el-icon-close i_close"></i> -->
</div>
<div class="list_box">
<div class="cell" v-for="(item,index) in deviceList" :key="index" @click="openMapInfoWindow(item.sn, item.vin)">
<div class="top">
<i class="i_circle" :class="item.status == 2?'i_red':''"></i>
<span>{{item.ownerName||''}}</span>
<span>{{item.sn||''}}({{statusList[item.source]}})</span>
</div>
<div class="bottom">
<span>车架号:</span>
<span>{{item.vin||''}}</span>
</div>
</div>
</div>
<div class="device_footer">
<i class="i_circle"></i>
<span>在线</span>
<i class="i_circle i_red"></i>
<span>离线</span>
</div>
</div>
<div id="map" class="map-container"></div> <div id="map" class="map-container"></div>
</template> </template>
</v-full-layout> </v-full-layout>
</template> </template>
<script> <script>
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 remoteLoad from "utils/remoteLoad.js"; import remoteLoad from "@/utils/remoteLoad.js";
import {CONSTANT} from '../../constant' import { CONSTANT } from "@/constant";
import { GET_DEVICEINFO_BYSNS } from "@/api/services/monitor.js";
export default { export default {
data() { data() {
return { return {
AMap: null, AMap: null,
mapObj: null, mapObj: null,
checkLoadedTimeoutId: "", checkLoadedTimeoutId: "",
deviceList: [],
statusList: {
1: "有线",
0: "无线",
},
}; };
}, },
created() { created() {
console.log(history.state) console.log(history.state);
if (window.AMap) { if (window.AMap) {
this.initMap(); this.initMap();
} else { } else {
...@@ -52,12 +83,28 @@ export default { ...@@ -52,12 +83,28 @@ export default {
window.AMap = AMap; window.AMap = AMap;
this.mapObj = mapService.init("map"); this.mapObj = mapService.init("map");
this.isInitMap = true; this.isInitMap = true;
let query = this.$route.query;
let o = history.state; let o = history.state;
console.log(o)
// 假性离线报警查看位置点
if (query.sns) {
this.getLocation(query.sns);
return false;
}
// 兼容其他页面的跳转
if(query && query.sn){
query.elat = query.lat
query.elng = query.lng
this.addLocation(query,true);
return false;
}
console.log(o);
if (o.lng || o.bsLng) { if (o.lng || o.bsLng) {
o.elat = o.lat; o.elat = o.lat;
o.elng = o.lng; o.elng = o.lng;
this.addLocation(o); this.addLocation(o,true);
} }
} else { } else {
this.checkLoadedTimeoutId = check(); this.checkLoadedTimeoutId = check();
...@@ -68,13 +115,78 @@ export default { ...@@ -68,13 +115,78 @@ export default {
}, },
// 添加位置点 // 添加位置点
addLocation(row) { addLocation(row, showInfoWindow) {
let drawData = row; let drawData = row;
EventBus.$emit("uiMap.monitor.drawMaker", drawData, true); EventBus.$emit("uiMap.monitor.drawMaker", drawData, showInfoWindow);
},
// 获取位置点
getLocation(sns) {
let oParams = {};
oParams.sns = sns;
oParams.deviceCode = "gps";
GET_DEVICEINFO_BYSNS(oParams).then((res) => {
let list = res.data || [];
// 循环标记车辆
list.map((k) => {
let o = this.getMapInfo(k);
if (o.lng || o.bsLng) {
o.elat = o.lat;
o.elng = o.lng;
this.addLocation(o, false);
}
});
if (list[0]) {
this.openMapInfoWindow(list[0].sn, list[0].vin);
}
this.deviceList = list;
});
},
// 获取地图数据
getMapInfo(row) {
let gpsInfo = row.gpsLocation || {};
let bsInfo = row.bsLocation || {};
let oParams = {};
oParams.sn = row.sn || "";
//oParams.gpsData
oParams.name = row.ownerName || "";
oParams.standNo = row.vin || "";
oParams.source = row.source || "";
// gps 信息
oParams.lng = gpsInfo.elng;
oParams.lat = gpsInfo.elat;
oParams.address = gpsInfo.address || "";
oParams.time = gpsInfo.dateTime || "";
//基站信息
oParams.bsLng = bsInfo.elng;
oParams.bsLat = bsInfo.elat;
oParams.bsAddress = bsInfo.address || "";
oParams.bsTime = bsInfo.dateTime || "";
// 定位类型
oParams.type = 2;
return oParams;
},
// 打开车辆弹框
openMapInfoWindow(sn, vin) {
EventBus.$emit("uiMap.monitor.openInfoWindow", `${sn}-${vin}`);
}, },
}, },
}; };
</script> </script>
<style lang="scss">
.full-width .main-wrap.full-width {
left: 0;
width: 100%;
}
</style>
<style lang="scss" scoped> <style lang="scss" scoped>
.active_location { .active_location {
.full-width { .full-width {
...@@ -94,6 +206,94 @@ export default { ...@@ -94,6 +206,94 @@ export default {
bottom: 0; bottom: 0;
overflow: hidden; overflow: hidden;
} }
.device_list {
position: absolute;
top: 16px;
left: 16px;
width: 260px;
height: 300px;
background: #fff;
border-radius: 4px;
z-index: 101;
display: flex;
flex-direction: column;
border: 1px solid #f2f2f2;
.title {
position: relative;
text-align: center;
height: 36px;
line-height: 36px;
border-bottom: 1px solid #f2f2f2;
span {
font-weight: bold;
}
.i_close {
position: absolute;
right: 10px;
top: 50%;
transform: translateY(-50%);
font-size: 16px;
cursor: pointer;
}
.i_close:hover {
color: #f00;
}
}
.list_box {
flex: 1;
padding: 10px 0;
.cell {
position: relative;
padding: 4px 10px;
line-height: 2;
cursor: pointer;
.bottom {
padding-left: 12px;
}
}
.cell:hover {
background: #f2f2f2;
}
.cell:after {
position: absolute;
display: block;
content: "";
height: 1px;
left: 0;
right: 0;
bottom: 0;
background: #f2f2f2;
}
}
.device_footer {
height: 30px;
line-height: 30px;
border-top: 1px solid #f2f2f2;
padding: 0 10px;
display: flex;
align-items: center;
span {
position: relative;
font-size: 12px;
color: #333;
margin: 0 10px 0 0;
}
.i_circle {
margin: 0 4px 0 0;
}
}
}
} }
} }
.i_circle {
display: inline-block;
width: 8px;
height: 8px;
border-radius: 100%;
background: #09bf99;
}
.i_red {
background: #f00;
}
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -75,8 +75,9 @@ ...@@ -75,8 +75,9 @@
</div> </div>
</div> </div>
<div class="filter-dialog animated " :class="listDialogHidden?'fadeOut':'active fadeIn'"> <div class="filter-dialog animated " :class="listDialogHidden?'fadeOut':'active fadeIn'">
<div class="filter-dialog-header"> <div class="filter-dialog-header monitor_dialog_header">
监控列表({{monitorList.count}})
<span>监控列表({{monitorList.count}})</span>
<i class="el-icon-close pull-right" @click.stop="listDialogHidden=true"></i> <i class="el-icon-close pull-right" @click.stop="listDialogHidden=true"></i>
</div> </div>
<div class="filter-dialog-body"> <div class="filter-dialog-body">
...@@ -139,13 +140,14 @@ ...@@ -139,13 +140,14 @@
</div> </div>
</div> </div>
<div class="filter-dialog" :class="treeHidden?'fadeOut':'active fadeIn'"> <div class="filter-dialog" :class="treeHidden?'fadeOut':'active fadeIn'">
<div class="filter-dialog-header"> <div class="filter-dialog-header monitor_dialog_header">
组织 <i class="el-icon-refresh i_refresh" title="重置组织" @click.stop="restInitTree"></i>
<span>组织</span>
<i class="el-icon-close pull-right" @click.stop="treeHidden=true"></i> <i class="el-icon-close pull-right" @click.stop="treeHidden=true"></i>
</div> </div>
<div class="filter-dialog-body"> <div class="filter-dialog-body">
<div class="monitor-list"> <div class="monitor-list">
<el-tree ref="tree" :data="treeData" :props="treeProps" lazy :load="loadNode" show-checkbox node-key="id" :render-content="renderTreeContent" :default-expanded-keys="expandedKeys" :default-checked-keys="checkedKeys" @check="handleCheck" v-loading="treeLoading" @check-change="handleCheckChange"> <el-tree ref="tree" :key="treeKey" :data="treeData" :props="treeProps" lazy :load="loadNode" show-checkbox node-key="id" :render-content="renderTreeContent" :default-expanded-keys="expandedKeys" :default-checked-keys="checkedKeys" @check="handleCheck" v-loading="treeLoading" @check-change="handleCheckChange">
</el-tree> </el-tree>
</div> </div>
...@@ -158,19 +160,19 @@ ...@@ -158,19 +160,19 @@
</v-full-layout> </v-full-layout>
</template> </template>
<script> <script>
import "../../assets/spritesmith-generated/sprite.css"; import "@/assets/spritesmith-generated/sprite.css";
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;
import { CONSTANT } from "../../constant"; import { CONSTANT } from "@/constant";
import MapControll from "./MapControll.vue"; import MapControll from "./MapControll.vue";
import { exportExcel } from "utils"; import { exportExcel } from "@/utils";
export default { export default {
data() { data() {
let checkFilename = (rule, vaule, cb) => { let checkFilename = (rule, vaule, cb) => {
...@@ -227,6 +229,8 @@ export default { ...@@ -227,6 +229,8 @@ export default {
checkedKeys: [], checkedKeys: [],
autocompleteHide: true, autocompleteHide: true,
treeLoading: true, treeLoading: true,
currentMessage: "", //当前是否有提示语弹框
treeKey: "",
}; };
}, },
computed: { computed: {
...@@ -358,11 +362,13 @@ export default { ...@@ -358,11 +362,13 @@ export default {
checkFlow(data, node) { checkFlow(data, node) {
let action = MONITOR_SERVICE.getVehicleTreeUserIds; let action = MONITOR_SERVICE.getVehicleTreeUserIds;
let params = { oId: data.id }; let params = { oId: data.id };
if (data.origin.type === "u") { if (data.origin.type === "u") {
action = MONITOR_SERVICE.getVehicleTreeUserList; action = MONITOR_SERVICE.getVehicleTreeUserList;
params = { uId: data.id }; params = { uId: data.id };
} }
params.termType = this.searchType;
params.term = this.searchText;
this.treeLoading = true; this.treeLoading = true;
action(params).then((res) => { action(params).then((res) => {
this.treeLoading = false; this.treeLoading = false;
...@@ -463,7 +469,11 @@ export default { ...@@ -463,7 +469,11 @@ export default {
} else { } else {
if (origin.type === "u") { if (origin.type === "u") {
console.log("u"); console.log("u");
MONITOR_SERVICE.getVehicleTreeUserList({ uId: nodeData.id }).then( let oParams = {};
oParams.uId = nodeData.id;
oParams.termType = this.searchType;
oParams.term = this.searchText;
MONITOR_SERVICE.getVehicleTreeUserList(oParams).then(
({ data }) => { ({ data }) => {
if (data.length) { if (data.length) {
data.map((item) => { data.map((item) => {
...@@ -488,9 +498,14 @@ export default { ...@@ -488,9 +498,14 @@ export default {
return resolve(nodeData.children); return resolve(nodeData.children);
} else { } else {
if (origin.type === "u") { if (origin.type === "u") {
console.log("u"); console.log("进入此处");
MONITOR_SERVICE.getVehicleTreeUserList({ uId: nodeData.id }).then( let oParams = {};
({ data }) => { oParams.uId = nodeData.id;
if (this.searchText) {
oParams.termType = this.searchType;
oParams.term = this.searchText;
}
MONITOR_SERVICE.getVehicleTreeUserList(oParams).then(({ data }) => {
if (data.length) { if (data.length) {
data.map((item) => { data.map((item) => {
item.leaf = true; item.leaf = true;
...@@ -499,14 +514,13 @@ export default { ...@@ -499,14 +514,13 @@ export default {
} }
return resolve([]); return resolve([]);
} });
);
return; return;
} }
} }
} }
return resolve([]); return resolve(nodeData);
if (node.level === 0) { if (node.level === 0) {
return resolve([{ name: "region1" }, { name: "region2" }]); return resolve([{ name: "region1" }, { name: "region2" }]);
...@@ -804,6 +818,7 @@ export default { ...@@ -804,6 +818,7 @@ export default {
// 添加监控 // 添加监控
addMonitor(item) { addMonitor(item) {
let _this = this;
if (this.monitorList.count === 100) { if (this.monitorList.count === 100) {
this.$message({ this.$message({
type: "error", type: "error",
...@@ -811,16 +826,22 @@ export default { ...@@ -811,16 +826,22 @@ export default {
}); });
} else { } else {
if (this.monitorList[item.sn]) { if (this.monitorList[item.sn]) {
this.$message({ if (!_this.currentMessage) {
_this.currentMessage = this.$message({
type: "error", type: "error",
message: "该列表中有设备正在监控中,请勿重复监控", message: "该列表中有设备正在监控中,请勿重复监控",
onClose: function () {
_this.currentMessage = "";
},
}); });
}
} else { } else {
this.resetRefreshCount = true; this.resetRefreshCount = true;
this.monitorList.count++; this.monitorList.count++;
item.eLocateType = "gpsLocation"; item.eLocateType = "gpsLocation";
this.monitorList[item.sn] = item; this.monitorList[item.sn] = item;
this.monitorList.itemArr.unshift(item.sn); this.monitorList.itemArr.unshift(item.sn);
console.log(this.monitorList.itemArr);
this.getPositionData(); this.getPositionData();
} }
} }
...@@ -861,12 +882,17 @@ export default { ...@@ -861,12 +882,17 @@ export default {
let filterList = items.filter((item) => { let filterList = items.filter((item) => {
return !this.monitorList[item.sn]; return !this.monitorList[item.sn];
}); });
let arr = this.monitorList.itemArr || [];
console.log(arr.length);
filterList.forEach((item) => { filterList.forEach((item) => {
item.eLocateType = "gpsLocation"; item.eLocateType = "gpsLocation";
this.monitorList[item.sn] = item; this.monitorList[item.sn] = item;
this.monitorList.count++; this.monitorList.count++;
this.monitorList.itemArr.unshift(item.sn); arr.unshift(item.sn);
}); });
console.log(arr);
this.$set(this.monitorList, "itemArr", arr);
this.getPositionData(); this.getPositionData();
} }
}, },
...@@ -882,7 +908,9 @@ export default { ...@@ -882,7 +908,9 @@ export default {
this.monitorList.itemArr = list.filter((k) => k != item.sn); this.monitorList.itemArr = list.filter((k) => k != item.sn);
//this.monitorList.itemArr.splice(this.monitorList.itemArr.indexOf(item.sn||item), 1) //this.monitorList.itemArr.splice(this.monitorList.itemArr.indexOf(item.sn||item), 1)
this.monitorList = Object.assign({}, obj); this.monitorList = Object.assign({}, obj);
if (this.monitorList.count > 0) {
this.monitorList.count--; this.monitorList.count--;
}
console.log(item); console.log(item);
EventBus.$emit( EventBus.$emit(
"uiMap.monitor.destroy", "uiMap.monitor.destroy",
...@@ -1059,6 +1087,15 @@ export default { ...@@ -1059,6 +1087,15 @@ export default {
this.monitorList[item.sn].eLocateType = item.eLocateType; this.monitorList[item.sn].eLocateType = item.eLocateType;
//item.eLocateType = item.eLocateType==='gpsLocation'?'bsLocation':'gpsLocation' //item.eLocateType = item.eLocateType==='gpsLocation'?'bsLocation':'gpsLocation'
}, },
// 重置树
restInitTree() {
this.searchText = "";
this.searchType = "2";
this.treeKey = Math.random();
this.expandedKeys = [];
this.checkedKeys = [];
},
}, },
created() { created() {
if (window.AMap) { if (window.AMap) {
...@@ -1139,4 +1176,12 @@ export default { ...@@ -1139,4 +1176,12 @@ export default {
left: 0; left: 0;
width: 100%; width: 100%;
} }
.monitor_dialog_header {
display: flex;
align-items: center;
justify-content: space-between;
}
.monitor_dialog_header .i_refresh {
cursor: pointer;
}
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -686,7 +686,7 @@ MapService.prototype = { ...@@ -686,7 +686,7 @@ MapService.prototype = {
msg = '定位' msg = '定位'
} }
return `<h3 class="map-infowindow-title">${info.name}/${info.standNo}</h3> return `<h3 class="map-infowindow-title">${info.name||'--'}/${info.standNo||'--'}</h3>
<div class="map-infowindow-ct"> <div class="map-infowindow-ct">
<p><i class="icon icon-info_device"></i> 设备号: <span class="des">${info.sn} (${info.source == 1?'有线':'无线'})</span></p> <p><i class="icon icon-info_device"></i> 设备号: <span class="des">${info.sn} (${info.source == 1?'有线':'无线'})</span></p>
<p><i class="icon icon-info_time"></i>${msg}时间: <span class="des"data-time>${info.time}</span></p> <p><i class="icon icon-info_time"></i>${msg}时间: <span class="des"data-time>${info.time}</span></p>
...@@ -708,6 +708,7 @@ MapService.prototype = { ...@@ -708,6 +708,7 @@ MapService.prototype = {
infoDiv.querySelector('#locateTypeGps').classList.add('active'); infoDiv.querySelector('#locateTypeGps').classList.add('active');
infoDiv.querySelector('#locateTypeBase').classList.remove('active'); infoDiv.querySelector('#locateTypeBase').classList.remove('active');
marker.setPosition(self.getLngLat(info.lng, info.lat)); marker.setPosition(self.getLngLat(info.lng, info.lat));
self.setFitView()
marker.infoWindow && marker.infoWindow.open(map, marker.getPosition()); marker.infoWindow && marker.infoWindow.open(map, marker.getPosition());
} }
...@@ -718,6 +719,7 @@ MapService.prototype = { ...@@ -718,6 +719,7 @@ MapService.prototype = {
infoDiv.querySelector('#locateTypeGps').classList.remove('active'); infoDiv.querySelector('#locateTypeGps').classList.remove('active');
infoDiv.querySelector('#locateTypeBase').classList.add('active'); infoDiv.querySelector('#locateTypeBase').classList.add('active');
marker.setPosition(self.getLngLat(info.bsLng, info.bsLat)); marker.setPosition(self.getLngLat(info.bsLng, info.bsLat));
self.setFitView()
marker.infoWindow && marker.infoWindow.open(map, marker.getPosition()); marker.infoWindow && marker.infoWindow.open(map, marker.getPosition());
} }
......
...@@ -74,7 +74,9 @@ const monitor = { ...@@ -74,7 +74,9 @@ const monitor = {
}); });
EventBus.$on('uiMap.monitor.openInfoWindow', (snSourceType)=>{ EventBus.$on('uiMap.monitor.openInfoWindow', (snSourceType)=>{
console.log(this.markers)
if(this.markers[snSourceType]){ if(this.markers[snSourceType]){
console.log(this.markers[snSourceType])
const MAP = mapService.map; const MAP = mapService.map;
const lnglat = this.markers[snSourceType].getPosition(); const lnglat = this.markers[snSourceType].getPosition();
this.infowins[snSourceType].open(MAP, lnglat); this.infowins[snSourceType].open(MAP, lnglat);
...@@ -282,6 +284,7 @@ const monitor = { ...@@ -282,6 +284,7 @@ const monitor = {
// 激活位置 // 激活位置
drawMaker(data, autoOpenLastInfoWindow) { drawMaker(data, autoOpenLastInfoWindow) {
let tag = `${data.sn}-${data.standNo}`;
const MAP = mapService.map const MAP = mapService.map
const marker = mapService.createCarMarker( const marker = mapService.createCarMarker(
[parseFloat(data.lng ||data.bsLng), parseFloat(data.lat||data.bsLat)], [parseFloat(data.lng ||data.bsLng), parseFloat(data.lat||data.bsLat)],
...@@ -293,8 +296,8 @@ const monitor = { ...@@ -293,8 +296,8 @@ const monitor = {
data, data,
true true
) )
// this.markers[tag] = marker; monitor.markers[tag] = marker;
// this.infowins[tag] = infoWindow; monitor.infowins[tag] = infoWindow;
// 设置图标 // 设置图标
mapService.setDefaultIcon(marker, data.vehicleIcon) mapService.setDefaultIcon(marker, data.vehicleIcon)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!