城阳pc工作端前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

464 lines
12 KiB

2 years ago
<template>
<div>
<div class="visualizing laonianren">
<div class="visualizing-item">
2 years ago
<div>
<data-title title="党员年龄统计" />
</div>
<div id="dyLeftChart" style="height: 400px"></div>
</div>
<div class="visualizing-item">
2 years ago
<div>
<data-title title="党员文化程度统计" />
</div>
<div id="dyRightChart" style="height: 400px"></div>
</div>
<div class="visualizing-item">
<div>
<data-title title="党员享受服务情况统计" />
</div>
<div id="resiServiceChart" style="height: 400px"></div>
</div>
2 years ago
</div>
</div>
</template>
<script>
import dataTitle from "@/views/dataBoard/renfang/visualizing/components/dataTitle.vue";
import * as echarts from "echarts";
function dataFormatter(arr) {
return arr.map((item) => {
return {
name: item.classification,
value: Number(item.classificationNum),
};
});
}
export default {
name: "dangyuan",
props: {
title: {
type: String,
2 years ago
default: "",
},
org_id: {
type: String,
default: "",
2 years ago
},
},
components: {
dataTitle,
},
data() {
return {
dyLeft: [],
dyRight: [],
resiService: [],
2 years ago
};
},
created() {
const query = this.$route.query;
this.getData();
},
activated() {},
methods: {
getData() {
this.$http
.get("/actual/base/peopleRoomOverview/partyPie?type=0")
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
this.dyLeft = dataFormatter(res.data);
this.initLeftCharts();
})
.catch(() => {});
this.$http
.get("/actual/base/peopleRoomOverview/partyPie?type=1")
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
this.dyRight = dataFormatter(res.data);
this.initRightCharts();
})
.catch(() => {});
this.$http
.get("/actual/base/peopleRoomOverview/findPeoplePie/PARTY_FLAG")
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
this.resiService = dataFormatter(res.data);
this.initResiServiceCharts();
})
.catch(() => {});
2 years ago
},
initLeftCharts() {
let div = document.getElementById("dyLeftChart");
this.myChart1 = echarts.init(div);
2 years ago
const option = {
color: [
"#15a7ed",
"#22b998",
"#5f6ff4",
"#a66eeb",
"#faa834",
"#fd6200",
"#fb3905",
],
2 years ago
legend: {
orient: "vertical",
top: 20,
left: 10,
icon: "rect",
itemHeight: 14,
itemWidth: 14,
textStyle: {
color: "#ffffff",
rich: {
name: {
width: 90,
fontSize: 12,
color: "#dddee7",
},
value: {
width: 30,
align: "right",
fontSize: 18,
},
},
},
data: this.dyLeft,
formatter: (name) => {
if (this.dyLeft.length) {
const item = this.dyLeft.filter((item) => item.name === name)[0];
return `{name|${name}}{value| ${item.value}}`;
}
},
},
toolbox: {
show: false,
feature: {
mark: { show: true },
dataView: { show: true, readOnly: false },
restore: { show: true },
saveAsImage: { show: true },
},
},
title: {
show: !this.dyLeft || this.dyLeft.length == 0, // 是否要展示“暂无数据”矢量图
text: " {a|}", // 写入占位符a,以便后续填充内容
x: "center",
y: "center",
subtext: "暂无数据", // 子标题
itemGap: -10, // 设置主副标题间隔
textStyle: {
rich: {
a: {
height: 128, // 设置图片高度
width: 268, // 设置图片宽度
backgroundColor: {
// 引入图片,作为背景图,填写相对路径
image: require("@/assets/images/overview/zanwu.png"),
},
},
},
},
subtextStyle: {
// 配置副标题的文字样式
fontSize: 12,
color: "#ffffff",
},
},
2 years ago
series: [
{
type: "pie",
radius: this.dyLeft && this.dyLeft.length > 0 ? [30, 130] : [0, 0],
2 years ago
center: ["50%", "50%"],
roseType: "area",
itemStyle: {
borderRadius: 0,
},
top: 20,
left: -40,
label: {
position: "inside",
formatter: "{d}%",
textStyle: {
color: "#ffffff",
fontSize: 12,
},
},
data: this.dyLeft,
},
],
};
this.myChart1.setOption(option);
this.myChart1.on("click", (e) => {
2 years ago
this.$router.push({
2 years ago
path: "/dataBoard/renfang/resi-class-new",
2 years ago
query: {
2 years ago
org_id: this.org_id,
2 years ago
type_id: "aged",
type_name: "党员",
pageType: "normal",
2 years ago
type: "dangyuan",
olds: e.data.name,
2 years ago
},
});
});
window.addEventListener("resize", () => this.myChart1.resize());
},
initRightCharts() {
let div = document.getElementById("dyRightChart");
this.myChart2 = echarts.init(div);
2 years ago
const option = {
color: [
"#15a7ed",
"#22b998",
"#5f6ff4",
"#a66eeb",
"#faa834",
"#fd6200",
"#fb3905",
],
2 years ago
legend: {
orient: "vertical",
top: 20,
left: 10,
icon: "rect",
itemHeight: 14,
itemWidth: 14,
textStyle: {
color: "#ffffff",
rich: {
name: {
width: 80,
fontSize: 12,
color: "#dddee7",
},
value: {
width: 30,
align: "right",
fontSize: 18,
},
},
},
data: this.dyRight,
formatter: (name) => {
if (this.dyRight.length) {
2 years ago
const item = this.dyRight.filter((item) => item.name === name)[0];
2 years ago
return `{name|${name}}{value| ${item.value}}`;
}
},
},
toolbox: {
show: false,
feature: {
mark: { show: true },
dataView: { show: true, readOnly: false },
restore: { show: true },
saveAsImage: { show: true },
},
},
title: {
show: !this.dyRight || this.dyRight.length == 0, // 是否要展示“暂无数据”矢量图
text: " {a|}", // 写入占位符a,以便后续填充内容
x: "center",
y: "center",
subtext: "暂无数据", // 子标题
itemGap: -10, // 设置主副标题间隔
textStyle: {
rich: {
a: {
height: 128, // 设置图片高度
width: 268, // 设置图片宽度
backgroundColor: {
// 引入图片,作为背景图,填写相对路径
image: require("@/assets/images/overview/zanwu.png"),
},
},
},
},
subtextStyle: {
// 配置副标题的文字样式
fontSize: 12,
color: "#ffffff",
},
},
2 years ago
series: [
{
type: "pie",
radius:
this.dyRight && this.dyRight.length > 0 ? [30, 130] : [0, 0],
2 years ago
center: ["50%", "50%"],
roseType: "area",
itemStyle: {
borderRadius: 0,
},
top: 20,
left: -40,
label: {
position: "inside",
formatter: "{d}%",
textStyle: {
color: "#ffffff",
fontSize: 12,
},
},
data: this.dyRight,
},
],
};
this.myChart2.on("click", (e) => {
2 years ago
this.$router.push({
2 years ago
path: "/dataBoard/renfang/resi-class-new",
2 years ago
query: {
2 years ago
org_id: this.org_id,
2 years ago
type_id: "aged",
type_name: "党员",
pageType: "normal",
2 years ago
type: "dangyuan",
cultureLevel: e.data.name,
2 years ago
},
});
});
this.myChart2.setOption(option);
window.addEventListener("resize", () => this.myChart2.resize());
},
initResiServiceCharts() {
let div = document.getElementById("resiServiceChart");
this.myChart3 = echarts.init(div);
const option = {
color: [
"#15a7ed",
"#22b998",
"#5f6ff4",
"#a66eeb",
"#faa834",
"#fd6200",
"#fb3905",
],
legend: {
orient: "vertical",
top: 20,
left: 10,
icon: "rect",
itemHeight: 14,
itemWidth: 14,
textStyle: {
color: "#ffffff",
rich: {
name: {
width: 90,
fontSize: 12,
color: "#dddee7",
},
value: {
width: 30,
align: "right",
fontSize: 18,
},
},
},
data: this.resiService,
formatter: (name) => {
if (this.resiService.length) {
const item = this.resiService.filter((item) => item.name === name)[0];
return `{name|${name}}{value| ${item.value}}`;
}
},
},
toolbox: {
show: false,
feature: {
mark: { show: true },
dataView: { show: true, readOnly: false },
restore: { show: true },
saveAsImage: { show: true },
},
},
title: {
show: !this.resiService || this.resiService.length == 0, // 是否要展示“暂无数据”矢量图
text: " {a|}", // 写入占位符a,以便后续填充内容
x: "center",
y: "center",
subtext: "暂无数据", // 子标题
itemGap: -10, // 设置主副标题间隔
textStyle: {
rich: {
a: {
height: 128, // 设置图片高度
width: 268, // 设置图片宽度
backgroundColor: {
// 引入图片,作为背景图,填写相对路径
image: require("@/assets/images/overview/zanwu.png"),
},
},
},
},
subtextStyle: {
// 配置副标题的文字样式
fontSize: 12,
color: "#ffffff",
},
},
series: [
{
type: "pie",
radius:
this.resiService && this.resiService.length > 0 ? [30, 130] : [0, 0],
center: ["50%", "50%"],
roseType: "area",
itemStyle: {
borderRadius: 0,
},
top: 20,
left: -40,
label: {
position: "inside",
formatter: "{d}%",
textStyle: {
color: "#ffffff",
fontSize: 12,
},
},
data: this.resiService,
},
],
};
this.myChart3.setOption(option);
this.myChart3.on("click", (e) => {
this.$router.push({
path: "/dataBoard/renfang/resi-class-new",
query: {
org_id: this.org_id,
type_id: "aged",
type_name: "党员",
pageType: "normal",
type: "dangyuan",
serv_type: e.data.name,
},
});
});
window.addEventListener("resize", () => this.myChart3.resize());
},
2 years ago
},
};
</script>
<style
lang="scss"
src="@/assets/scss/dataBoard/renfang/index.scss"
scoped
></style>
<style lang="scss" scoped>
.laonianren {
padding: 140px 240px;
}
</style>