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

修改首页统计图

No related merge requests found
...@@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.*;
* @author zxfei * @author zxfei
* @date 2022-06-28 * @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 { public interface IAreaFeign extends IFeign {
......
...@@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.*;
* @author zxfei * @author zxfei
* @date 2022-07-06 * @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 { public interface IUserFeign extends IFeign {
......
...@@ -211,6 +211,8 @@ export default { ...@@ -211,6 +211,8 @@ export default {
this.findDeviceTotalStat(beforeday); this.findDeviceTotalStat(beforeday);
this.findDeviceStat(beforeday); this.findDeviceStat(beforeday);
this.findDeviceAlarm(beforeday);
}, },
methods: { methods: {
findDeviceTotalStat(beforeday) { findDeviceTotalStat(beforeday) {
...@@ -272,6 +274,33 @@ export default { ...@@ -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) { formatterDate(time) {
let date = new Date(Number(time)); let date = new Date(Number(time));
let Y = date.getFullYear() + "-"; let Y = date.getFullYear() + "-";
...@@ -472,6 +501,84 @@ export default { ...@@ -472,6 +501,84 @@ export default {
deviceStatChart.setOption(deviceStatOption); 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() { data() {
return { return {
...@@ -483,10 +590,13 @@ export default { ...@@ -483,10 +590,13 @@ export default {
pendList: [], pendList: [],
beforeday: [], beforeday: [],
beforeDeviceStatday: [], beforeDeviceStatday: [],
beforeAlarmday: [],
deviceTotalyData: [], deviceTotalyData: [],
deviceOnlineyData: [], deviceOnlineyData: [],
deviceStatOnlineyData: [], deviceStatOnlineyData: [],
deviceStatOfflineyData: [], deviceStatOfflineyData: [],
deviceAlarmyData: [],
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