Commit 2a76bdb1 authored by 赵啸非's avatar 赵啸非

修改首页统计图

parent 40454629
......@@ -213,6 +213,8 @@ export default {
this.findDeviceStat(beforeday);
this.findDeviceAlarm(beforeday);
this.findDevicePush(beforeday);
},
methods: {
findDeviceTotalStat(beforeday) {
......@@ -301,6 +303,33 @@ export default {
});
},
findDevicePush(beforeday) {
let query = { createTimeStart: this.formatterDate(beforeday) };
this.$post("/device/stat/list", query)
.then((res) => {
if (res.code == 1) {
this.statArrayData = res.data.data;
this.beforeDevicePushday = this.statArrayData.map((i) => {
let daystr = i.month + "-" + i.day;
return daystr;
});
this.devicePushyData = this.statArrayData.map((i) => {
return i.pushTotalCount;
});
this.$nextTick(() => {
this.devicePushEcharts();
});
}
this.loading = false;
})
.catch((error) => {
this.$message.error(error.message);
});
},
formatterDate(time) {
let date = new Date(Number(time));
let Y = date.getFullYear() + "-";
......@@ -343,6 +372,15 @@ export default {
subtext: "",
x: "center",
},
tooltip: {
trigger: "axis",
axisPointer: {
type: "cross",
label: {
backgroundColor: "#6a7985",
},
},
},
legend: {
orient: "horizontal",
......@@ -576,7 +614,53 @@ export default {
}
],
};
chart.setOption(option);
},
devicePushEcharts() {
var chart = this.$echarts.init(
document.getElementById("devicePush")
);
let option = {
title: {
text: "设备消息推送趋势",
},
tooltip: {
trigger: "axis",
axisPointer: {
type: "cross",
label: {
backgroundColor: "#6a7985",
},
},
},
legend: {
data: ["告警次数"],
},
xAxis: [
{
type: "category",
data: this.beforeDevicePushday,
},
],
yAxis: [
{
type: "value",
},
],
series: [
{
name: "告警次数",
type: "line",
smooth: true,
data: this.devicePushyData,
}
],
};
chart.setOption(option);
},
},
......@@ -590,6 +674,7 @@ export default {
pendList: [],
beforeday: [],
beforeDeviceStatday: [],
beforePushday: [],
beforeAlarmday: [],
deviceTotalyData: [],
......@@ -597,6 +682,7 @@ export default {
deviceStatOnlineyData: [],
deviceStatOfflineyData: [],
deviceAlarmyData: [],
devicePushyData: [],
weekPerDay: {
xData: [],
yData: [],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment