410 lines
7.4 KiB
Vue
Raw Normal View History

2023-09-07 18:55:51 +08:00
<template>
<Card title="政治面貌">
2023-09-08 18:02:03 +08:00
<div class="leftBottomBox">
<div id="politicalOutlook" style="width: 100%; height: 100%"></div>
</div>
<party-build-dialog ref="partyBuildRef"></party-build-dialog>
2023-09-07 18:55:51 +08:00
</Card>
</template>
2023-09-08 18:02:03 +08:00
2023-09-07 18:55:51 +08:00
<script lang="ts" setup>
2023-09-08 18:02:03 +08:00
import { onMounted, ref } from "vue";
import * as echarts from "echarts";
2023-09-07 18:55:51 +08:00
import Card from "@/components/card.vue";
import partyBuildDialog from "@/views/sevenLargeScreen/comprehensiveManage/smartPartyBuilding/party-build-dialog.vue";
2023-09-08 18:02:03 +08:00
import { GlobalStore } from "@/stores";
const store = GlobalStore();
const airType = ref(1);
let rangeTime = ref("" as any);
// 政治面貌弹窗
const partyBuildRef = ref();
const openPeopleCountDialog = (type: any) => {
partyBuildRef.value.openDialog(type);
console.log(partyBuildRef.value);
};
2023-09-08 18:02:03 +08:00
let dataList = ref([
{
value: 37,
show: true,
name: "中共党员",
itemStyle: {
normal: {
color: "#82FBEA",
borderWidth: 20
}
}
},
{
value: 74,
show: true,
name: "中共预备党员",
itemStyle: {
normal: {
color: "#EEC459",
borderWidth: 20
}
}
},
{
value: 73,
show: true,
name: "共青团员",
itemStyle: {
normal: {
color: "#65D7F9"
}
}
}
]);
function Pie() {
let dataArr = [];
for (let i = 0; i < 150; i++) {
2023-09-08 18:02:03 +08:00
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("politicalOutlook"));
echartsTest.on("legendselectchanged", function (params) {
openPeopleCountDialog(4);
// 判断点击的元素类型
// console.log(params, "输出点击数据");
// if (params.componentType === "series") {
// // 获取点击的柱状图数据
// let clickedData = params.data;
// // 在控制台输出点击的柱状图数据
// console.log(clickedData, "输出点击的数据");
// // openQualitySafeDialog(1);
// // 在这里可以根据需要执行自定义的点击事件操作
// // 例如根据柱状图数据加载相关数据,跳转到其他页面等
// // ...
// }
});
2023-09-08 18:02:03 +08:00
let option = {
tooltip: {
trigger: "item"
},
title: {
text: max,
subtext: "总数",
x: "23%",
y: "41%",
textAlign: "center",
textStyle: {
color: "#fff",
fontSize: 22,
fontWeight: "normal",
textAlign: "left",
fontFamily: "sadigitalNumber"
},
subtextStyle: {
color: "#ccc",
fontSize: 14,
lineHeight: 30
}
},
legend: {
selectedMode: true, // 取消图例上的点击事件
2023-09-08 18:02:03 +08:00
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",
width: 120,
fontSize: 14,
color: "#FFFFFF"
},
value: {
align: "left",
width: 50,
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 (let i = 0; i < dataList.value.length; i++) {
if (data === dataList.value[i].name) {
let value = dataList.value[i].value;
let percentage = value + "%";
return "{name| " + data + "}" + "{value| " + value + "}" + "{value| " + percentage + "}";
}
}
}
}
},
series: [
// 外侧光线
{
name: "",
type: "gauge",
center: ["25%", "55%"],
radius: "80%",
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: "71%",
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: ["60", "65"],
center: ["25%", "55%"],
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: ["53", "55"],
center: ["25%", "55%"],
label: {
show: false
},
data: Pie()
}
]
};
echartsTest.setOption(option, true);
}
2023-09-07 18:55:51 +08:00
</script>
2023-09-08 18:02:03 +08:00
<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>