404 lines
6.9 KiB
Vue
404 lines
6.9 KiB
Vue
<template>
|
|
<Card title="隐患等级分析">
|
|
<div class="leftBottomBox">
|
|
<div class="rightHeader">
|
|
<div class="day" :class="airType == 1 ? 'active' : ''" @click="airType = 1">近7天</div>
|
|
<div class="year" :class="airType == 2 ? 'active' : ''" @click="airType = 2">近30天</div>
|
|
<div class="time">
|
|
<el-date-picker
|
|
v-model="rangeTime"
|
|
type="daterange"
|
|
range-separator="至"
|
|
start-placeholder="开始日期"
|
|
end-placeholder="结束日期"
|
|
value-format="YYYY-MM-DD"
|
|
:clearable="false"
|
|
/>
|
|
</div>
|
|
</div>
|
|
<div class="styleImg"></div>
|
|
<div id="echartsLeftCenter" 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";
|
|
const store = GlobalStore();
|
|
const airType = ref(1);
|
|
let rangeTime = ref("" as any);
|
|
let dataList = ref([
|
|
{
|
|
value: 75,
|
|
show: true,
|
|
name: "一般隐患",
|
|
|
|
itemStyle: {
|
|
normal: {
|
|
color: "#4bc3f9",
|
|
borderWidth: 20
|
|
}
|
|
}
|
|
},
|
|
{
|
|
value: 63,
|
|
show: true,
|
|
name: "严重隐患",
|
|
itemStyle: {
|
|
normal: {
|
|
color: "#ec6266",
|
|
borderWidth: 20
|
|
}
|
|
}
|
|
},
|
|
{
|
|
value: 30,
|
|
show: true,
|
|
name: "重大隐患",
|
|
itemStyle: {
|
|
normal: {
|
|
color: "#eeaa59"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
value: 30,
|
|
show: true,
|
|
name: "底线问题",
|
|
itemStyle: {
|
|
normal: {
|
|
color: "#81f279"
|
|
}
|
|
}
|
|
}
|
|
]);
|
|
function Pie() {
|
|
let dataArr = [];
|
|
for (var 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 echartsTest = echarts.init(document.getElementById("echartsLeftCenter"));
|
|
let option = {
|
|
tooltip: {
|
|
trigger: "item"
|
|
},
|
|
title: {
|
|
text: 18,
|
|
subtext: "问题总数",
|
|
x: "18%",
|
|
y: "center",
|
|
textStyle: {
|
|
color: "#fff",
|
|
fontSize: 30,
|
|
fontWeight: "normal",
|
|
align: "center",
|
|
width: "200px",
|
|
fontFamily: "sadigitalNumber"
|
|
},
|
|
subtextStyle: {
|
|
color: "#ccc",
|
|
fontSize: 14,
|
|
fontWeight: "normal",
|
|
align: "center",
|
|
}
|
|
},
|
|
legend: {
|
|
selectedMode: false, // 取消图例上的点击事件
|
|
icon: "rect",
|
|
type: "plain",
|
|
orient: "vertical",
|
|
left: "50%",
|
|
top: "30%",
|
|
align: "left",
|
|
itemGap: 30,
|
|
itemWidth: 8, // 设置宽度
|
|
itemHeight: 7, // 设置高度
|
|
symbolKeepAspect: false,
|
|
textStyle: {
|
|
color: "#000",
|
|
rich: {
|
|
name: {
|
|
verticalAlign: "right",
|
|
align: "left",
|
|
fontSize: 14,
|
|
color: "#FFFFFF"
|
|
},
|
|
value: {
|
|
align: "left",
|
|
fontSize: 14,
|
|
color: "#FFFFFF"
|
|
}
|
|
}
|
|
},
|
|
data: dataList.value.map(item => {
|
|
if (item.show) {
|
|
return item.name;
|
|
}
|
|
}),
|
|
formatter: function (data) {
|
|
if (dataList.value && dataList.value.length) {
|
|
for (var i = 0; i < dataList.value.length; i++) {
|
|
if (data === dataList.value[i].name) {
|
|
var value = dataList.value[i].value;
|
|
var percentage = value + "%";
|
|
return "{name| " + data + "} {gap| }" + "{value| " + value + " " + percentage + "}";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
series: [
|
|
// 外侧光线
|
|
{
|
|
name: "",
|
|
type: "gauge",
|
|
center: ["25%", "55%"],
|
|
radius: "65%",
|
|
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: "#52bef0"
|
|
},
|
|
{
|
|
offset: 1,
|
|
color: "rgba(54, 128, 174,0.4)"
|
|
}
|
|
])
|
|
],
|
|
[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: ["25%", "55%"],
|
|
radius: "56%",
|
|
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: [80, 90],
|
|
center: ["25%", "55%"],
|
|
hoverAnimation: true,
|
|
label: {
|
|
show: false,
|
|
position: "center"
|
|
},
|
|
emphasis: {
|
|
label: {
|
|
show: false
|
|
}
|
|
},
|
|
labelLine: {
|
|
show: false
|
|
},
|
|
data: dataList.value
|
|
},
|
|
{
|
|
type: "pie",
|
|
radius: ["70", "75"],
|
|
center: ["25%", "55%"],
|
|
label: {
|
|
show: false
|
|
},
|
|
|
|
data: Pie()
|
|
}
|
|
]
|
|
};
|
|
echartsTest.setOption(option, true);
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.leftBottomBox {
|
|
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;
|
|
// }
|
|
.rightHeader {
|
|
width: 65%;
|
|
display: flex;
|
|
position: absolute;
|
|
z-index: 99;
|
|
color: #fff;
|
|
font-size: 10px;
|
|
text-align: center;
|
|
line-height: 2.5vh;
|
|
left: 34%;
|
|
top: 23%;
|
|
.Selected {
|
|
height: 5%;
|
|
background: url("@/assets/images/dustNoise/rightImg2.png") no-repeat;
|
|
background-size: 100% 100%;
|
|
cursor: pointer;
|
|
}
|
|
.day {
|
|
height: 5%;
|
|
width: 15%;
|
|
margin-right: 5%;
|
|
z-index: 99;
|
|
margin-top: -17%;
|
|
cursor: pointer;
|
|
}
|
|
.year {
|
|
height: 5%;
|
|
width: 15%;
|
|
margin-right: 8%;
|
|
z-index: 99;
|
|
margin-top: -17%;
|
|
cursor: pointer;
|
|
}
|
|
.active {
|
|
height: 5%;
|
|
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>
|