Commit 40454629 authored by 赵啸非's avatar 赵啸非

修改首页统计图

parent f5cf5a55
......@@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.*;
* @author zxfei
* @date 2022-06-28
*/
@FeignClient(name = "base-manager", path = "/base", fallback = AreaFeignFallbackFactory.class)
@FeignClient(name = "base-manager", path = "/base", fallbackFactory = AreaFeignFallbackFactory.class)
public interface IAreaFeign extends IFeign {
......
......@@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.*;
* @author zxfei
* @date 2022-07-06
*/
@FeignClient(name = "base-manager", path = "/base", fallback = UserFeignFallbackFactory.class)
@FeignClient(name = "base-manager", path = "/base", fallbackFactory = UserFeignFallbackFactory.class)
public interface IUserFeign extends IFeign {
......
......@@ -211,6 +211,8 @@ export default {
this.findDeviceTotalStat(beforeday);
this.findDeviceStat(beforeday);
this.findDeviceAlarm(beforeday);
},
methods: {
findDeviceTotalStat(beforeday) {
......@@ -272,6 +274,33 @@ export default {
});
},
findDeviceAlarm(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.beforeDeviceAlarmday = this.statArrayData.map((i) => {
let daystr = i.month + "-" + i.day;
return daystr;
});
this.deviceAlarmyData = this.statArrayData.map((i) => {
return i.alarmTotalCount;
});
this.$nextTick(() => {
this.deviceAlarmEcharts();
});
}
this.loading = false;
})
.catch((error) => {
this.$message.error(error.message);
});
},
formatterDate(time) {
let date = new Date(Number(time));
let Y = date.getFullYear() + "-";
......@@ -472,6 +501,84 @@ export default {
deviceStatChart.setOption(deviceStatOption);
},
deviceAlarmEcharts() {
var chart = this.$echarts.init(
document.getElementById("deviceAlarm")
);
let option = {
title: {
text: "设备告警趋势",
},
tooltip: {
trigger: "axis",
axisPointer: {
type: "cross",
label: {
backgroundColor: "#6a7985",
},
},
},
legend: {
data: ["告警次数"],
},
toolbox: {
feature: {
saveAsImage: {},
},
},
grid: {
left: "3%",
right: "4%",
bottom: "3%",
containLabel: true,
},
xAxis: [
{
type: "category",
boundaryGap: false,
data: this.beforeDeviceAlarmday,
},
],
yAxis: [
{
type: "value",
},
],
series: [
{
name: "告警次数",
type: "line",
stack: "Total",
smooth: true,
lineStyle: {
width: 0,
},
showSymbol: false,
areaStyle: {
opacity: 0.8,
color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: 'rgb(55, 162, 255)'
},
{
offset: 1,
color: 'rgb(116, 21, 219)'
}
]),
},
emphasis: {
focus: "series",
},
data: this.deviceAlarmyData,
}
],
};
chart.setOption(option);
},
},
data() {
return {
......@@ -483,10 +590,13 @@ export default {
pendList: [],
beforeday: [],
beforeDeviceStatday: [],
beforeAlarmday: [],
deviceTotalyData: [],
deviceOnlineyData: [],
deviceStatOnlineyData: [],
deviceStatOfflineyData: [],
deviceAlarmyData: [],
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