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

修改首页统计图

parent 40454629
...@@ -213,6 +213,8 @@ export default { ...@@ -213,6 +213,8 @@ export default {
this.findDeviceStat(beforeday); this.findDeviceStat(beforeday);
this.findDeviceAlarm(beforeday); this.findDeviceAlarm(beforeday);
this.findDevicePush(beforeday);
}, },
methods: { methods: {
findDeviceTotalStat(beforeday) { findDeviceTotalStat(beforeday) {
...@@ -301,6 +303,33 @@ export default { ...@@ -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) { formatterDate(time) {
let date = new Date(Number(time)); let date = new Date(Number(time));
let Y = date.getFullYear() + "-"; let Y = date.getFullYear() + "-";
...@@ -343,6 +372,15 @@ export default { ...@@ -343,6 +372,15 @@ export default {
subtext: "", subtext: "",
x: "center", x: "center",
}, },
tooltip: {
trigger: "axis",
axisPointer: {
type: "cross",
label: {
backgroundColor: "#6a7985",
},
},
},
legend: { legend: {
orient: "horizontal", orient: "horizontal",
...@@ -576,7 +614,53 @@ export default { ...@@ -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); chart.setOption(option);
}, },
}, },
...@@ -590,6 +674,7 @@ export default { ...@@ -590,6 +674,7 @@ export default {
pendList: [], pendList: [],
beforeday: [], beforeday: [],
beforeDeviceStatday: [], beforeDeviceStatday: [],
beforePushday: [],
beforeAlarmday: [], beforeAlarmday: [],
deviceTotalyData: [], deviceTotalyData: [],
...@@ -597,6 +682,7 @@ export default { ...@@ -597,6 +682,7 @@ export default {
deviceStatOnlineyData: [], deviceStatOnlineyData: [],
deviceStatOfflineyData: [], deviceStatOfflineyData: [],
deviceAlarmyData: [], deviceAlarmyData: [],
devicePushyData: [],
weekPerDay: { weekPerDay: {
xData: [], xData: [],
yData: [], 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