Commit 386a12e4 by 匡雅琴

bug修复

1 parent a3d6eeab
......@@ -22,7 +22,8 @@ export default {
xAxisData: {
type: Array,
default: () => ['1', '2', '3', '4', '5', '6']
}
},
linetype: Number
},
data() {
return {
......@@ -39,11 +40,11 @@ export default {
this.barLineOptions = {
xAxis: {
type: 'category',
name: '周',
name: this.linetype == 1 ? '周' : '天',
boundaryGap: true,//坐标轴两边留白
data: this.xAxisData,
axisLabel: { //坐标轴刻度标签的相关设置。
interval: 0,//设置为 1,表示『隔一个标签显示一个标签』
interval: this.linetype == 1 ? (this.dataList.length > 10 ? 4 : 0): 0,//设置为 1,表示『隔一个标签显示一个标签』
// margin:15,
textStyle: {
color: '#FFFFFF',
......
<template>
<div class="pie-box">
<div :id="id" :style="{ height: height }" class="pie-chart"></div>
<div>{{ list.length ? list[0].advise : '无' }}
<div>{{ list.length ? list[0].advise : '' }}
</div>
</div>
</template>
......@@ -73,11 +73,9 @@ export default {
draw() {
if (this.mTime) clearInterval(this.mTime)
this.echartsPie = echarts.init(document.getElementById(this.id))
console.log(this.list);
// 指定图表的配置项和数据
var storedList = this.list;
const pointerData = this.list.length ? this.list[0].value : 0
this.option = {
backgroundColor: "",
series: [{
......@@ -103,10 +101,35 @@ export default {
offsetCenter: [0, 60],
fontSize: 12,
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) {
return `无警情`;
return `无警情\n{b|${value}}`;
} else {
return `${storedList[0].alarmLevel / 1}级警情`;
return `${storedList[0].alarmLevel / 1}级警情\n{b|${value}}`;
}
},
rich: {
b: {
color: pointerData > 0 ? '#F38906' : '#4ED5D7'
}
},
textStyle: {
......@@ -131,25 +154,25 @@ export default {
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'
}
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"]
......
......@@ -43,7 +43,7 @@
</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-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>
......@@ -99,7 +99,8 @@
<div>
<div class="detail-msg-desc" v-for="item in basicData.deviceInformationVOList">
<div>{{ item.sourceStr }}-{{ item.sn }}</div>
<div>定位-{{ item.address }}</div>
<div v-show="item.deviceStateStr">{{ item.deviceStateStr }}</div>
<div>定位-{{ item.address || ' --' }}</div>
</div>
</div>
</template>
......@@ -113,7 +114,7 @@
<div class="use-car-box">
<div class="title">用车行为分析</div>
<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>
</div>
<div v-else class="empty-box">
......@@ -156,31 +157,31 @@ export default {
xAxisDataList: [],
pieList: [],
resultList: [],
linetype: 1
};
},
mounted() {
created() {
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 => {
window.AMap = AMap;
_this.initMap();
setTimeout(() => {
_this.getStayPointList(_vehicleId)
}, 500)
})
})
const _vehicleId = _this.$route.query.vehicleId
_this.getBasicInformation(_vehicleId)
_this.getResidentInformation(_vehicleId)
_this.getAlarmInformation(_vehicleId)
_this.getUserBehaviorInformation(_vehicleId)
},
methods: {
initMap() {
let check = () => {
this.checkMapLoaded && window.clearTimeout(this.checkMapLoaded);
return setTimeout(() => {
return this.$nextTick(() => {
if (
"AMap" in window &&
typeof AMap.Map == "function" &&
......@@ -194,7 +195,7 @@ export default {
} else {
this.checkMapLoaded = check();
}
}, 10);
});
};
this.checkMapLoaded = check();
},
......@@ -334,10 +335,12 @@ export default {
return
}
let _dataList = res.data.statisticsType == 1 ? res.data.userBehaviorWeekDTOList : res.data.userBehaviorDayDTOList
if (_dataList.length == 200) {
_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'
_dataList.forEach(item => {
......@@ -350,11 +353,11 @@ export default {
})
}
},
async created() {
EventBus.$on("uiMap.historyLocation.transferSuccess", (data) => {
this.resultList = [].concat(data);
});
},
// async created() {
// EventBus.$on("uiMap.historyLocation.transferSuccess", (data) => {
// this.resultList = [].concat(data);
// });
// },
beforeDestroy() {
// this.checkLoadedTimeoutId && window.clearTimeout(this.checkLoadedTimeoutId);
},
......
......@@ -270,44 +270,73 @@ MapService.prototype = {
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) {
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');
}
offset: new AMap.Pixel(0, 0),
content: div,
autoMove: !!isInfoAutoMove,
})
clipboard.on('success', function(e) {
e.clearSelection();
EventBus.$emit('uiMap.copySuccess');
});
clipboard.on('error', function(e) {
});
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());
infoWindow.open(map, marker.getPosition())
}
//给Marker绑定单击事件
marker.on('click', markerClick);
marker.on('click', markerClick)
function markerClick(e) {
//infoWindow.setContent(e.target.content);
infoWindow.open(map, e.target.getPosition());
//infoWindow.setContent(e.target.content);
infoWindow.open(map, e.target.getPosition())
}
return infoWindow;
},
return infoWindow
},
// 初始化复制事件
initCopyEvent() {
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!