Commit 2df94fd2 by 胡悦

Merge branch 'develop' into 'master'

V1.5.0版本已经上线,现需要合并代码到master

See merge request !2
2 parents a87406a3 be817f0f
......@@ -172,6 +172,7 @@ module.exports = {
'scss': path.resolve(__dirname, '../src/assets/SCSS'),
'images': path.resolve(__dirname, '../src/assets/images'),
'./patterns': path.resolve(__dirname, '../src/assets/images'),
'@':path.resolve(__dirname,'../src')
},
extensions: ['*', '.js', '.vue', '.json']
},
......
......@@ -5,7 +5,7 @@ import store from '../vuex/store'
import { checkStatus, showLoading } from './checkStatus';
const instance = axios.create({ // 创建axios实例,在这里可以设置请求的默认配置
timeout: 60000, // 设置超时时间60s
timeout: 6*60000, // 设置超时时间60s
retry: 3,
retryDelay: 1000
})
......
......@@ -59,6 +59,7 @@ export default {
return request(params, '/trialdrive/fence/getBySn')
},
// 旧虎哥
/*车辆监控*/
// getCriteriaTreeList (request = {}) {
......@@ -136,3 +137,8 @@ export default {
// return api.get('ecFence/getFenceSnsList', request)
// },
}
// 根据SN获取设备列表信息
export const GET_DEVICEINFO_BYSNS = params => {
return request(params, '/trialdrive/monitor/vehiclelocation')
}
......@@ -4,26 +4,57 @@
<el-breadcrumb-item>激活位置</el-breadcrumb-item>
</template>
<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>
</template>
</v-full-layout>
</template>
<script>
import mapService from 'utils/mapService.js'
import "utils/mapEvent.js";
import EventBus from '../../event-bus'
import remoteLoad from "utils/remoteLoad.js";
import {CONSTANT} from '../../constant'
import mapService from "@/utils/mapService.js";
import "@/utils/mapEvent.js";
import EventBus from "@/event-bus";
import remoteLoad from "@/utils/remoteLoad.js";
import { CONSTANT } from "@/constant";
import { GET_DEVICEINFO_BYSNS } from "@/api/services/monitor.js";
export default {
data() {
return {
AMap: null,
mapObj: null,
checkLoadedTimeoutId: "",
deviceList: [],
statusList: {
1: "有线",
0: "无线",
},
};
},
created() {
console.log(history.state)
console.log(history.state);
if (window.AMap) {
this.initMap();
} else {
......@@ -52,12 +83,28 @@ export default {
window.AMap = AMap;
this.mapObj = mapService.init("map");
this.isInitMap = true;
let query = this.$route.query;
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) {
o.elat = o.lat;
o.elng = o.lng;
this.addLocation(o);
o.elat = o.lat;
o.elng = o.lng;
this.addLocation(o,true);
}
} else {
this.checkLoadedTimeoutId = check();
......@@ -68,13 +115,78 @@ export default {
},
// 添加位置点
addLocation(row) {
addLocation(row, showInfoWindow) {
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>
<style lang="scss">
.full-width .main-wrap.full-width {
left: 0;
width: 100%;
}
</style>
<style lang="scss" scoped>
.active_location {
.full-width {
......@@ -94,6 +206,94 @@ export default {
bottom: 0;
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>
\ No newline at end of file
......@@ -75,8 +75,9 @@
</div>
</div>
<div class="filter-dialog animated " :class="listDialogHidden?'fadeOut':'active fadeIn'">
<div class="filter-dialog-header">
监控列表({{monitorList.count}})
<div class="filter-dialog-header monitor_dialog_header">
<span>监控列表({{monitorList.count}})</span>
<i class="el-icon-close pull-right" @click.stop="listDialogHidden=true"></i>
</div>
<div class="filter-dialog-body">
......@@ -139,13 +140,14 @@
</div>
</div>
<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>
</div>
<div class="filter-dialog-body">
<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>
</div>
......@@ -158,19 +160,19 @@
</v-full-layout>
</template>
<script>
import "../../assets/spritesmith-generated/sprite.css";
import store from "../../vuex/store.js";
import remoteLoad from "utils/remoteLoad.js";
import mapService from "utils/mapService.js";
import "utils/mapEvent.js";
import EventBus from "../../event-bus";
import { services } from "../../api";
import "@/assets/spritesmith-generated/sprite.css";
import store from "@/vuex/store.js";
import remoteLoad from "@/utils/remoteLoad.js";
import mapService from "@/utils/mapService.js";
import "@/utils/mapEvent.js";
import EventBus from "@/event-bus";
import { services } from "@/api";
import mock from "../../mock";
const MONITOR_SERVICE = services.monitor;
import { CONSTANT } from "../../constant";
import { CONSTANT } from "@/constant";
import MapControll from "./MapControll.vue";
import { exportExcel } from "utils";
import { exportExcel } from "@/utils";
export default {
data() {
let checkFilename = (rule, vaule, cb) => {
......@@ -227,6 +229,8 @@ export default {
checkedKeys: [],
autocompleteHide: true,
treeLoading: true,
currentMessage: "", //当前是否有提示语弹框
treeKey: "",
};
},
computed: {
......@@ -358,11 +362,13 @@ export default {
checkFlow(data, node) {
let action = MONITOR_SERVICE.getVehicleTreeUserIds;
let params = { oId: data.id };
if (data.origin.type === "u") {
action = MONITOR_SERVICE.getVehicleTreeUserList;
params = { uId: data.id };
}
params.termType = this.searchType;
params.term = this.searchText;
this.treeLoading = true;
action(params).then((res) => {
this.treeLoading = false;
......@@ -463,7 +469,11 @@ export default {
} else {
if (origin.type === "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 }) => {
if (data.length) {
data.map((item) => {
......@@ -488,25 +498,29 @@ export default {
return resolve(nodeData.children);
} else {
if (origin.type === "u") {
console.log("u");
MONITOR_SERVICE.getVehicleTreeUserList({ uId: nodeData.id }).then(
({ data }) => {
if (data.length) {
data.map((item) => {
item.leaf = true;
});
return resolve(data);
}
return resolve([]);
console.log("进入此处");
let oParams = {};
oParams.uId = nodeData.id;
if (this.searchText) {
oParams.termType = this.searchType;
oParams.term = this.searchText;
}
MONITOR_SERVICE.getVehicleTreeUserList(oParams).then(({ data }) => {
if (data.length) {
data.map((item) => {
item.leaf = true;
});
return resolve(data);
}
);
return resolve([]);
});
return;
}
}
}
return resolve([]);
return resolve(nodeData);
if (node.level === 0) {
return resolve([{ name: "region1" }, { name: "region2" }]);
......@@ -804,6 +818,7 @@ export default {
// 添加监控
addMonitor(item) {
let _this = this;
if (this.monitorList.count === 100) {
this.$message({
type: "error",
......@@ -811,16 +826,22 @@ export default {
});
} else {
if (this.monitorList[item.sn]) {
this.$message({
type: "error",
message: "该列表中有设备正在监控中,请勿重复监控",
});
if (!_this.currentMessage) {
_this.currentMessage = this.$message({
type: "error",
message: "该列表中有设备正在监控中,请勿重复监控",
onClose: function () {
_this.currentMessage = "";
},
});
}
} else {
this.resetRefreshCount = true;
this.monitorList.count++;
item.eLocateType = "gpsLocation";
this.monitorList[item.sn] = item;
this.monitorList.itemArr.unshift(item.sn);
console.log(this.monitorList.itemArr);
this.getPositionData();
}
}
......@@ -861,12 +882,17 @@ export default {
let filterList = items.filter((item) => {
return !this.monitorList[item.sn];
});
let arr = this.monitorList.itemArr || [];
console.log(arr.length);
filterList.forEach((item) => {
item.eLocateType = "gpsLocation";
this.monitorList[item.sn] = item;
this.monitorList.count++;
this.monitorList.itemArr.unshift(item.sn);
arr.unshift(item.sn);
});
console.log(arr);
this.$set(this.monitorList, "itemArr", arr);
this.getPositionData();
}
},
......@@ -882,7 +908,9 @@ export default {
this.monitorList.itemArr = list.filter((k) => k != item.sn);
//this.monitorList.itemArr.splice(this.monitorList.itemArr.indexOf(item.sn||item), 1)
this.monitorList = Object.assign({}, obj);
this.monitorList.count--;
if (this.monitorList.count > 0) {
this.monitorList.count--;
}
console.log(item);
EventBus.$emit(
"uiMap.monitor.destroy",
......@@ -1059,6 +1087,15 @@ export default {
this.monitorList[item.sn].eLocateType = item.eLocateType;
//item.eLocateType = item.eLocateType==='gpsLocation'?'bsLocation':'gpsLocation'
},
// 重置树
restInitTree() {
this.searchText = "";
this.searchType = "2";
this.treeKey = Math.random();
this.expandedKeys = [];
this.checkedKeys = [];
},
},
created() {
if (window.AMap) {
......@@ -1139,4 +1176,12 @@ export default {
left: 0;
width: 100%;
}
.monitor_dialog_header {
display: flex;
align-items: center;
justify-content: space-between;
}
.monitor_dialog_header .i_refresh {
cursor: pointer;
}
</style>
\ No newline at end of file
......@@ -686,7 +686,7 @@ MapService.prototype = {
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">
<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>
......@@ -708,6 +708,7 @@ MapService.prototype = {
infoDiv.querySelector('#locateTypeGps').classList.add('active');
infoDiv.querySelector('#locateTypeBase').classList.remove('active');
marker.setPosition(self.getLngLat(info.lng, info.lat));
self.setFitView()
marker.infoWindow && marker.infoWindow.open(map, marker.getPosition());
}
......@@ -718,6 +719,7 @@ MapService.prototype = {
infoDiv.querySelector('#locateTypeGps').classList.remove('active');
infoDiv.querySelector('#locateTypeBase').classList.add('active');
marker.setPosition(self.getLngLat(info.bsLng, info.bsLat));
self.setFitView()
marker.infoWindow && marker.infoWindow.open(map, marker.getPosition());
}
......
......@@ -74,7 +74,9 @@ const monitor = {
});
EventBus.$on('uiMap.monitor.openInfoWindow', (snSourceType)=>{
console.log(this.markers)
if(this.markers[snSourceType]){
console.log(this.markers[snSourceType])
const MAP = mapService.map;
const lnglat = this.markers[snSourceType].getPosition();
this.infowins[snSourceType].open(MAP, lnglat);
......@@ -137,7 +139,7 @@ const monitor = {
}),
// 激活位置点
EventBus.$on("uiMap.monitor.drawMaker", this.drawMaker);
EventBus.$on("uiMap.monitor.drawMaker", this.drawMaker);
},
draw(data, autoOpenLastInfoWindow){
const MAP = mapService.map;
......@@ -282,6 +284,7 @@ const monitor = {
// 激活位置
drawMaker(data, autoOpenLastInfoWindow) {
let tag = `${data.sn}-${data.standNo}`;
const MAP = mapService.map
const marker = mapService.createCarMarker(
[parseFloat(data.lng ||data.bsLng), parseFloat(data.lat||data.bsLat)],
......@@ -293,8 +296,8 @@ const monitor = {
data,
true
)
// this.markers[tag] = marker;
// this.infowins[tag] = infoWindow;
monitor.markers[tag] = marker;
monitor.infowins[tag] = infoWindow;
// 设置图标
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!