407 lines
7.1 KiB
Vue
407 lines
7.1 KiB
Vue
<template>
|
|
<Card title="近30天报警情况统计">
|
|
<div class="load-top-right">
|
|
<div id="pitWeekWarn" style="width: 100%; height: 100%"></div>
|
|
</div>
|
|
</Card>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { onMounted, ref } from "vue";
|
|
import * as echarts from "echarts";
|
|
import Card from "@/components/card.vue";
|
|
import { GlobalStore } from "@/stores";
|
|
import { noop } from "@vueuse/core";
|
|
const store = GlobalStore();
|
|
const airType = ref(1);
|
|
// 选中
|
|
let checked = ref(1);
|
|
function getNowData(type: any) {
|
|
checked.value = type;
|
|
// 初始化option
|
|
// initOption();
|
|
}
|
|
function getWeekData(type: any) {
|
|
checked.value = type;
|
|
// 初始化option
|
|
// initOption();
|
|
}
|
|
function getMonthData(type: any) {
|
|
checked.value = type;
|
|
// 初始化option
|
|
// initOption();
|
|
}
|
|
let rangeTime = ref("" as any);
|
|
let dataList = ref([
|
|
{
|
|
value: 25,
|
|
show: true,
|
|
name: "超出控制值",
|
|
|
|
itemStyle: {
|
|
normal: {
|
|
color: "#EC6266",
|
|
borderWidth: 20
|
|
}
|
|
}
|
|
},
|
|
{
|
|
value: 75,
|
|
show: true,
|
|
name: "超出报警值",
|
|
itemStyle: {
|
|
normal: {
|
|
color: "#EEA959",
|
|
borderWidth: 20
|
|
}
|
|
}
|
|
}
|
|
]);
|
|
function Pie() {
|
|
let dataArr = [];
|
|
for (let i = 0; i < 150; i++) {
|
|
if (i % 2 === 0) {
|
|
dataArr.push({
|
|
name: (i + 1).toString(),
|
|
value: 10,
|
|
itemStyle: {
|
|
normal: {
|
|
color: "#7cf4f1",
|
|
borderWidth: 0,
|
|
borderColor: "#7f6546"
|
|
}
|
|
}
|
|
});
|
|
} else {
|
|
dataArr.push({
|
|
name: (i + 1).toString(),
|
|
value: 10,
|
|
itemStyle: {
|
|
normal: {
|
|
color: "rgba(0,0,0,0)",
|
|
borderWidth: 0,
|
|
borderColor: "rgba(0,0,0,0)"
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
return dataArr;
|
|
}
|
|
|
|
onMounted(() => {
|
|
drawEchart();
|
|
});
|
|
|
|
function drawEchart() {
|
|
let max = 0;
|
|
dataList.value.map(item => {
|
|
max = max + item.value;
|
|
});
|
|
let echartsTest = echarts.init(document.getElementById("pitWeekWarn"));
|
|
let option = {
|
|
tooltip: {
|
|
trigger: "item",
|
|
backgroundColor: "rgba(0, 0, 0, 0.9)",
|
|
borderColor: "#010306",
|
|
textStyle: {
|
|
color: "#FFFFFF"
|
|
},
|
|
formatter: function (params) {
|
|
// console.log(params.seriesName, "当前图例");
|
|
let result = " " + params.marker + params.name + " : " + params.value;
|
|
if (params.seriesName == "数据主体") {
|
|
return result;
|
|
}
|
|
}
|
|
},
|
|
title: {
|
|
text: max,
|
|
subtext: "风险总数",
|
|
x: "55%",
|
|
y: "26%",
|
|
textAlign: "right",
|
|
textStyle: {
|
|
color: "#fff",
|
|
fontSize: 26,
|
|
fontWeight: "normal",
|
|
fontFamily: "sadigitalNumber",
|
|
lineHeight: 50
|
|
},
|
|
subtextStyle: {
|
|
color: "#ccc",
|
|
fontSize: 14,
|
|
fontWeight: "normal"
|
|
}
|
|
},
|
|
legend: {
|
|
selectedMode: false, // 取消图例上的点击事件
|
|
icon: "rect",
|
|
type: "plain",
|
|
orient: "vertical",
|
|
left: "center",
|
|
bottom: "10%",
|
|
itemGap: 20,
|
|
itemWidth: 10, // 设置宽度
|
|
itemHeight: 10, // 设置高度
|
|
symbolKeepAspect: false,
|
|
textStyle: {
|
|
fontSize: 14,
|
|
color: "#FFFFFF",
|
|
rich: {
|
|
name: {
|
|
width: 110,
|
|
verticalAlign: "left"
|
|
},
|
|
value: {
|
|
width: 110,
|
|
fontSize: 14,
|
|
color: "#FFFFFF"
|
|
}
|
|
}
|
|
},
|
|
data: dataList.value.map(item => {
|
|
if (item.show) {
|
|
return item.name;
|
|
}
|
|
}),
|
|
formatter: function (data: any) {
|
|
if (dataList.value && dataList.value.length) {
|
|
for (let i = 0; i < dataList.value.length; i++) {
|
|
if (data === dataList.value[i].name) {
|
|
let value = dataList.value[i].value;
|
|
let valuePercent = ((dataList.value[i].value / max) * 100).toFixed(2);
|
|
return "{name| " + data + "}" + "{value| " + value + "个}" + valuePercent + "%";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
series: [
|
|
// 外侧光线
|
|
{
|
|
name: "",
|
|
type: "gauge",
|
|
center: ["50%", "37%"],
|
|
radius: "55%",
|
|
startAngle: 235,
|
|
endAngle: -50,
|
|
min: 0,
|
|
max: 100,
|
|
axisLine: {
|
|
show: true,
|
|
lineStyle: {
|
|
width: 2,
|
|
color: [
|
|
[
|
|
100 / 100,
|
|
new echarts.graphic.LinearGradient(0, 0, 1, 0, [
|
|
{
|
|
offset: 0,
|
|
color: "#526277"
|
|
},
|
|
{
|
|
offset: 0.25,
|
|
color: "rgba(4, 14, 54,0.4)"
|
|
},
|
|
{
|
|
offset: 0.7,
|
|
color: "rgba(4, 14, 54,0.4)"
|
|
},
|
|
{
|
|
offset: 1,
|
|
color: "#526277"
|
|
}
|
|
])
|
|
],
|
|
[1, "rgba(255,255,255,0)"]
|
|
]
|
|
}
|
|
},
|
|
|
|
axisTick: {
|
|
show: 0
|
|
},
|
|
splitLine: {
|
|
show: 0
|
|
},
|
|
axisLabel: {
|
|
show: 0
|
|
},
|
|
pointer: {
|
|
show: 0
|
|
},
|
|
detail: {
|
|
show: 0
|
|
}
|
|
},
|
|
{
|
|
name: "",
|
|
type: "gauge",
|
|
center: ["50%", "37%"],
|
|
radius: "47%",
|
|
startAngle: 245,
|
|
endAngle: -115,
|
|
min: 0,
|
|
max: 100,
|
|
axisLine: {
|
|
show: true,
|
|
lineStyle: {
|
|
width: 2,
|
|
color: [
|
|
[
|
|
200 / 100,
|
|
new echarts.graphic.LinearGradient(0, 0, 1, 0, [
|
|
{
|
|
offset: 0.8,
|
|
color: "#52bef0"
|
|
},
|
|
{
|
|
offset: 0.5,
|
|
color: "#13356b"
|
|
}
|
|
])
|
|
],
|
|
[1, "rgba(255,255,255,0)"]
|
|
]
|
|
}
|
|
},
|
|
|
|
axisTick: {
|
|
show: 0
|
|
},
|
|
splitLine: {
|
|
show: 0
|
|
},
|
|
axisLabel: {
|
|
show: 0
|
|
},
|
|
pointer: {
|
|
show: 0
|
|
},
|
|
detail: {
|
|
show: 0
|
|
}
|
|
},
|
|
{
|
|
name: "数据主体",
|
|
type: "pie",
|
|
radius: ["37%", "40%"],
|
|
center: ["50%", "37%"],
|
|
hoverAnimation: true,
|
|
itemStyle: {
|
|
borderRadius: 10,
|
|
borderWidth: 10
|
|
},
|
|
label: {
|
|
show: false,
|
|
position: "center"
|
|
},
|
|
emphasis: {
|
|
label: {
|
|
show: false
|
|
}
|
|
},
|
|
labelLine: {
|
|
show: false
|
|
},
|
|
data: dataList.value
|
|
},
|
|
{
|
|
type: "pie",
|
|
radius: ["32%", "33%"],
|
|
center: ["50%", "37%"],
|
|
label: {
|
|
show: false
|
|
},
|
|
data: Pie()
|
|
}
|
|
]
|
|
};
|
|
echartsTest.setOption(option, true);
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.load-top-right {
|
|
width: 100%;
|
|
height: 100%;
|
|
position: relative;
|
|
}
|
|
.num {
|
|
width: 66px;
|
|
text-align: center;
|
|
font-family: sadigitalNumber;
|
|
font-size: calc(100vw * 24 / 1920);
|
|
color: #fff;
|
|
position: absolute;
|
|
top: 45%;
|
|
left: 18%;
|
|
z-index: 9;
|
|
}
|
|
// .styleImg {
|
|
// left: 6%;
|
|
// top: 17%;
|
|
// width: 40%;
|
|
// position: absolute;
|
|
// height: 60%;
|
|
// background: url("@/assets/images/dustNoise/motionEffect.webp") no-repeat;
|
|
// background-size: cover;
|
|
// }
|
|
.select-right {
|
|
width: 35%;
|
|
display: flex;
|
|
position: absolute;
|
|
z-index: 10;
|
|
color: #fff;
|
|
font-size: 10px;
|
|
text-align: center;
|
|
line-height: 20px;
|
|
right: -1%;
|
|
top: 5%;
|
|
.selected {
|
|
height: 5%;
|
|
background: url("@/assets/images/dustNoise/rightImg2.png") no-repeat;
|
|
background-size: 100% 100%;
|
|
cursor: pointer;
|
|
}
|
|
.day {
|
|
padding: 0 6%;
|
|
margin-right: 5%;
|
|
z-index: 99;
|
|
}
|
|
.week {
|
|
padding: 0 6%;
|
|
margin-right: 5%;
|
|
z-index: 99;
|
|
}
|
|
.month {
|
|
padding: 0 6%;
|
|
z-index: 99;
|
|
}
|
|
.active {
|
|
background: url("@/assets/images/dustNoise/rightImg.png") no-repeat;
|
|
background-size: 100% 100%;
|
|
}
|
|
}
|
|
.time {
|
|
position: absolute;
|
|
z-index: 999;
|
|
left: 37%;
|
|
margin-top: -18%;
|
|
}
|
|
::v-deep .el-input__wrapper {
|
|
width: 85%;
|
|
height: 0%;
|
|
background: #0d2956;
|
|
}
|
|
::v-deep .el-range-separator {
|
|
color: #ccc;
|
|
font-size: 10px;
|
|
}
|
|
::v-deep .el-range-input {
|
|
color: #ccc;
|
|
font-size: 10px;
|
|
}
|
|
</style>
|