Commit 386a12e4 by 匡雅琴

bug修复

1 parent a3d6eeab
...@@ -22,7 +22,8 @@ export default { ...@@ -22,7 +22,8 @@ export default {
xAxisData: { xAxisData: {
type: Array, type: Array,
default: () => ['1', '2', '3', '4', '5', '6'] default: () => ['1', '2', '3', '4', '5', '6']
} },
linetype: Number
}, },
data() { data() {
return { return {
...@@ -39,11 +40,11 @@ export default { ...@@ -39,11 +40,11 @@ export default {
this.barLineOptions = { this.barLineOptions = {
xAxis: { xAxis: {
type: 'category', type: 'category',
name: '周', name: this.linetype == 1 ? '周' : '天',
boundaryGap: true,//坐标轴两边留白 boundaryGap: true,//坐标轴两边留白
data: this.xAxisData, data: this.xAxisData,
axisLabel: { //坐标轴刻度标签的相关设置。 axisLabel: { //坐标轴刻度标签的相关设置。
interval: 0,//设置为 1,表示『隔一个标签显示一个标签』 interval: this.linetype == 1 ? (this.dataList.length > 10 ? 4 : 0): 0,//设置为 1,表示『隔一个标签显示一个标签』
// margin:15, // margin:15,
textStyle: { textStyle: {
color: '#FFFFFF', color: '#FFFFFF',
......
<template> <template>
<div class="pie-box"> <div class="pie-box">
<div :id="id" :style="{ height: height }" class="pie-chart"></div> <div :id="id" :style="{ height: height }" class="pie-chart"></div>
<div>{{ list.length ? list[0].advise : '无' }} <div>{{ list.length ? list[0].advise : '' }}
</div> </div>
</div> </div>
</template> </template>
...@@ -73,11 +73,9 @@ export default { ...@@ -73,11 +73,9 @@ export default {
draw() { draw() {
if (this.mTime) clearInterval(this.mTime) if (this.mTime) clearInterval(this.mTime)
this.echartsPie = echarts.init(document.getElementById(this.id)) this.echartsPie = echarts.init(document.getElementById(this.id))
console.log(this.list);
// 指定图表的配置项和数据 // 指定图表的配置项和数据
var storedList = this.list; var storedList = this.list;
const pointerData = this.list.length ? this.list[0].value : 0 const pointerData = this.list.length ? this.list[0].value : 0
this.option = { this.option = {
backgroundColor: "", backgroundColor: "",
series: [{ series: [{
...@@ -103,10 +101,35 @@ export default { ...@@ -103,10 +101,35 @@ export default {
offsetCenter: [0, 60], offsetCenter: [0, 60],
fontSize: 12, fontSize: 12,
formatter: function(val) { formatter: function(val) {
let value = ''
switch (pointerData) {
case 100:
value = '极高风险';
break;
case 80:
value = '高风险';
break;
case 60:
value = '中风险';
break;
case 40:
value = '低风险';
break;
case 20:
value = '安全';
break;
default:
value = '无风险';
}
if (!storedList.length) { if (!storedList.length) {
return `无警情`; return `无警情\n{b|${value}}`;
} else { } else {
return `${storedList[0].alarmLevel / 1}级警情`; return `${storedList[0].alarmLevel / 1}级警情\n{b|${value}}`;
}
},
rich: {
b: {
color: pointerData > 0 ? '#F38906' : '#4ED5D7'
} }
}, },
textStyle: { textStyle: {
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
</div> </div>
<div class="middle-box"> <div class="middle-box">
<div><span class="dot dot-1"></span>安全</div> <div><span class="dot dot-1"></span>安全</div>
<div><span class="dot dot-2"></span>低分险</div> <div><span class="dot dot-2"></span>低风险</div>
<div><span class="dot dot-3"></span>中风险</div> <div><span class="dot dot-3"></span>中风险</div>
<div><span class="dot dot-4"></span>高风险</div> <div><span class="dot dot-4"></span>高风险</div>
<div><span class="dot dot-5"></span>极高风险</div> <div><span class="dot dot-5"></span>极高风险</div>
...@@ -99,7 +99,8 @@ ...@@ -99,7 +99,8 @@
<div> <div>
<div class="detail-msg-desc" v-for="item in basicData.deviceInformationVOList"> <div class="detail-msg-desc" v-for="item in basicData.deviceInformationVOList">
<div>{{ item.sourceStr }}-{{ item.sn }}</div> <div>{{ item.sourceStr }}-{{ item.sn }}</div>
<div>定位-{{ item.address }}</div> <div v-show="item.deviceStateStr">{{ item.deviceStateStr }}</div>
<div>定位-{{ item.address || ' --' }}</div>
</div> </div>
</div> </div>
</template> </template>
...@@ -113,7 +114,7 @@ ...@@ -113,7 +114,7 @@
<div class="use-car-box"> <div class="use-car-box">
<div class="title">用车行为分析</div> <div class="title">用车行为分析</div>
<div class="line-charts" v-if="xAxisDataList.length"> <div class="line-charts" v-if="xAxisDataList.length">
<LineCharts id="useCarCharts" ref="useCarChartsRef" height="250px" :dataList="useCarData" <LineCharts id="useCarCharts" ref="useCarChartsRef" height="250px" :linetype="linetype" :dataList="useCarData"
:xAxisData="xAxisDataList"></LineCharts> :xAxisData="xAxisDataList"></LineCharts>
</div> </div>
<div v-else class="empty-box"> <div v-else class="empty-box">
...@@ -156,31 +157,31 @@ export default { ...@@ -156,31 +157,31 @@ export default {
xAxisDataList: [], xAxisDataList: [],
pieList: [], pieList: [],
resultList: [], resultList: [],
linetype: 1
}; };
}, },
mounted() { created() {
let _this = this; let _this = this;
const _vehicleId = _this.$route.query.vehicleId
_this.getBasicInformation(_vehicleId)
_this.getResidentInformation(_vehicleId)
_this.getAlarmInformation(_vehicleId)
_this.getUserBehaviorInformation(_vehicleId)
_this.$mapInit({ version: '1.4.2' }).then(AMap => { _this.$mapInit({ version: '1.4.2' }).then(AMap => {
window.AMap = AMap; window.AMap = AMap;
_this.initMap(); _this.initMap();
setTimeout(() => { setTimeout(() => {
_this.getStayPointList(_vehicleId) _this.getStayPointList(_vehicleId)
}, 500)
}) })
const _vehicleId = _this.$route.query.vehicleId })
_this.getBasicInformation(_vehicleId)
_this.getResidentInformation(_vehicleId)
_this.getAlarmInformation(_vehicleId)
_this.getUserBehaviorInformation(_vehicleId)
}, },
methods: { methods: {
initMap() { initMap() {
let check = () => { let check = () => {
this.checkMapLoaded && window.clearTimeout(this.checkMapLoaded); this.checkMapLoaded && window.clearTimeout(this.checkMapLoaded);
return this.$nextTick(() => {
return setTimeout(() => {
if ( if (
"AMap" in window && "AMap" in window &&
typeof AMap.Map == "function" && typeof AMap.Map == "function" &&
...@@ -194,7 +195,7 @@ export default { ...@@ -194,7 +195,7 @@ export default {
} else { } else {
this.checkMapLoaded = check(); this.checkMapLoaded = check();
} }
}, 10); });
}; };
this.checkMapLoaded = check(); this.checkMapLoaded = check();
}, },
...@@ -334,10 +335,12 @@ export default { ...@@ -334,10 +335,12 @@ export default {
return return
} }
let _dataList = res.data.statisticsType == 1 ? res.data.userBehaviorWeekDTOList : res.data.userBehaviorDayDTOList let _dataList = res.data.statisticsType == 1 ? res.data.userBehaviorWeekDTOList : res.data.userBehaviorDayDTOList
if (_dataList.length == 200) { _dataList ? _dataList : []
if (_dataList.length == 0) {
this.useCarData = [] this.useCarData = []
return return
} }
this.linetype = res.data.statisticsType
let _int = res.data.statisticsType == 1 ? 'weekInt' : 'dayInt' let _int = res.data.statisticsType == 1 ? 'weekInt' : 'dayInt'
let _type = res.data.statisticsType == 1 ? 'weekNum' : 'dayNum' let _type = res.data.statisticsType == 1 ? 'weekNum' : 'dayNum'
_dataList.forEach(item => { _dataList.forEach(item => {
...@@ -350,11 +353,11 @@ export default { ...@@ -350,11 +353,11 @@ export default {
}) })
} }
}, },
async created() { // async created() {
EventBus.$on("uiMap.historyLocation.transferSuccess", (data) => { // EventBus.$on("uiMap.historyLocation.transferSuccess", (data) => {
this.resultList = [].concat(data); // this.resultList = [].concat(data);
}); // });
}, // },
beforeDestroy() { beforeDestroy() {
// this.checkLoadedTimeoutId && window.clearTimeout(this.checkLoadedTimeoutId); // this.checkLoadedTimeoutId && window.clearTimeout(this.checkLoadedTimeoutId);
}, },
......
...@@ -270,44 +270,73 @@ MapService.prototype = { ...@@ -270,44 +270,73 @@ MapService.prototype = {
fillOpacity: 1 fillOpacity: 1
}); });
}, },
// 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'));
// if (clipboard) {
// clipboard.destroy();
// }
// clipboard = new ClipboardJS('.copy-btn', {
// text: function(trigger) {
// return trigger.getAttribute('aria-label');
// }
// })
// clipboard.on('success', function(e) {
// e.clearSelection();
// EventBus.$emit('uiMap.copySuccess');
// });
// clipboard.on('error', function(e) {
// });
// 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;
// },
createInfoWindow(marker, map, div, isInfoOpen, isInfoAutoMove) { createInfoWindow(marker, map, div, isInfoOpen, isInfoAutoMove) {
var infoWindow = new AMap.InfoWindow({ var infoWindow = new AMap.InfoWindow({
offset: new AMap.Pixel(0, 0), offset: new AMap.Pixel(0, 0),
content: div, content: div,
autoMove: !!isInfoAutoMove autoMove: !!isInfoAutoMove,
}); })
marker.infoWindow = infoWindow; marker.infoWindow = infoWindow
// var clipboard = new ClipboardJS(div.querySelector('.copy-btn')); var clipboard = new ClipboardJS(div.querySelector('.copy-btn'))
if (clipboard) { clipboard.on('success', function (e) {
clipboard.destroy(); e.clearSelection()
} EventBus.$emit('uiMap.copySuccess')
clipboard = new ClipboardJS('.copy-btn', { })
text: function(trigger) { clipboard.on('error', function (e) {
return trigger.getAttribute('aria-label'); console.error('Action:', e.action)
} console.error('Trigger:', e.trigger)
}) })
clipboard.on('success', function(e) {
e.clearSelection();
EventBus.$emit('uiMap.copySuccess');
});
clipboard.on('error', function(e) {
});
if (isInfoOpen) { if (isInfoOpen) {
infoWindow.open(map, marker.getPosition()); infoWindow.open(map, marker.getPosition())
} }
//给Marker绑定单击事件 //给Marker绑定单击事件
marker.on('click', markerClick); marker.on('click', markerClick)
function markerClick(e) { function markerClick(e) {
//infoWindow.setContent(e.target.content); //infoWindow.setContent(e.target.content);
infoWindow.open(map, e.target.getPosition()); infoWindow.open(map, e.target.getPosition())
} }
return infoWindow; return infoWindow
}, },
// 初始化复制事件 // 初始化复制事件
initCopyEvent() { initCopyEvent() {
var clipboard = new ClipboardJS('.copy-btn', { var clipboard = new ClipboardJS('.copy-btn', {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!