Commit 4852e9bb authored by 张牧越's avatar 张牧越

AI预警联调

parent 62a270e3
......@@ -111,6 +111,15 @@ export function getWarningList(params) {
})
}
export function getStatis(params) {
return request({
url: '/pweb/s/aiwarning/statis',
method: 'get',
params
})
}
export function getMonthWarningStatis() {
return request({
url: '/pweb/s/aiwarning/month/statis',
......
......@@ -104,7 +104,12 @@
</div>
</template>
<script>
import { getAIdata, getWarningList, getMonthWarningStatis } from "@/api/index";
import {
getAIdata,
getWarningList,
getMonthWarningStatis,
getStatis,
} from "@/api/index";
export default {
name: "EarlyWarning",
data() {
......@@ -113,12 +118,10 @@ export default {
classOption: {
singleHeight: 152,
},
pieChartData: [
{ value: 30, name: "已处理" },
{ value: 10, name: "未处理" },
],
screenDetail: {},
date: "",
todayPieChartData: {},
historyChartData: {},
};
},
methods: {
......@@ -211,18 +214,24 @@ export default {
this.$echarts.getInstanceByDom(entry.target).resize();
}
});
resizeOb.observe(document.getElementById("today-chart"));
resizeOb.observe(document.getElementById("history-chart"));
resizeOb.observe(document.getElementById("warning-chart"));
});
},
renderTodayChart() {
const chartData = [
{ value: this.todayPieChartData.yclCount, name: "已处理" },
{ value: this.todayPieChartData.wclCount, name: "未处理" },
];
const chart = this.$echarts.init(this.$refs.todayChart);
let total = 0;
chartData.map((item) => {
total += item.value;
});
const option = {
title: {
x: "27%", //X坐标
y: "37%",
text: "5",
text: total,
subtext: "今日整改",
textAlign: "center",
textStyle: {
......@@ -264,7 +273,7 @@ export default {
},
},
formatter: (name) => {
let data = this.pieChartData;
let data = chartData;
let target;
for (let i = 0, l = data.length; i < l; i++) {
if (data[i].name == name) {
......@@ -290,19 +299,36 @@ export default {
position: "center",
},
data: this.pieChartData,
data: chartData,
},
],
};
chart.setOption(option);
this.$nextTick(() => {
// 解决echarts图表放大溢出父容器
const resizeOb = new ResizeObserver((entries) => {
for (const entry of entries) {
this.$echarts.getInstanceByDom(entry.target).resize();
}
});
resizeOb.observe(document.getElementById("today-chart"));
});
},
renderHistoryChart() {
const chartData = [
{ value: this.historyChartData.yclCount, name: "已处理" },
{ value: this.historyChartData.wclCount, name: "未处理" },
];
let total = 0;
chartData.map((item) => {
total += item.value;
});
const chart = this.$echarts.init(this.$refs.historyChart);
const option = {
title: {
x: "27%", //X坐标
y: "37%",
text: "10",
text: total,
subtext: "历史整改",
textAlign: "center",
textStyle: {
......@@ -344,7 +370,7 @@ export default {
},
},
formatter: (name) => {
let data = this.pieChartData;
let data = chartData;
let target;
for (let i = 0, l = data.length; i < l; i++) {
if (data[i].name == name) {
......@@ -370,11 +396,20 @@ export default {
position: "center",
},
data: this.pieChartData,
data: chartData,
},
],
};
chart.setOption(option);
this.$nextTick(() => {
// 解决echarts图表放大溢出父容器
const resizeOb = new ResizeObserver((entries) => {
for (const entry of entries) {
this.$echarts.getInstanceByDom(entry.target).resize();
}
});
resizeOb.observe(document.getElementById("history-chart"));
});
},
getAIdata() {
getAIdata().then((res) => {
......@@ -400,6 +435,18 @@ export default {
}, 60000);
}
});
// 今日统计
getStatis({
start_log_time: `${this.date} 00:00:00`,
end_log_time: `${this.date} 23:59:59`,
}).then((res) => {
this.todayPieChartData = res.data;
this.renderTodayChart();
});
getStatis().then((res) => {
this.historyChartData = res.data;
this.renderHistoryChart();
});
getMonthWarningStatis().then((res) => {
if (res.status == 200) {
this.warningChartData = res.data;
......@@ -412,8 +459,6 @@ export default {
mounted() {
this.getTime();
this.getAIdata();
this.renderTodayChart();
this.renderHistoryChart();
},
};
</script>
......
......@@ -61,7 +61,7 @@
>
<span class="name">经理 / 王一</span>
</div>
<div class="recent-open">最近开机:2023-03-12</div>
<div class="recent-open">最近使用:2023-03-12</div>
<div class="cap-operation">
<div
:class="['cap-button', windowData.online ? 'active' : 'disabled']"
......
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