城阳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.

814 lines
22 KiB

2 years ago
<template>
<div>
<div class="visualizing">
<div class="visualizing-item">
<div>
<data-title title="失业人员失业原因统计" />
</div>
<div id="syryChart1" style="height: 380px"></div>
</div>
<div class="visualizing-item">
<div>
<data-title title="失业人员就业愿望统计" />
</div>
<div id="syryChart2" style="height: 380px"></div>
</div>
<div class="visualizing-item">
<div>
<data-title title="失业人员年龄统计" />
</div>
<div id="syryChart3" style="height: 380px"></div>
</div>
</div>
<div class="visualizing dibaorenyuan">
<div class="visualizing-left">
<div>
<data-title title="技能找人统计" />
</div>
<div id="syryChart4" style="height: 380px"></div>
</div>
<div class="visualizing-right">
<div>
<data-title title="岗位找人统计" />
</div>
<div id="syryChart5" style="height: 380px"></div>
</div>
</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: "shiyerenyuan",
props: {
title: {
type: String,
2 years ago
default: "",
},
org_id: {
type: String,
default: "",
2 years ago
},
},
components: {
dataTitle,
},
data() {
return {
syryData1: [],
syryData2: [],
syryData3: [],
syryData4: [],
syryData5: [],
};
},
created() {
const query = this.$route.query;
this.getData();
},
methods: {
getData() {
this.$http
.get("/actual/base/peopleRoomOverview/unemployedPie?type=0")
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
this.syryData1 = dataFormatter(res.data);
this.syryDataCharts1();
})
.catch(() => {});
this.$http
.get("/actual/base/peopleRoomOverview/unemployedPie?type=1")
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
2 years ago
this.syryData2 = dataFormatter(res.data);
2 years ago
this.syryDataCharts2();
})
.catch(() => {});
this.$http
.get("/actual/base/peopleRoomOverview/unemployedPie?type=2")
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
2 years ago
this.syryData3 = dataFormatter(res.data);
2 years ago
this.syryDataCharts3();
})
.catch(() => {});
this.$http
.get("/actual/base/peopleRoomOverview/unemployedPie?type=3")
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
this.syryData4 = dataFormatter(res.data);
this.syryDataCharts4();
})
.catch(() => {});
this.$http
.get("/actual/base/peopleRoomOverview/unemployedPie?type=4")
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
this.syryData5 = dataFormatter(res.data);
this.syryDataCharts5();
})
.catch(() => {});
},
syryDataCharts1() {
let div = document.getElementById("syryChart1");
this.myChart1 = echarts.init(div);
2 years ago
const option = {
color: [
"#15a7ed",
"#22b998",
"#5f6ff4",
"#a66eeb",
"#faa834",
"#fd6200",
"#fb3905",
],
tooltip: {
show: true,
},
2 years ago
legend: {
orient: "vertical",
top: 20,
left: 10,
icon: "rect",
itemHeight: 14,
itemWidth: 14,
2 years ago
tooltip: {
show: true,
},
formatter: (name) => {
if (this.syryData1.length) {
const item = this.syryData1.filter(
(item) => item.name === name
)[0];
return `{name|${echarts.format.truncateText(
name,
100,
"14px Microsoft Yahei",
"…"
)}}{value| ${item.value}}`;
}
},
2 years ago
textStyle: {
color: "#ffffff",
rich: {
name: {
width: 90,
fontSize: 12,
color: "#dddee7",
},
value: {
2 years ago
width: 60,
2 years ago
align: "right",
fontSize: 18,
},
},
},
data: this.syryData1,
},
toolbox: {
show: false,
feature: {
mark: { show: true },
dataView: { show: true, readOnly: false },
restore: { show: true },
saveAsImage: { show: true },
},
},
title: {
show: !this.syryData1 || this.syryData1.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: [
{
name: "Nightingale Chart",
2 years ago
type: "pie",
radius:
this.syryData1 && this.syryData1.length > 0 ? [30, 130] : [0, 0],
2 years ago
center: ["50%", "50%"],
roseType: "area",
itemStyle: {
borderRadius: 0,
},
2 years ago
top: -20,
left: 10,
2 years ago
label: {
position: "inside",
formatter: "{d}%",
textStyle: {
color: "#ffffff",
fontSize: 12,
},
},
data: this.syryData1,
},
],
};
this.myChart1.setOption(option);
this.myChart1.on("click", (a, b) => {
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",
2 years ago
type_name: "失业人员",
2 years ago
pageType: "normal",
2 years ago
type: "shiye",
2 years ago
},
});
});
window.addEventListener("resize", () => this.myChart1.resize());
},
syryDataCharts2() {
let div = document.getElementById("syryChart2");
this.myChart2 = echarts.init(div);
2 years ago
const option = {
color: [
"#15a7ed",
"#22b998",
"#5f6ff4",
"#a66eeb",
"#faa834",
"#fd6200",
"#fb3905",
],
tooltip: {
show: true,
},
2 years ago
legend: {
orient: "vertical",
top: 20,
left: 10,
icon: "rect",
itemHeight: 14,
itemWidth: 14,
textStyle: {
color: "#ffffff",
rich: {
name: {
2 years ago
width: 90,
2 years ago
fontSize: 12,
color: "#dddee7",
},
value: {
2 years ago
width: 60,
2 years ago
align: "right",
fontSize: 18,
},
},
},
data: this.syryData2,
2 years ago
tooltip: {
show: true,
},
2 years ago
formatter: (name) => {
if (this.syryData2.length) {
const item = this.syryData2.filter(
(item) => item.name === name
)[0];
2 years ago
return `{name|${echarts.format.truncateText(
name,
100,
"14px Microsoft Yahei",
"…"
)}}{value| ${item.value}}`;
2 years ago
}
},
},
toolbox: {
show: false,
feature: {
mark: { show: true },
dataView: { show: true, readOnly: false },
restore: { show: true },
saveAsImage: { show: true },
},
},
title: {
show: !this.syryData2 || this.syryData2.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: [
{
name: "Nightingale Chart",
2 years ago
type: "pie",
radius:
this.syryData2 && this.syryData2.length > 0 ? [30, 130] : [0, 0],
2 years ago
center: ["50%", "50%"],
roseType: "area",
itemStyle: {
borderRadius: 0,
},
2 years ago
top: -20,
left: 10,
2 years ago
label: {
position: "inside",
formatter: "{d}%",
textStyle: {
color: "#ffffff",
fontSize: 12,
},
},
data: this.syryData2,
},
],
};
this.myChart2.setOption(option);
this.myChart2.on("click", (a, b) => {
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",
2 years ago
type_name: "失业人员",
2 years ago
pageType: "normal",
2 years ago
type: "shiye",
2 years ago
},
});
});
window.addEventListener("resize", () => this.myChart2.resize());
},
syryDataCharts3() {
let div = document.getElementById("syryChart3");
this.myChart3 = echarts.init(div);
2 years ago
const option = {
color: [
"#15a7ed",
"#22b998",
"#5f6ff4",
"#a66eeb",
"#faa834",
"#fd6200",
"#fb3905",
],
tooltip: {
show: true,
},
2 years ago
legend: {
type: "scroll",
orient: "vertical",
top: 20,
left: 10,
icon: "rect",
itemHeight: 14,
itemWidth: 14,
2 years ago
tooltip: {
show: true,
},
formatter: (name) => {
if (this.syryData3.length) {
const item = this.syryData3.filter(
(item) => item.name === name
)[0];
return `{name|${echarts.format.truncateText(
name,
100,
"14px Microsoft Yahei",
"…"
)}}{value| ${item.value}}`;
}
},
2 years ago
textStyle: {
width: 120,
color: "#ffffff",
rich: {
name: {
width: 90,
fontSize: 12,
color: "#dddee7",
},
value: {
2 years ago
width: 60,
2 years ago
align: "right",
fontSize: 18,
},
},
},
data: this.syryData3,
},
toolbox: {
show: false,
feature: {
mark: { show: true },
dataView: { show: true, readOnly: false },
restore: { show: true },
saveAsImage: { show: true },
},
},
title: {
show: !this.syryData3 || this.syryData3.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: [
{
name: "Nightingale Chart",
2 years ago
type: "pie",
radius:
this.syryData3 && this.syryData3.length > 0 ? [30, 130] : [0, 0],
2 years ago
center: ["50%", "50%"],
roseType: "area",
itemStyle: {
borderRadius: 0,
},
2 years ago
top: -20,
left: 10,
2 years ago
label: {
position: "inside",
formatter: "{d}%",
textStyle: {
color: "#ffffff",
fontSize: 12,
},
},
data: this.syryData3,
},
],
};
this.myChart3.setOption(option);
this.myChart3.on("click", (a, b) => {
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",
2 years ago
type_name: "失业人员",
2 years ago
pageType: "normal",
2 years ago
type: "shiye",
2 years ago
},
});
});
window.addEventListener("resize", () => this.myChart3.resize());
},
syryDataCharts4() {
let div = document.getElementById("syryChart4");
this.myChart4 = echarts.init(div);
2 years ago
const option = {
color: [
"#15a7ed",
"#22b998",
"#5f6ff4",
"#a66eeb",
"#faa834",
"#fd6200",
"#fb3905",
],
tooltip: {
show: true,
},
2 years ago
legend: {
type: "scroll",
orient: "vertical",
top: 20,
left: 10,
icon: "rect",
itemHeight: 14,
itemWidth: 14,
textStyle: {
color: "#ffffff",
rich: {
name: {
2 years ago
width: 90,
2 years ago
fontSize: 12,
color: "#dddee7",
},
value: {
2 years ago
width: 60,
2 years ago
align: "right",
fontSize: 18,
},
},
},
data: this.syryData4,
2 years ago
tooltip: {
show: true,
},
2 years ago
formatter: (name) => {
if (this.syryData4.length) {
const item = this.syryData4.filter(
(item) => item.name === name
)[0];
2 years ago
return `{name|${echarts.format.truncateText(
name,
100,
"14px Microsoft Yahei",
"…"
)}}{value| ${item.value}}`;
2 years ago
}
},
},
toolbox: {
show: false,
feature: {
mark: { show: true },
dataView: { show: true, readOnly: false },
restore: { show: true },
saveAsImage: { show: true },
},
},
title: {
show: !this.syryData4 || this.syryData4.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: [
{
name: "Nightingale Chart",
2 years ago
type: "pie",
radius:
this.syryData4 && this.syryData4.length > 0 ? [30, 130] : [0, 0],
2 years ago
center: ["50%", "50%"],
roseType: "area",
itemStyle: {
borderRadius: 0,
},
2 years ago
top: -20,
left: 10,
2 years ago
label: {
position: "inside",
formatter: "{d}%",
textStyle: {
color: "#ffffff",
fontSize: 12,
},
},
data: this.syryData4,
},
],
};
this.myChart4.setOption(option);
2 years ago
this.myChart4.on("click", (a, b) => {
this.$router.push({
2 years ago
path: "/dataBoard/renfang/resi-class-new",
2 years ago
query: {
org_id: this.org_id,
type_id: "aged",
type_name: "技能找人",
pageType: "normal1",
type: "jineng",
},
});
});
2 years ago
window.addEventListener("resize", () => this.myChart4.resize());
},
syryDataCharts5() {
let div = document.getElementById("syryChart5");
this.myChart5 = echarts.init(div);
2 years ago
const option = {
color: [
"#15a7ed",
"#22b998",
"#5f6ff4",
"#a66eeb",
"#faa834",
"#fd6200",
"#fb3905",
],
tooltip: {
show: true,
},
2 years ago
legend: {
type: "scroll",
orient: "vertical",
top: 20,
left: 10,
icon: "rect",
itemHeight: 14,
itemWidth: 14,
2 years ago
tooltip: {
show: true,
},
formatter: (name) => {
if (this.syryData5.length) {
const item = this.syryData5.filter(
(item) => item.name === name
)[0];
return `{name|${echarts.format.truncateText(
name,
100,
"14px Microsoft Yahei",
"…"
)}}{value| ${item.value}}`;
}
},
2 years ago
textStyle: {
color: "#ffffff",
rich: {
name: {
2 years ago
width: 90,
2 years ago
fontSize: 12,
color: "#dddee7",
},
value: {
2 years ago
width: 60,
2 years ago
align: "right",
fontSize: 18,
},
},
},
data: this.syryData5,
},
toolbox: {
show: false,
feature: {
mark: { show: true },
dataView: { show: true, readOnly: false },
restore: { show: true },
saveAsImage: { show: true },
},
},
title: {
show: !this.syryData5 || this.syryData5.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: [
{
name: "Nightingale Chart",
2 years ago
type: "pie",
radius:
this.syryData5 && this.syryData5.length > 0 ? [30, 130] : [0, 0],
2 years ago
center: ["50%", "50%"],
roseType: "area",
itemStyle: {
borderRadius: 0,
},
2 years ago
top: -20,
left: 10,
2 years ago
label: {
position: "inside",
formatter: "{d}%",
textStyle: {
color: "#ffffff",
fontSize: 12,
},
},
data: this.syryData5,
},
],
};
this.myChart5.setOption(option);
2 years ago
this.myChart5.on("click", (a, b) => {
this.$router.push({
2 years ago
path: "/dataBoard/renfang/resi-class-new",
2 years ago
query: {
org_id: this.org_id,
type_id: "aged",
type_name: "岗位找人",
pageType: "normal1",
type: "gangwei",
},
});
});
2 years ago
window.addEventListener("resize", () => this.myChart5.resize());
},
},
};
</script>
<style
lang="scss"
src="@/assets/scss/dataBoard/renfang/index.scss"
scoped
></style>
<style lang="scss" scoped>
.dibaorenyuan {
padding: 0px 240px;
}
#syryChart3 {
.echarts-legend {
white-space: normal;
}
}
:v-deep #syryChart3 {
.echarts-legend span {
padding: 5px 0;
display: block;
}
}
</style>