Commit b4ce31b0 by 前端

Merge branch 'v1.50.0' into 'master'

上线合并

See merge request !45
2 parents 14ecaa10 7f40fe56
......@@ -1591,16 +1591,6 @@
"integrity": "sha1-MgmlHKSkrVQaO409am1bg6JIWTU=",
"dev": true
},
"bindings": {
"version": "1.5.0",
"resolved": "https://registry.npmmirror.com/bindings/-/bindings-1.5.0.tgz",
"integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
"dev": true,
"optional": true,
"requires": {
"file-uri-to-path": "1.0.0"
}
},
"bluebird": {
"version": "3.5.1",
"resolved": "http://registry.npm.taobao.org/bluebird/download/bluebird-3.5.1.tgz",
......@@ -3494,6 +3484,15 @@
"safer-buffer": "^2.1.0"
}
},
"echarts": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/echarts/-/echarts-5.5.0.tgz",
"integrity": "sha512-rNYnNCzqDAPCr4m/fqyUFv7fD9qIsd50S6GDFgO1DxZhncCsNsG7IfUlAlvZe5oSEQxtsjnHiUuppzccry93Xw==",
"requires": {
"tslib": "2.3.0",
"zrender": "5.5.0"
}
},
"editions": {
"version": "1.3.4",
"resolved": "http://registry.npm.taobao.org/editions/download/editions-1.3.4.tgz",
......@@ -4227,13 +4226,6 @@
"schema-utils": "^0.4.5"
}
},
"file-uri-to-path": {
"version": "1.0.0",
"resolved": "https://registry.npmmirror.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
"dev": true,
"optional": true
},
"filename-regex": {
"version": "2.0.1",
"resolved": "http://registry.npm.taobao.org/filename-regex/download/filename-regex-2.0.1.tgz",
......@@ -4462,9 +4454,8 @@
"dev": true,
"optional": true,
"requires": {
"bindings": "^1.5.0",
"nan": "^2.12.1",
"node-pre-gyp": "*"
"nan": "^2.3.0",
"node-pre-gyp": "^0.6.39"
},
"dependencies": {
"abbrev": {
......@@ -12999,6 +12990,11 @@
"integrity": "sha1-Antp+oIyJeVRys4+8DsR9qs3wdc=",
"dev": true
},
"tslib": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz",
"integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg=="
},
"tty-browserify": {
"version": "0.0.0",
"resolved": "http://registry.npm.taobao.org/tty-browserify/download/tty-browserify-0.0.0.tgz",
......@@ -14914,6 +14910,14 @@
}
}
}
},
"zrender": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/zrender/-/zrender-5.5.0.tgz",
"integrity": "sha512-O3MilSi/9mwoovx77m6ROZM7sXShR/O/JIanvzTwjN3FORfLSr81PsUGd7jlaYOeds9d8tw82oP44+3YucVo+w==",
"requires": {
"tslib": "2.3.0"
}
}
}
}
......@@ -19,6 +19,7 @@
"chart.js": "^2.7.2",
"clipboard": "^2.0.4",
"downloadjs": "^1.4.7",
"echarts": "^5.5.0",
"element-ui": "^2.13.2",
"es6-promise": "^4.2.4",
"font-awesome": "^4.7.0",
......
......@@ -169,4 +169,24 @@ export const GET_HISTORY_LOCATION = params => {
// 常驻地数据
export const GET_RESIDENT_LOCATION = params => {
return request(params, '/trialdrive/monitor/residentList', 'get')
}
// 风险评估设备停留点查询
export const GET_STAY_POINTLIST = params => {
return request(params, '/trialdrive/riskAssessment/getStayPointList', 'get')
}
// 风险评估获取车辆基本信息
export const GET_BASIC_INFORMATION = params => {
return request(params, '/trialdrive/riskAssessment/getBasicInformation', 'get')
}
// 风险评估设备预测家庭地址和预测工作地址查询
export const GET_RESIDENT_INFORMATION = params => {
return request(params, '/trialdrive/riskAssessment/getResidentInformation', 'get')
}
// 风险评估设备警情数据查询
export const GET_ALARM_POINTLIST = params => {
return request(params, '/trialdrive/riskAssessment/getAlarmInformation', 'get')
}
// 风险评估用户行为数据查询
export const GET_USER_BEHAVIOR_INFORMATION = params => {
return request(params, '/trialdrive/riskAssessment/getUserBehaviorInformation', 'get')
}
\ No newline at end of file
......@@ -646,4 +646,8 @@
.clear_link:hover {
opacity: 0.8;
}
}
.resident_btn_hidden {
display: none;
}
\ No newline at end of file
<template>
<div>
<div :id="domId" style="width: 100%;" :style="{ height }"></div>
</div>
</template>
<script>
import * as echarts from 'echarts'
export default {
name: 'BarLineChart',
props: {
height: {
type: String
},
domId: {
type: String,
default: 'bar-line'
},
dataList: {
type: Array,
default: () => []
},
xAxisData: {
type: Array,
default: () => ['1', '2', '3', '4', '5', '6']
},
linetype: Number,
lineChartsYear: {
type: String,
default: ''
}
},
data() {
return {
barLineOptions: null,
}
},
mounted() {
this.barLineDom = document.getElementById(this.domId)
this[this.domId] = echarts.init(this.barLineDom)
},
methods: {
drawBarLine() {
this.barLineOptions = {
grid: {
right: '19%',
left: '15%'
},
xAxis: {
type: 'category',
name: (this.linetype == 1 ? '周' : '天')+(this.lineChartsYear && '\n('+this.lineChartsYear + '年'+')'),
// nameLocation: 'center',
// nameGap: 20,
nameTextStyle: {
fontSize: 10,
lineHeight: 16
},
boundaryGap: false,//坐标轴两边留白
data: this.xAxisData,
axisLabel: { //坐标轴刻度标签的相关设置。
interval: this.linetype == 1 ? (this.dataList.length > 10 ? 1 : 0): 0,//设置为 1,表示『隔一个标签显示一个标签』
// margin:15,
textStyle: {
color: '#FFFFFF',
fontSize: 12,
}
},
},
yAxis: {
type: 'value',
name: '公里',
boundaryGap: true,//坐标轴两边留白
// min: 0,
// max: 1500,
// interval: 300,
axisLabel: {
interval: 0,
margin: 2,
textStyle: {
color: '#FFFFFF',
fontSize: 12,
},
},
splitLine: {
lineStyle: {
color: '#ffffff00;',
},
},
grid: {
left: '15%'
},
},
series: [
{
name: 'usecar',
type: 'line',
symbol: "circle",
symbolSize: 0,
itemStyle: {
normal: {
color: '#419fff',
lineStyle: {
color: "#1890FF",
width: 3
},
areaStyle: {
color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
offset: 0,
color: 'rgba(65,159,255,0)'
}, {
offset: 1,
color: 'rgba(65,159,255,0.19)'
}]),
}
}
},
data: this.dataList
},
]
};
this[this.domId].setOption(this.barLineOptions)
},
}
}
</script>
<style scoped lang="scss"></style>
\ No newline at end of file
<template>
<div class="pie-box">
<div :id="id" :style="{ height: height }" class="pie-chart"></div>
<div>{{ list.length ? list[0].advise : '' }}
</div>
</div>
</template>
<script>
import * as echarts from 'echarts'
export default {
name: 'PieChart',
props: {
id: {
type: String,
default: ''
},
height: {
type: String,
default: '8.54vh'
},
list: {
type: Array,
default: () => [
// {
// alarmName: "防拆报警",
// alarmLevel: 20,
// }
]
},
},
data() {
return {
option: '',
echartsPie: '',
mTime: '',
viewData: [],
text: '',
subtext: '',
currentIndex: -1,
mainValue: 0,
numDesc: '',
descColor: ''
}
},
watch: {
list: {
handler(newVal) {
if (newVal.length > 0) {
this.initData()
this.$nextTick(() => {
this.draw()
})
}
},
immediate: true
}
},
mounted() { },
methods: {
// 初始化数据
initData() {
const { list, keys } = this
this.viewData = []
// list.forEach(item => {
// this.viewData.push({
// name: item[keys[0]],
// value: item[keys[1]],
// avarage: item[keys[2]]
// })
// })
},
draw() {
if (this.mTime) clearInterval(this.mTime)
this.echartsPie = echarts.init(document.getElementById(this.id))
// 指定图表的配置项和数据
var storedList = this.list;
const pointerData = this.list.length ? this.list[0].value : 0
console.log(pointerData,storedList, 'pointerData' , '---888----');
const alarmLevel = storedList[0] && storedList[0].alarmLevel ? storedList[0].alarmLevel : 0
this.option = {
backgroundColor: "",
series: [{
type: "gauge",
radius: '80%',
startAngle: 225,
endAngle: -45,
splitNumber: 50,
title: {
color: 'red',
},
splitLine: {
show: false,
length: 15,
distance: -10,
lineStyle: {
color: "#fff",
width: 1
}
},
detail: {
show: true,
offsetCenter: [0, 80],
fontSize: 12,
formatter: function(val) {
let value = ''
switch (alarmLevel / 1) {
case 1:
value = '极高风险';
break;
case 2:
value = '高风险';
break;
case 3:
value = '中风险';
break;
case 4:
value = '低风险';
break;
case 5:
value = '安全';
break;
default:
value = '无风险';
}
if (!storedList.length) {
return `5级警情\n{b|${value}}`;
} else {
return `${alarmLevel}级警情\n{b|${value}}`;
}
},
rich: {
a: {
fontSize: 30,
color: '#ffffff',
fontweight: 'bold',
},
b: {
color: pointerData > 0 ? '#F38906' : '#4ED5D7',
fontSize: 14,
}
},
textStyle: {
fontSize: 18,
color: '#ffffff',
top: '80%',
},
},
// 仪表盘的线,颜色值为一个数组
axisLine: {
show: true,
// 两端是否设置为圆角;在5.0之后的版本有效
roundCap: true,
lineStyle: {
width: 15,
opacity: 1,
color: [
[pointerData / 100, {
x: 0,
y: 1,
x1: 1,
y1: 0,
colorStops: [
{
offset: 0,
color: '#4ED5D7'
},
{
offset: 0.3,
color: '#58D068'
},
{
offset: 0.5,
color: '#FBD924'
},
{
offset: 0.8,
color: '#F38906'
},
{
offset: 1,
color: '#F23204'
}
]
}],
[1, "#46495E"]
]
}
},
// 仪表盘刻度标签
axisLabel: {
show: false,
color: "rgba(84, 108, 198, 0.65)",
fontSize: 14,
distance: 20,
formatter: val => {
const num = Math.floor(val);
return num % 20 === 0 ? num : "";
}
},
// 刻度
axisTick: {
show: false
},
// 指针,此设置仅对5.0以上的版本生效
anchor: {
show: true,
icon: "circle",
showAbove: true,
size: 15,
itemStyle: {
borderWidth: 3,
borderColor: "#FFFFFF"
}
},
data: [pointerData]
}
]
};
this.echartsPie.setOption(this.option)
},
// 事件触发
emitEvent(data) {
this.echartsPie.setOption(this.option)
this.$emit('pieAction', data)
},
highlightPie() {
// 取消所有高亮并高亮当前图形
// 遍历饼图数据,取消所有图形的高亮效果
for (var idx in this.option.series[0].data) {
this.echartsPie.dispatchAction({
type: 'downplay',
seriesIndex: 0,
dataIndex: idx
})
}
// 高亮当前图形
this.echartsPie.dispatchAction({
type: 'highlight',
seriesIndex: 0,
dataIndex: this.currentIndex
})
this.descColor = this.option.color[this.currentIndex]
},
// 高亮
pieActive() {
const dataLen = this.option.series[0].data.length
this.currentIndex = (this.currentIndex + 1) % dataLen
this.highlightPie()
this.emitEvent(this.viewData[this.currentIndex])
}
}
}
</script>
<style lang="scss" scoped>
.pie-box {
background: #181C36;
font-weight: 500;
font-size: 12px;
color: #A3A4AF;
text-align: center;
.center-content {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
max-width: 40%;
&-num-color {
color: #fff;
}
&-num {
// overflow: hidden;
// text-overflow: ellipsis;
// white-space: nowrap;
// font-size: 0.6vw;
--step: 0;
counter-reset: count var(--step);
z-index: var(--step);
transition: --step 0.5s;
&::before {
content: counter(count);
}
}
&-desc {
font-size: 0.5vw;
color: #606266;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
animation: rotateIn 3s infinite;
}
}
.content-desc {
display: flex;
align-items: center;
font-size: 8px;
color: #c8c8c8;
text-align: center;
font-weight: 400;
position: absolute;
top: 91%;
left: 50%;
transform: translateX(-50%);
text-align: center;
height: 14px !important;
white-space: nowrap;
&-icon {
width: 8px;
height: 4px;
border-radius: 2px;
margin-right: 4px;
}
}
}
@property --step {
syntax: '<integer>';
inherits: false;
initial-value: 15;
}
@keyframes rotateIn {
from {
transform: rotateY(0turn);
}
to {
transform: rotateY(-1turn);
}
}
</style>
\ No newline at end of file
<template>
<div class="main-container">
<div id="alarmMap" class="map-container"></div>
<div class="left-box" v-show="boxShow">
<!-- 饼图组件 -->
<ParCharts class="pie" ref="pieChartsRef" id="pie-chart" height="250px" :list="pieList" />
<!-- 风险分析 -->
<div class="analy-box">
<div class="top-box">
<template v-if="alarmData.data.length">
<div v-for="item in alarmData.data" :key="item" class="top-box-item">
<div class="top-box-item-left">{{ item.alarmName }}</div>
<div class="top-box-item-right">
<div :class="['item', item.alarmLevel <= 5 ? 'item1' : 'item1-grey']"></div>
<div :class="['item', item.alarmLevel <= 4 ? 'item2' : 'item-grey']"></div>
<div :class="['item', item.alarmLevel <= 3 ? 'item3' : 'item-grey']"></div>
<div :class="['item', item.alarmLevel <= 2 ? 'item4' : 'item-grey']"></div>
<div :class="['item', item.alarmLevel <= 1 ? 'item5' : 'item5-grey']"></div>
</div>
</div>
</template>
<template v-else>
<div class="top-box-item">
<div class="top-box-item-left">防拆报警</div>
<div class="top-box-item-right-none"></div>
</div>
<div class="top-box-item">
<div class="top-box-item-left">高危区域内长停</div>
<div class="top-box-item-right-none"></div>
</div>
<div class="top-box-item">
<div class="top-box-item-left">双设备分离</div>
<div class="top-box-item-right-none"></div>
</div>
<div class="top-box-item">
<div class="top-box-item-left">安装点长停</div>
<div class="top-box-item-right-none"></div>
</div>
<div class="tips">
<div>车辆无警情</div>
<div>触发</div>
</div>
</template>
</div>
<div class="middle-box">
<div><span class="dot dot-1"></span>安全</div>
<div><span class="dot dot-2"></span>低风险</div>
<div><span class="dot dot-3"></span>中风险</div>
<div><span class="dot dot-4"></span>高风险</div>
<div><span class="dot dot-5"></span>极高风险</div>
</div>
<div class="bottom-box">
<div class="bottom-box-item">
<div class="bottom-box-item-left">常驻地:</div>
<div class="bottom-box-item-right">{{ alarmData.residence || '-' }}</div>
</div>
<div class="bottom-box-item">
<div class="bottom-box-item-left">预测家庭地址:</div>
<div class="bottom-box-item-right">{{ alarmData.homeAddress || '-' }}</div>
</div>
<div class="bottom-box-item">
<div class="bottom-box-item-left">预测工作地址:</div>
<div class="bottom-box-item-right">{{ alarmData.workAddress || '-' }}</div>
</div>
</div>
</div>
</div>
<div class="right-box" v-show="boxShow">
<!-- 基本信息 -->
<div class="detail-box">
<div class="title">基本信息</div>
<div>
<div class="detail-msg">
<div class="detail-msg-left">承租人姓名:</div>
<div class="detail-msg-right"> {{ basicData.lesseeName || '-' }}</div>
</div>
<div class="detail-msg">
<div class="detail-msg-left">店面名称:</div>
<div class="detail-msg-right"> {{ basicData.shopName || '-' }}</div>
</div>
<div class="detail-msg">
<div class="detail-msg-left">客户姓名:</div>
<div class="detail-msg-right"> {{ basicData.userName || '-' }}</div>
</div>
<div class="detail-msg">
<div class="detail-msg-left">业务工单号:</div>
<div class="detail-msg-right"> {{ basicData.workOrderNo || '-' }}</div>
</div>
<div class="detail-msg">
<div class="detail-msg-left">车架号:</div>
<div class="detail-msg-right">{{ basicData.vin || '-' }} </div>
</div>
<div class="detail-msg">
<div class="detail-msg-left">创建时间:</div>
<div class="detail-msg-right">{{ basicData.createTime || '-' }} </div>
</div>
<div class="detail-msg">
<div class="detail-msg-left">设备状态:</div>
<template v-if="basicData.deviceInformationVOList&&basicData.deviceInformationVOList.length">
<div class="detail-msg-right">
<div class="detail-msg-desc" v-for="item in basicData.deviceInformationVOList">
<div>{{ item.sourceStr }}-{{ item.sn }}</div>
<div v-show="item.deviceStateStr">{{ item.deviceStateStr }}</div>
<div>定位-{{ item.address || ' --' }}</div>
</div>
</div>
</template>
<template v-else>
<div class="detail-msg-desc">--</div>
</template>
</div>
</div>
</div>
<!-- 用车行为分析 -->
<div class="use-car-box">
<div class="title">用车行为分析</div>
<div class="line-charts" v-if="xAxisDataList.length">
<LineCharts id="useCarCharts" ref="useCarChartsRef" height="250px" :linetype="linetype" :dataList="useCarData"
:xAxisData="xAxisDataList" :lineChartsYear="lineChartsYear"></LineCharts>
</div>
<div v-else class="empty-box">
<img src="https://wx.glsx.com.cn/upload/biz/501829f0-6c34-443c-bf56-ae94072a6619.png" alt="">
<div>暂无里程数据</div>
</div>
</div>
</div>
<!-- 热力图 -->
<div class="hot-box">“历史停留”热力图</div>
</div>
</template>
<script>
import ParCharts from './ParCharts.vue';
import mapService from "@/utils/mapService.js";
import LineCharts from './LineCharts.vue';
import { services } from "@/api";
import "utils/mapEvent.js";
import EventBus from "../../event-bus";
import { GET_STAY_POINTLIST, GET_BASIC_INFORMATION, GET_RESIDENT_INFORMATION, GET_ALARM_POINTLIST, GET_USER_BEHAVIOR_INFORMATION, GET_HISTORY_LOCATION } from "@/api/services/monitor";
const MONITOR_SERVICE = services.monitor;
export default {
name: 'OEshieldAlarmAnalysis',
components: { ParCharts, LineCharts },
data() {
return {
AMap: null,
mapObj: null,
mapLoading: false,
isInitMap: false,
num: 4,
basicData: {},
alarmData: {
data: [],
residence: '',
homeAddress: '',
workAddress: '',
},
useCarData: [],
xAxisDataList: [],
pieList: [],
resultList: [],
linetype: 1,
boxShow: false,
lineChartsYear: ''
};
},
mounted() {
let _this = this;
const _vehicleId = _this.$route.query.vehicleId
this.vehicleId = _vehicleId
_this.$mapInit({ version: '1.4.2' }).then(AMap => {
// window.AMap = AMap;
_this.initMap();
})
},
methods: {
initMap() {
let check = () => {
this.checkMapLoaded && window.clearTimeout(this.checkMapLoaded);
return setTimeout(() => {
if (
"AMap" in window &&
typeof AMap.Map == "function" &&
!this.mapObj
) {
window.AMap = AMap;
this.mapObj = mapService.init("alarmMap");
this.isInitMap = true;
this.$nextTick(() => {
this.boxShow = true
this.getStayPointList(this.vehicleId)
this.getBasicInformation(this.vehicleId)
this.getResidentInformation(this.vehicleId)
this.getAlarmInformation(this.vehicleId)
this.getUserBehaviorInformation(this.vehicleId)
}, 500)
} else {
this.checkMapLoaded = check();
}
});
};
this.checkMapLoaded = check();
},
// 设备停留点查询
getStayPointList(vehicleId) {
EventBus.$emit("uiMap.historyLocation.destroy");
GET_STAY_POINTLIST({ vehicleId }).then(res => {
if (res.code != 200) {
this.$message({
type: "error",
message: res.message,
})
return
}
let _data = res.data || []
if (!_data.length) {
this.$message({
type: "info",
message: '暂无历史停留数据',
})
return
}
_data.forEach((item, idx) => {
item.idx = idx;
item.name = item.ownerName || "--";
item.sn = item.sn || "--";
item.vin = item.vin || "--";
item.begintime = item.beginTime;
item.endtime = item.endTime;
item.transferAddress = item.address || "--"; // 取后端返回address
});
this.resultList = _data;
EventBus.$emit("uiMap.historyLocation.draw", _data);
})
},
// 获取车辆基本信息
getBasicInformation(vehicleId) {
GET_BASIC_INFORMATION({ vehicleId }).then(res => {
if (res.code != 200) {
this.$message({
type: "error",
message: res.message,
})
return
}
this.basicData = res.data
})
},
// 预测家庭地址和预测工作地址查询
getResidentInformation(vehicleId) {
GET_RESIDENT_INFORMATION({ vehicleId }).then(res => {
if (res.code != 200) {
this.$message({
type: "error",
message: res.message,
})
return
}
this.alarmData.residence = res.data.residence
this.alarmData.homeAddress = res.data.homeAddress
this.alarmData.workAddress = res.data.workAddress
})
},
// 设备警情数据查询
getAlarmInformation(vehicleId) {
GET_ALARM_POINTLIST({ vehicleId }).then(res => {
if (res.code != 200) {
this.$message({
type: "error",
message: res.message,
})
return
}
this.alarmData.data = res.data.length > 6 ? res.data.slice(0, 6) : res.data
let _list = res.data
if (_list.length === 0) {
this.$refs.pieChartsRef.draw()
return
}
_list[0].value = 1 / _list[0].alarmLevel * 100
this.pieList.push(_list[0])
this.$refs.pieChartsRef.draw()
})
},
// 用户行为数据查询
getUserBehaviorInformation(vehicleId) {
GET_USER_BEHAVIOR_INFORMATION({ vehicleId }).then(res => {
if (res.code != 200) {
this.$message({
type: "error",
message: res.message,
})
return
}
let _dataList = res.data.statisticsType == 1 ? res.data.userBehaviorWeekDTOList : res.data.userBehaviorDayDTOList
_dataList ? _dataList : []
if (_dataList.length == 0) {
this.useCarData = []
return
}
this.linetype = res.data.statisticsType
let _int = res.data.statisticsType == 1 ? 'weekInt' : 'dayInt'
let _type = res.data.statisticsType == 1 ? 'weekNum' : 'dayNum'
this.lineChartsYear = _dataList[_dataList.length - 1].yearInt || ''
_dataList.forEach(item => {
res.data.statisticsType == 1 ? this.xAxisDataList.push(item[_int]) : this.xAxisDataList.push(item.monthInt + '.' + item[_int])
this.useCarData.push(item[_type])
})
setTimeout(() => {
this.$refs.useCarChartsRef.drawBarLine()
}, 1000)
})
}
},
// async created() {
// EventBus.$on("uiMap.historyLocation.transferSuccess", (data) => {
// this.resultList = [].concat(data);
// });
// },
beforeDestroy() {
// this.checkLoadedTimeoutId && window.clearTimeout(this.checkLoadedTimeoutId);
},
};
</script>
<style lang="scss" scoped>
.main-container {
position: fixed;
width: calc(100% - 200px);
height: calc(100% - 60px);
top: 60px;
left: 200px;
background: #fff;
padding: 0;
}
.map-container {
/* position: fixed;
width: calc(100% - 200px);
height: calc(100% - 60px);
top: 60px;
left: 200px;
background: #fff;
padding: 0; */
}
.left-box {
position: absolute;
top: 10px;
left: 40px;
z-index: 9999;
}
.pie {
width: 340px;
height: 299px;
background: #181C36;
box-shadow: 0 4px 6px 0 #00000014;
z-index: 9999;
}
.analy-box {
margin-top: 8px;
width: 340px;
background: #181C36;
box-shadow: 0 4px 6px 0 #00000014;
box-sizing: border-box;
padding: 16px;
z-index: 9999;
.top-box {
margin: 16px 0;
position: relative;
&-item {
display: flex;
align-items: center;
margin-bottom: 16px;
&-left {
font-weight: 400;
font-size: 14px;
color: #FFFFFF;
width: 120px;
}
&-right {
display: flex;
.item {
width: 36px;
height: 12px;
}
.item1 {
background: #4ED5D7;
border-radius: 6px 0 0 6px;
}
.item2 {
background: #58D068;
}
.item3 {
background: #F7D310;
}
.item4 {
background: #F38906;
}
.item5 {
background: #F23204;
border-radius: 0 6px 6px 0;
}
.item1-grey {
background: #46495E;
border-radius: 6px 0 0 6px;
}
.item5-grey {
background: #46495E;
border-radius: 0 6px 6px 0;
}
.item-grey {
background: #46495E;
}
}
&-right-none {
width: 180px;
height: 12px;
background: #46495E;
border-radius: 6px;
}
}
&-item:last-child {
margin-bottom: 0;
}
.tips {
position: absolute;
top: 42px;
left: 158px;
font-weight: 600;
font-size: 14px;
color: #B5B5B5;
-webkit-text-stroke: 0.5px #181C36;
}
}
.middle-box {
display: flex;
justify-content: space-around;
width: 280px;
font-size: 10px;
color: #ffffffb3;
margin: auto;
.dot {
width: 6px;
height: 6px;
border-radius: 3px;
display: inline-block;
margin-right: 2px;
}
.dot-1 {
background: #4ED5D7;
}
.dot-2 {
background: #58D068;
}
.dot-3 {
background: #F7D310;
}
.dot-4 {
background: #F38906;
}
.dot-5 {
background: #F23204;
}
}
.bottom-box {
&-item {
display: flex;
font-weight: 400;
font-size: 14px;
margin-top: 16px;
&-left {
min-width: 100px;
color: #A3A4AF;
}
&-right {
color: #E5E5E8;
}
}
}
}
.right-box {
position: absolute;
top: 10px;
right: 40px;
z-index: 9999;
}
.detail-box {
width: 340px;
background: #181C36;
box-shadow: 0 4px 6px 0 #00000014;
z-index: 9999;
box-sizing: border-box;
padding: 16px;
.title {
font-weight: 500;
font-size: 14px;
color: #ffffff80;
margin-bottom: 24px;
}
.detail-msg {
display: flex;
justify-content: space-between;
font-weight: 400;
font-size: 14px;
margin-bottom: 10px;
&-left {
color: #A3A4AF;
min-width: 100px;
}
&-right {
flex: 1;
color: #E5E5E8;
text-align: left;
}
&-desc {
color: #E5E5E8;
}
}
}
.use-car-box {
margin-top: 8px;
width: 340px;
height: 264px;
background: #181C36;
box-sizing: border-box;
padding: 16px;
box-shadow: 0 4px 6px 0 #00000014;
z-index: 9999;
.title {
font-weight: 500;
font-size: 14px;
color: #ffffff80;
}
.empty-box {
height: 250px;
font-weight: 400;
font-size: 14px;
color: #999999;
text-align: center;
margin-top: 40px;
img {
width: 86px;
height: 86px;
}
}
}
.hot-box {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 254px;
height: 48px;
background: #333336cc;
box-shadow: 0 4px 6px 0 #00000014;
border-radius: 24px 24px 0 0;
font-weight: 600;
font-size: 20px;
color: #FFFFFF;
text-align: center;
line-height: 48px;
z-index: 9999;
}
.line-charts {
padding-left: 10px;
}</style>
\ No newline at end of file
......@@ -20,32 +20,15 @@
:trigger-on-focus="false"
:placeholder="'请输入'+['6位以上设备号','6位以上车架号','2位以上姓名'][searchType-1]"
@select="handleSelect"> -->
<el-input
:placeholder="placeholderText"
v-model.trim="searchText"
size="small"
class="input-with-select"
@keyup.enter.native="searchSubmit"
>
<el-select
v-model="searchType"
@change="selectChange"
slot="prepend"
placeholder="请选择"
size="small"
>
<el-input :placeholder="placeholderText" v-model.trim="searchText" size="small" class="input-with-select"
@keyup.enter.native="searchSubmit">
<el-select v-model="searchType" @change="selectChange" slot="prepend" placeholder="请选择" size="small">
<el-option label="设备号" value="1"></el-option>
<el-option label="车架号" value="2"></el-option>
<el-option label="姓名" value="3"></el-option>
<!-- <el-option label="工单号" value="4"></el-option> -->
</el-select>
<el-button
icon="el-icon-search"
size="mini"
slot="append"
:loading="isSearching"
@click="searchSubmit"
>
<el-button icon="el-icon-search" size="mini" slot="append" :loading="isSearching" @click="searchSubmit">
</el-button>
<!-- <template slot-scope="{ item }">
<div style="margin: 0 -20px; font-size: 12px; " class="auto_item">
......@@ -64,74 +47,33 @@
</div>
<el-row type="flex" class="filter-entrance" justify="space-between">
<!-- <el-button type="text" @click="importDialogHidden=false;listDialogHidden=true;resultDialogHidden=true;">导入查询</el-button> -->
<el-button
type="text"
@click="
treeHidden = false;
listDialogHidden = true;
importDialogHidden = true;
resultDialogHidden = true;
"
>组织</el-button
>
<el-button
type="text"
@click="
listDialogHidden = false;
treeHidden = true;
importDialogHidden = true;
resultDialogHidden = true;
"
>监控列表({{ getMonitorListVisibleCount }})</el-button
>
<el-button type="text" @click="
treeHidden = false;
listDialogHidden = true;
importDialogHidden = true;
resultDialogHidden = true;
">组织</el-button>
<el-button type="text" @click="
listDialogHidden = false;
treeHidden = true;
importDialogHidden = true;
resultDialogHidden = true;
">监控列表({{ getMonitorListVisibleCount }})</el-button>
</el-row>
<div class="filter-dialog-set">
<div
class="filter-dialog animated"
:class="importDialogHidden ? 'fadeOut' : 'active fadeIn'"
>
<div class="filter-dialog animated" :class="importDialogHidden ? 'fadeOut' : 'active fadeIn'">
<div class="filter-dialog-header">
导入查询
<i
class="el-icon-close pull-right"
@click.stop="importDialogHidden = true"
></i>
<i class="el-icon-close pull-right" @click.stop="importDialogHidden = true"></i>
</div>
<div class="filter-dialog-body">
<el-form
ref="form"
:model="form"
:rules="rules"
:inline="false"
size="mini"
>
<el-form ref="form" :model="form" :rules="rules" :inline="false" size="mini">
<el-form-item label="" prop="filename">
<el-upload
ref="upload"
class="upload-wrap"
action="vehicle/importSerchDevice"
:on-change="changeFile"
:before-upload="beforeUpload"
:multiple="false"
:show-file-list="false"
:on-success="successUpload"
:on-error="errorUpload"
:data="uploadData"
accept=".xlsx"
:auto-upload="false"
>
<el-input
v-model="form.filename"
placeholder="未选取任何文件"
class="input-with-select"
size="small"
>
<el-select
v-model="form.uploadType"
slot="prepend"
placeholder="请选择"
size="small"
>
<el-upload ref="upload" class="upload-wrap" action="vehicle/importSerchDevice" :on-change="changeFile"
:before-upload="beforeUpload" :multiple="false" :show-file-list="false" :on-success="successUpload"
:on-error="errorUpload" :data="uploadData" accept=".xlsx" :auto-upload="false">
<el-input v-model="form.filename" placeholder="未选取任何文件" class="input-with-select" size="small">
<el-select v-model="form.uploadType" slot="prepend" placeholder="请选择" size="small">
<el-option label="设备号" value="1"></el-option>
<el-option label="车架号" value="2"></el-option>
<el-option label="姓名" value="3"></el-option>
......@@ -145,98 +87,48 @@
</div>
</el-upload>
</el-form-item>
<el-button
type="primary"
class="upload-sure-btn"
size="small"
@click="submitUpload"
:loading="importing"
:disabled="uploadDisabled"
>确认</el-button
>
<el-button
size="mini"
type="text"
@click="downloadTpl"
style="margin-left: 0px"
>下载模板</el-button
>
<el-button type="primary" class="upload-sure-btn" size="small" @click="submitUpload"
:loading="importing" :disabled="uploadDisabled">确认</el-button>
<el-button size="mini" type="text" @click="downloadTpl" style="margin-left: 0px">下载模板</el-button>
</el-form>
</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 monitor_dialog_header">
<span>监控列表({{ monitorList.itemArr.length }})</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 class="filter-dialog-body">
<el-row type="flex" class="sub-filter" justify="space-between">
<el-select
v-model="monitorFilterType"
placeholder="请选择"
size="small"
style="width: 100px"
>
<el-select v-model="monitorFilterType" placeholder="请选择" size="small" style="width: 100px">
<el-option label="全部" value=""></el-option>
<el-option label="有线" value="1"></el-option>
<el-option label="无线" value="0"></el-option>
</el-select>
<el-button
type="primary"
plain
size="small"
@click="removeMonitorByGroup(monitorList.itemArr)"
>批量删除</el-button
>
<el-button type="primary" plain size="small"
@click="removeMonitorByGroup(monitorList.itemArr)">批量删除</el-button>
</el-row>
<ul
class="monitor-list"
style="max-height: calc(100vh - 380px)"
>
<ul class="monitor-list" style="max-height: calc(100vh - 380px)">
<template v-for="(sn, key) in monitorList.itemArr">
<li
class="monitor-list-item"
:key="sn"
@click="openMapInfoWindow(sn, monitorList[sn].source)"
v-if="
key !== 'count' &&
monitorList[sn] &&
(monitorList[sn].source == monitorFilterType ||
monitorFilterType == '')
"
>
<span
class="device-icon"
:class="monitorList[sn].online ? '' : 'offline'"
v-show="monitorList[sn].online !== undefined"
></span>
<li class="monitor-list-item" :key="sn" @click="openMapInfoWindow(sn, monitorList[sn].source)" v-if="key !== 'count' &&
monitorList[sn] &&
(monitorList[sn].source == monitorFilterType ||
monitorFilterType == '')
">
<span class="device-icon" :class="monitorList[sn].online ? '' : 'offline'"
v-show="monitorList[sn].online !== undefined"></span>
<div class="user-info">
<p>
<span class="name">{{
monitorList[sn].name || "--"
}}</span>
<span
>{{ sn }}({{ monitorList[sn].sourceType }})</span
>
<span>{{ sn }}({{ monitorList[sn].sourceType }})</span>
</p>
<p>车架号:{{ monitorList[sn].standNo }}</p>
</div>
<span
class="none_tip"
v-show="!monitorList[sn].isHasPosition"
>无定位信息</span
>
<el-button
type="text"
@click.stop="removeMonitor(monitorList[sn], true)"
><i class="fa fa-trash"></i
></el-button>
<span class="none_tip" v-show="!monitorList[sn].isHasPosition">无定位信息</span>
<el-button type="text" @click.stop="removeMonitor(monitorList[sn], true)"><i
class="fa fa-trash"></i></el-button>
</li>
</template>
</ul>
......@@ -250,56 +142,30 @@
</div>
</div>
</div>
<div
class="filter-dialog animated"
:class="resultDialogHidden ? 'fadeOut' : 'active fadeIn'"
>
<div class="filter-dialog animated" :class="resultDialogHidden ? 'fadeOut' : 'active fadeIn'">
<div class="filter-dialog-header">
查询结果
<i
class="el-icon-close pull-right"
@click.stop="resultDialogHidden = true"
></i>
<i class="el-icon-close pull-right" @click.stop="resultDialogHidden = true"></i>
</div>
<div class="filter-dialog-body">
<el-row type="flex" class="sub-filter" justify="space-between">
<el-select
v-model="resultFilterType"
placeholder="请选择"
size="small"
style="width: 100px"
>
<el-select v-model="resultFilterType" placeholder="请选择" size="small" style="width: 100px">
<el-option label="全部" value=""></el-option>
<el-option label="有线" value="1"></el-option>
<el-option label="无线" value="0"></el-option>
</el-select>
<el-button
type="primary"
plain
size="small"
@click="addMonitorByGroup"
>批量监控</el-button
>
<el-button type="primary" plain size="small" @click="addMonitorByGroup">批量监控</el-button>
</el-row>
<ul class="monitor-list">
<li
class="monitor-list-item"
v-for="item in resultList"
:key="item.id"
v-show="
item.source == resultFilterType || resultFilterType == ''
"
>
<li class="monitor-list-item" v-for="item in resultList" :key="item.id" v-show="item.source == resultFilterType || resultFilterType == ''
">
<div class="user-info">
<p>
<span class="name">{{ item.name }}</span
><span>{{ item.sn }}({{ item.sourceType }})</span>
<span class="name">{{ item.name }}</span><span>{{ item.sn }}({{ item.sourceType }})</span>
</p>
<p>车架号:{{ item.standNo }}</p>
</div>
<el-button type="text" @click.prevent="addMonitor(item)"
>监控</el-button
>
<el-button type="text" @click.prevent="addMonitor(item)">监控</el-button>
</li>
<li v-show="!resultList.length">
<p class="text-center">无数据</p>
......@@ -307,50 +173,24 @@
</ul>
</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 monitor_dialog_header">
<i
class="el-icon-refresh i_refresh"
title="重置组织"
@click.stop="restInitTree"
></i>
<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 class="filter-dialog-body">
<div class="monitor-list">
<el-tree
ref="tree"
:key="treeKey"
:data="treeData"
:props="treeProps"
lazy
:load="loadNode"
show-checkbox
node-key="id"
: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" :default-expanded-keys="expandedKeys" :default-checked-keys="checkedKeys"
@check="handleCheck" v-loading="treeLoading" @check-change="handleCheckChange">
<span class="custom-tree-node" slot-scope="{ node, data }">
<div v-if="node.data.leaf">
<div>姓名:{{ node.data.label1 || "--" }}</div>
<div>设备号:{{ node.data.label || "--" }}</div>
<div>车架号:{{ node.data.label2 }}</div>
<div
class="load_more_link"
v-if="data.showMore"
v-loading="loadingMore"
@click="loadNext(node, data)"
>
<div class="load_more_link" v-if="data.showMore" v-loading="loadingMore"
@click="loadNext(node, data)">
查看更多
</div>
</div>
......@@ -446,6 +286,8 @@ export default {
pageSize: 10,
loadingMore: false,
placeholderText: "请输入6位以上车架号",
vidCode: undefined,
sourceType: 0
};
},
computed: {
......@@ -815,14 +657,12 @@ export default {
) {
window.AMap = AMap;
this.mapObj = mapService.init("map");
//this.bindEvent();
this.isInitMap = true;
if (this.$route.query.snArr) {
let routeQuery = JSON.parse(this.$route.query.snArr);
if (routeQuery.length > 0) {
/* this.addMonitor(routeQuery[0]);
this.autoOpenLastInfoWindow = true; */
this.autoOpenLastInfoWindow = true; */
routeQuery.forEach((item) => {
this.addMonitor(item);
});
......@@ -895,30 +735,30 @@ export default {
this.querySearch();
/* MONITOR_SERVICE.getVehicleDeviceList({
term: this.searchText,
type: this.searchType
}).then((res)=>{
//res = mock.getCriteriaTreeList
if(res.returnCode == 0){
const data = res.data;
this.resultList = data;
this.resultDialogHidden = false;
this.importDialogHidden = true;
this.listDialogHidden = true;
this.isSearching = false;
if(data.length === 1){
this.addMonitor(data[0]);
this.autoOpenLastInfoWindow = true;
}else if(this.hasSameStandNo(data)){
this.addMonitorByGroup()
this.autoOpenLastInfoWindow = true;
}
}
}); */
term: this.searchText,
type: this.searchType
}).then((res)=>{
//res = mock.getCriteriaTreeList
if(res.returnCode == 0){
const data = res.data;
this.resultList = data;
this.resultDialogHidden = false;
this.importDialogHidden = true;
this.listDialogHidden = true;
this.isSearching = false;
if(data.length === 1){
this.addMonitor(data[0]);
this.autoOpenLastInfoWindow = true;
}else if(this.hasSameStandNo(data)){
this.addMonitorByGroup()
this.autoOpenLastInfoWindow = true;
}
}
}); */
},
// 根据搜索条件查询组织树结构
......@@ -936,6 +776,7 @@ export default {
if (!list || list.length <= 0) {
return false;
}
this.vidCode = list[0].vid;
for (var i = 0, len = list.length; i < len; i++) {
_this.handleSelect(list[i]);
}
......@@ -1003,10 +844,10 @@ export default {
// return isSame
// },
/*searchSubmit(){
console.log(mock.getMonitorDataByGroup)
console.log(mock.getMonitorDataByGroup)
EventBus.$emit('uiMap.monitor.draw', mock.getMonitorDataByGroup)
},*/
EventBus.$emit('uiMap.monitor.draw', mock.getMonitorDataByGroup)
},*/
// 导入成功
successUpload(res) {
......@@ -1049,12 +890,12 @@ export default {
// 文件上传前的钩子
beforeUpload(file) {
/*if(!/^.*\.(?:xlsx)$/.test(file.name)){
this.$message({
type: 'info',
message: '只能导入后缀为.xlsx的文件'
});
return false
}*/
this.$message({
type: 'info',
message: '只能导入后缀为.xlsx的文件'
});
return false
}*/
if (file.name == this.form.filename) {
this.importing = true;
return true;
......@@ -1078,7 +919,7 @@ export default {
_this.currentMessage = this.$message({
type: "error",
message: "该列表中有设备正在监控中,请勿重复监控",
onClose: function () {
onClose: function() {
_this.currentMessage = "";
},
});
......@@ -1115,20 +956,20 @@ export default {
});
} else {
/* let findExistItem = this.resultList.find((item)=>this.monitorList[item.sn]);
if(findExistItem){
this.$message({
type: 'error',
message: '该列表中有设备正在监控中,请勿重复监控'
});
}else{
this.resetRefreshCount = true;
this.resultList.forEach((item)=>{
this.monitorList[item.sn] = item;
this.monitorList.count++;
//EventBus.$emit('uiMap.monitor.draw', item);
});
this.getPositionData(this.resultList)
} */
if(findExistItem){
this.$message({
type: 'error',
message: '该列表中有设备正在监控中,请勿重复监控'
});
}else{
this.resetRefreshCount = true;
this.resultList.forEach((item)=>{
this.monitorList[item.sn] = item;
this.monitorList.count++;
//EventBus.$emit('uiMap.monitor.draw', item);
});
this.getPositionData(this.resultList)
} */
let filterList = items.filter((item) => {
return !this.monitorList[item.sn];
});
......@@ -1190,7 +1031,7 @@ export default {
// 获取设备位置点
getPositionData(arr) {
/* let _this = this;
arr = arr.filter((item)=>this.monitorList[item.sn]); */
arr = arr.filter((item)=>this.monitorList[item.sn]); */
let snStr = this.monitorList.itemArr.join(","); //arr.map((item)=>item.sn).join(',');
if (!snStr) return;
if (this.resetRefreshCount || this.remainSearchSnStr != snStr) {
......@@ -1221,6 +1062,8 @@ export default {
item = this.filterGpsBase(item);
item.isSource = relItem.source;
item.vidCode = this.vidCode
item.sourceType = this.sourceType
});
this.monitorList = Object.assign({}, this.monitorList);
let drawData = data.filter(
......@@ -1312,11 +1155,11 @@ export default {
console.log("drawDoneCb");
this._drawTimeoutId && window.clearTimeout(this._drawTimeoutId);
/* let arr = [];
for(let key in this.monitorList){
if(key !== 'count'){
arr.push(this.monitorList[key])
}
} */
for(let key in this.monitorList){
if(key !== 'count'){
arr.push(this.monitorList[key])
}
} */
this._drawTimeoutId = setTimeout(() => {
this.getPositionData();
......@@ -1413,7 +1256,7 @@ export default {
let oParams = {};
oParams.sns = sns;
GET_MONITOR_ONLINELIST(oParams).then((res) => {});
GET_MONITOR_ONLINELIST(oParams).then((res) => { });
},
},
created() {
......@@ -1457,6 +1300,7 @@ export default {
height: auto;
padding: 2px;
}
.custom-tree-node {
flex: 1;
display: flex;
......@@ -1466,40 +1310,51 @@ export default {
padding-right: 8px;
line-height: 26px;
}
.map-wrap .el-tree-node > .el-tree-node__children {
.map-wrap .el-tree-node>.el-tree-node__children {
overflow: visible;
}
.search_auto {
font-size: 12px;
}
.search_auto_hide {
display: none;
}
.search_auto .el-autocomplete-suggestion li {
padding: 0;
}
.search_auto .el-autocomplete-suggestion li div {
line-height: 20px;
}
.el-autocomplete-suggestion li {
border-bottom: 1px solid #eee;
padding-bottom: 4px;
}
.el-autocomplete-suggestion li:last-child {
border-bottom: none;
}
.full-width .main-wrap.full-width {
left: 0;
width: 100%;
}
.monitor_dialog_header {
display: flex;
align-items: center;
justify-content: space-between;
}
.monitor_dialog_header .i_refresh {
cursor: pointer;
}
.load_more_link {
color: #409eff;
}
......
......@@ -205,6 +205,13 @@ const routes = [
component: monitor
},
{
path: 'alarmAnalysis',
name: 'alarmAnlaysis',
meta: { title: '警情分析' },
component: () => import('pages/monitor/alarmAnalysis.vue'),
notMenu: true,
},
{
path: 'zoneCar',
name: 'zoneCar',
meta: { title: '区域查车' },
......
......@@ -9,6 +9,7 @@ const historyLocation = {
infowins: {},
bindEvent(){
EventBus.$on('uiMap.historyLocation.draw', (data)=>{
console.log(data, '--------');
this.destroy();
const MAP = mapService.map;
this.data = data;
......
......@@ -21,45 +21,45 @@ function MapService() {
var zhongliType = sessionStorage.getItem('zhongliType');//获取是否仲利账号状态,从本地内存中拿取数据
MapService.prototype = {
init: function (id,options) {
init: function(id, options) {
var self = this;
let params = options||{}
if(self.map){
let params = options || {}
if (self.map) {
self.map.destroy()
}
var map = new AMap.Map(id, {
resizeEnable: true,
zoom: params.zoom||11,
zoom: params.zoom || 11,
...params
});
// 添加比例尺
map.plugin(["AMap.Scale"], function () {
map.plugin(["AMap.Scale"], function() {
var scale = new AMap.Scale()
map.addControl(scale);
scale.show()
});
//距离测量
map.plugin(["AMap.RangingTool"], function () {
map.plugin(["AMap.RangingTool"], function() {
self.ruler = new AMap.RangingTool(map);
});
//定位
map.plugin('AMap.Geolocation', function () {
map.plugin('AMap.Geolocation', function() {
self.geolocation = new AMap.Geolocation();
});
self.map = map;
return self.map;
},
toggleMapType: function () {
toggleMapType: function() {
var self = this;
let _map = self.map;
self.type = self.type ? 0 : 1; //0:使用2D地图,1:混合图
_map.plugin(["AMap.MapType"],function(){
_map.plugin(["AMap.MapType"], function() {
//地图类型切换
let _mapType= new AMap.MapType({
let _mapType = new AMap.MapType({
defaultType: self.type,
});
_map.addControl(_mapType);
......@@ -80,7 +80,7 @@ MapService.prototype = {
} else {
// 地图上设置图层
self.map.remove(self.mixLayers);
/*self.map.plugin(["AMap.MapType"],function(){
//地图类型切换
var type = new window.AMap.MapType({
......@@ -90,18 +90,18 @@ MapService.prototype = {
});*/
}
},
rulerTurnOn: function () {
rulerTurnOn: function() {
this.ruler.turnOn();
},
rulerTurnOff: function () {
rulerTurnOff: function() {
this.ruler.turnOff();
},
getCurrentLocation: function () {
getCurrentLocation: function() {
var self = this;
self.geolocation.getCurrentPosition(function(status,result){
self.geolocation.getCurrentPosition(function(status, result) {
console.log(status);
console.log(result);
if(status == 'complete'){
if (status == 'complete') {
self.currentMarker && self.map.remove(self.currentMarker);
var lnglatXY = self.getLngLat(result.position.lng, result.position.lat);
self.currentMarker = self.createMarker(lnglatXY);
......@@ -121,7 +121,7 @@ MapService.prototype = {
// });
},
createMarker: function (lnglatXY) {
createMarker: function(lnglatXY) {
var marker = new AMap.Marker({
position: lnglatXY,
icon: require('images/mapLocation.gif'),
......@@ -130,7 +130,7 @@ MapService.prototype = {
});
return marker;
},
createPointMarker: function (lnglatXY) {
createPointMarker: function(lnglatXY) {
var marker = new AMap.Marker({
position: lnglatXY,
icon: require('images/point.png'),
......@@ -139,7 +139,7 @@ MapService.prototype = {
});
return marker;
},
createConstantMarker: function (lnglatXY, map) {
createConstantMarker: function(lnglatXY, map) {
var marker = new AMap.Marker({
position: lnglatXY,
icon: require('images/icon_constant.png'),
......@@ -148,7 +148,7 @@ MapService.prototype = {
});
return marker;
},
createCarMarker: function (lnglatXY, map) {
createCarMarker: function(lnglatXY, map) {
var marker = new AMap.Marker({
position: lnglatXY,
icon: require('images/icon_car.png'),
......@@ -219,7 +219,7 @@ MapService.prototype = {
});
return marker;
},
createStartMarker: function (lnglatXY, map) {
createStartMarker: function(lnglatXY, map) {
var marker = new AMap.Marker({
position: lnglatXY,
icon: require('images/icon_start.png'),
......@@ -229,7 +229,7 @@ MapService.prototype = {
});
return marker;
},
createEndMarker: function (lnglatXY, map) {
createEndMarker: function(lnglatXY, map) {
var marker = new AMap.Marker({
position: lnglatXY,
icon: require('images/icon_end.png'),
......@@ -239,14 +239,14 @@ MapService.prototype = {
});
return marker;
},
createPolyline: function (map) {
createPolyline: function(map) {
return new AMap.Polyline({
map: map,
strokeWeight: 2,
strokeColor: '#009944'
});
},
createCircle: function (lnglatXY, map, radius) {
createCircle: function(lnglatXY, map, radius) {
return new AMap.Circle({
map: map,
center: lnglatXY,
......@@ -258,7 +258,7 @@ MapService.prototype = {
fillOpacity: 0.1
});
},
createPoint: function (lnglatXY, map) {
createPoint: function(lnglatXY, map) {
return new AMap.Circle({
map: map,
center: lnglatXY,
......@@ -278,20 +278,19 @@ MapService.prototype = {
});
marker.infoWindow = infoWindow;
// var clipboard = new ClipboardJS(div.querySelector('.copy-btn'));
if(clipboard){
if (clipboard) {
clipboard.destroy();
}
clipboard = new ClipboardJS('.copy-btn',{
text:function(trigger){
}
clipboard = new ClipboardJS('.copy-btn', {
text: function(trigger) {
return trigger.getAttribute('aria-label');
}
})
clipboard.on('success', function (e) {
clipboard.on('success', function(e) {
e.clearSelection();
EventBus.$emit('uiMap.copySuccess');
});
clipboard.on('error', function (e) {
clipboard.on('error', function(e) {
});
if (isInfoOpen) {
......@@ -307,18 +306,47 @@ MapService.prototype = {
}
return infoWindow;
},
// createInfoWindow(marker, map, div, isInfoOpen, isInfoAutoMove) {
// var infoWindow = new AMap.InfoWindow({
// offset: new AMap.Pixel(0, 0),
// content: div,
// autoMove: !!isInfoAutoMove,
// })
// marker.infoWindow = infoWindow
// var clipboard = new ClipboardJS(div.querySelector('.copy-btn'))
// clipboard.on('success', function (e) {
// e.clearSelection()
// EventBus.$emit('uiMap.copySuccess')
// })
// clipboard.on('error', function (e) {
// console.error('Action:', e.action)
// console.error('Trigger:', e.trigger)
// })
// if (isInfoOpen) {
// infoWindow.open(map, marker.getPosition())
// }
// //给Marker绑定单击事件
// marker.on('click', markerClick)
// function markerClick(e) {
// //infoWindow.setContent(e.target.content);
// infoWindow.open(map, e.target.getPosition())
// }
// return infoWindow
// },
// 初始化复制事件
initCopyEvent(){
var clipboard = new ClipboardJS('.copy-btn',{
text:function(trigger){
initCopyEvent() {
var clipboard = new ClipboardJS('.copy-btn', {
text: function(trigger) {
return trigger.getAttribute('aria-label');
}
})
},
// 车辆监控-查看位置点
bindMonitorInfoWindow: function (marker, map, info, isInfoOpen, isInfoAutoMove) {
bindMonitorInfoWindow: function(marker, map, info, isInfoOpen, isInfoAutoMove) {
var self = this;
var infoDiv = document.createElement('div');
infoDiv.innerHTML = self.createMonitorInfo(info);
......@@ -327,12 +355,12 @@ MapService.prototype = {
var statusArr = ['行驶中', '静止', '离线', '在线']
if (info.status === 2) {
let _msg = `${statusArr[info.status]} | 已离线${info.statusTime && info.statusTime != null?info.statusTime:''}`;
let _msg = `${statusArr[info.status]} | 已离线${info.statusTime && info.statusTime != null ? info.statusTime : ''}`;
infoDiv.querySelector('[data-status]').textContent = _msg;
infoDiv.querySelector('[data-status]').setAttribute('aria-label',_msg)
infoDiv.querySelector('[data-status]').setAttribute('aria-label', _msg)
} else {
infoDiv.querySelector('[data-status]').textContent = statusArr[info.status];
infoDiv.querySelector('[data-status]').setAttribute('aria-label',statusArr[info.status]);
infoDiv.querySelector('[data-status]').setAttribute('aria-label', statusArr[info.status]);
}
infoDiv.querySelector('[data-time]').textContent = eLocation.dateTime;
......@@ -364,7 +392,7 @@ MapService.prototype = {
}
// 基站
baseBtn && (baseBtn.onclick = function (e) {
baseBtn && (baseBtn.onclick = function(e) {
if (info.eLocateType === 'bsLocation') return;
info.eLocateType = 'bsLocation'
eLocation = info[info.eLocateType];
......@@ -389,7 +417,7 @@ MapService.prototype = {
})
// gps
gpsBtn && (gpsBtn.onclick = function (e) {
gpsBtn && (gpsBtn.onclick = function(e) {
if (info.eLocateType === 'gpsLocation') return;
info.eLocateType = 'gpsLocation'
eLocation = info[info.eLocateType];
......@@ -415,7 +443,7 @@ MapService.prototype = {
// wifi数据
wifiBtn && (wifiBtn.onclick = function (e) {
wifiBtn && (wifiBtn.onclick = function(e) {
if (info.wifiLocation && info.wifiLocation.elng) {
console.log(info)
if (info.eLocateType === 'wifiLocation') return;
......@@ -470,7 +498,7 @@ MapService.prototype = {
if (info.isSource != 1) {
historyBtn.classList.add('history_btn_grey');
}
historyBtn.onclick = function () {
historyBtn.onclick = function() {
if (info.isSource == 1) {
mapService.openPage(`#/monitor/historyLocation?${queryCode}`)
}
......@@ -483,7 +511,7 @@ MapService.prototype = {
if (info.isSource != 1) {
residentBtn.classList.add('resident_btn_grey');
}
residentBtn.onclick = function () {
residentBtn.onclick = function() {
if (info.isSource == 1) {
queryCode = `sn=${info.sn}&name=${encodeURI(info.name)}&standno=${info.standNo}&locationType=${info.eLocateType}`
mapService.openPage(`#/monitor/resident?${queryCode}`)
......@@ -494,11 +522,24 @@ MapService.prototype = {
// 跳转到轨迹回放页面
let replayBtn = infoDiv.querySelector('[data-replay]');
if (replayBtn) {
replayBtn.onclick = function () {
replayBtn.onclick = function() {
mapService.openPage(`#/monitor/replay?${queryCode}`)
}
}
// 跳转到风险评估页面 无线设备不显示按钮 info.deviceCompose=010/020/011/012/013/022,需要有风险评估按钮出现
let riskBtn = infoDiv.querySelector('[data-risk]');
if (riskBtn) {
if (info.deviceCompose != '010' && info.deviceCompose != '020' && info.deviceCompose != '011' && info.deviceCompose != '012' && info.deviceCompose != '013' && info.deviceCompose != '022') {
riskBtn.classList.add('resident_btn_hidden');
}
riskBtn.onclick = function() {
let id = info.vidCode || localStorage.getItem('vehicleId');
queryCode = `vehicleId=${id}`
mapService.openPage(`#/monitor/alarmAnalysis?${queryCode}`)
}
}
// 跳转到电子围栏页面 无线设备不能跳转电子围栏 isSource:1有线,其他无线
let fenceBtn = infoDiv.querySelector('[data-fence]');
// 判断是否分配了电子围栏按钮权限
......@@ -513,7 +554,7 @@ MapService.prototype = {
}
// v1.25.0版本需求,无线设备和有线设备都支持围栏
queryCode = `sn=${info.sn}&name=${encodeURI(info.name)}&standno=${info.standNo}&source=${info.isSource}`;
fenceBtn.onclick = function () {
fenceBtn.onclick = function() {
if (fencePermission) {
mapService.openPage(`#/monitor/fence?${queryCode}`)
}
......@@ -533,14 +574,14 @@ MapService.prototype = {
// 浮窗点击事件
let questionIcon = infoDiv.querySelector('.question_icon');
if(questionIcon){
if (questionIcon) {
let _obj = infoDiv.querySelector('.popover_box');
questionIcon.addEventListener('mouseenter',function(e){
questionIcon.addEventListener('mouseenter', function(e) {
console.log(e.stopPropagation)
_obj.style.display = 'block';
e.stopPropagation()
})
questionIcon.addEventListener('mouseleave',function(e){
questionIcon.addEventListener('mouseleave', function(e) {
_obj.style.display = 'none';
e.stopPropagation()
})
......@@ -554,7 +595,15 @@ MapService.prototype = {
var self = this;
var infoDiv = document.createElement('div');
infoDiv.innerHTML = self.createLocationInfo(info);
// let addressCopyBtn = infoDiv.querySelector('[address-copy]');
let addressCopyBtn = new ClipboardJS(infoDiv.querySelector('.address-copy'));
console.log(addressCopyBtn, 'addressCopyBtn');
addressCopyBtn.on('success', function(e) {
e.clearSelection();
EventBus.$emit('uiMap.copySuccess');
});
addressCopyBtn.on('error', function(e) {
});
return this.createInfoWindow(marker, map, infoDiv);
},
bindResidentInfoWindow(marker, map, info) {
......@@ -602,22 +651,22 @@ MapService.prototype = {
}
infoDiv.querySelector('#locateTypeGps').onclick = function (e) {
infoDiv.querySelector('#locateTypeGps').onclick = function(e) {
fillGPS()
}
infoDiv.querySelector('#locateTypeBase').onclick = function (e) {
infoDiv.querySelector('#locateTypeBase').onclick = function(e) {
fillBase()
}
fillGPS();
return this.createInfoWindow(marker, map, infoDiv);
},
getLngLat: function (lng, lat) {
getLngLat: function(lng, lat) {
return new AMap.LngLat(lng, lat);
},
getGeocoder: function () {
getGeocoder: function() {
return new Promise((resolve) => {
AMap.service('AMap.Geocoder', function () {//回调函数
AMap.service('AMap.Geocoder', function() {//回调函数
var geocoder = new AMap.Geocoder({
batch: true
});
......@@ -625,8 +674,8 @@ MapService.prototype = {
});
})
},
getAddress: function (geocoder, lnglatXY) {
geocoder.getAddress(lnglatXY, function (status, result) {
getAddress: function(geocoder, lnglatXY) {
geocoder.getAddress(lnglatXY, function(status, result) {
if (status === 'complete' && result.info === 'OK') {
//获得了有效的地址信息:
//即,result.regeocode.formattedAddress
......@@ -635,15 +684,15 @@ MapService.prototype = {
}
});
},
zoomIn: function () {
zoomIn: function() {
this.map.zoomIn();
},
zoomOut: function () {
zoomOut: function() {
this.map.zoomOut();
},
// 监控弹框
createMonitorInfo: function (info) {
createMonitorInfo: function(info) {
/*var _html = '<h3 class="uimap-info-title">'+ info.name+'/'+ info.standNo +'</h3><div class="uimap-info-ct"><p><span><i class="fa fa-inbox"></i></span>'+ info.sn +'</p>';
if(info.time){
_html += '<p><span><i class="fa fa-clock-o"></i></span>'+ info.time +'</p>';
......@@ -728,6 +777,7 @@ MapService.prototype = {
<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>
<a class="redirect-btn" id="btn_risk" data-risk>风险评估</a>
</p>
</div>`;
......@@ -819,7 +869,7 @@ MapService.prototype = {
<div class="map-infowindow-ct">
<p><i class="icon icon-info_time"></i> 停留时间: <span class="des">${info.begintime}</span></p>
<p><i class="icon icon-info_location"></i> 停留地址: <span class="des adr" >${info.transferAddress}</span>
<a class="copy-btn" data-clipboard-text="${info.transferAddress}"><i class="icon icon-info_copy"></i></a>
<a class="copy-btn address-copy" id="address-copy" address-copy data-clipboard-text="${info.transferAddress}"><i class="icon icon-info_copy"></i></a>
</p>
<p><i class="icon icon-info_stop"></i> 停留时长: <span class="des">${info.duration}</span></p>
</div>`;
......@@ -836,10 +886,10 @@ MapService.prototype = {
</div>`;
},
clearMap: function (map) {
clearMap: function(map) {
this.map.clearMap();
},
setFitView: function (map) {
setFitView: function(map) {
this.map.setFitView();
},
bindClickEvent() {
......@@ -896,10 +946,10 @@ MapService.prototype = {
marker.infoWindow && marker.infoWindow.open(map, marker.getPosition());
}
infoDiv.querySelector('#locateTypeGps').onclick = function (e) {
infoDiv.querySelector('#locateTypeGps').onclick = function(e) {
fillGPS()
}
infoDiv.querySelector('#locateTypeBase').onclick = function (e) {
infoDiv.querySelector('#locateTypeBase').onclick = function(e) {
fillBase()
}
......@@ -943,15 +993,15 @@ MapService.prototype = {
},
// 区域查车弹框
createAraeInfowindow(info){
createAraeInfowindow(info) {
let _types = {
1:'有线设备',
0:'无线设备'
1: '有线设备',
0: '无线设备'
}
let _div = `<h3 class="map-infowindow-title">${info.ownerName || '--'}/${info.vin || '--'}</h3>
<div class="map-infowindow-ct">
<p><i class="icon icon-info_device"></i> 设备号:<span class="des"> ${info.sn||'--'} (${_types[info.source]||'--'})</span>
<span class="battery" data-battery style="display:${info.battery?'block':'none'}">
<p><i class="icon icon-info_device"></i> 设备号:<span class="des"> ${info.sn || '--'} (${_types[info.source] || '--'})</span>
<span class="battery" data-battery style="display:${info.battery ? 'block' : 'none'}">
<i class="fill"><i class="fill-percentage" data-battery-percentage style="width:${info.battery}%;"></i></i>
<i class="icon icon-battery_enough"></i>
<i class="text" data-battery-text>${info.battery}</i>
......@@ -961,32 +1011,32 @@ MapService.prototype = {
offset: new AMap.Pixel(0, -20),
content: _div,
autoMove: true,
position:[info.lng,info.lat]
position: [info.lng, info.lat]
})
return infoWindow
},
// 创建poi信息弹框
createPoiMarkerInfowindow(info){
createPoiMarkerInfowindow(info) {
let infoDiv = document.createElement('div');
let _div = `<div class="map_poi_infowindow_popup"><h3 class="map_poi_infowindow_title">${info.address || '暂无地址'}</h3>
<div class="map_poi_infowindow_content">
<span class="near_address">${info.near||'无'}${info.near?'附近':''}</span>
<span class="near_address">${info.near || '无'}${info.near ? '附近' : ''}</span>
<button href="javascript:void(0)" class="clear_link" data-poi-delete>删除</button>
</div></div>`;
infoDiv.innerHTML = _div;
infoDiv.querySelector('[data-poi-delete]').onclick = function (e) {
infoDiv.querySelector('[data-poi-delete]').onclick = function(e) {
console.log(e);
EventBus.$emit('uiMap.poi.marker.delete',info);
EventBus.$emit('uiMap.poi.marker.delete', info);
}
var infoWindow = new AMap.InfoWindow({
offset: new AMap.Pixel(12, -5),
content: infoDiv,
autoMove: true,
position:[info.lng,info.lat],
position: [info.lng, info.lat],
})
return infoWindow
}
},
}
......
......@@ -153,7 +153,6 @@ const monitor = {
const MAP = mapService.map;
this.data = data;
const transferObj = []
data.forEach((item) => {
if (item.gpsLocation && item.gpsLocation.elat && item.gpsLocation.elng) {
transferObj.push(item.gpsLocation)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!