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.

498 lines
12 KiB

1 year ago
<template>
1 year ago
<div class="center-left bs-card">
<div class="bs-card__title jc-between">
<p class="bs-card__title--text">康养服务</p>
<p>
<span style="font-size: 20px; color: #59d4fc; font-weight: 500"
>人次/</span
>
</p>
</div>
1 year ago
1 year ago
<div class="bs-card__body">
1 year ago
<el-carousel class="show-data" height="76px" :interval="5000" arrow="never" indicator-position="outside">
<el-carousel-item class="show-data-swipe" v-for="i in (Math.ceil(totalData.length/3))">
<div class="show-data-item" v-for="j in 3" v-if="totalData[(i-1)*3+(j-1)]">
<div class="show-data-item__num">{{ totalData[(i-1)*3+(j-1)].value }}</div>
<div class="show-data-item__label">{{ totalData[(i-1)*3+(j-1)].label }}</div>
</div>
</el-carousel-item>
</el-carousel>
1 year ago
<div id="property-bar-chart"></div>
1 year ago
</div>
1 year ago
<div class="bs-card__title" style="margin-top: 45px">
<p class="bs-card__title--text">公益/商业服务</p>
</div>
<div class="bs-card__body">
<div id="property-line-chart"></div>
1 year ago
</div>
</div>
</template>
<script>
1 year ago
import { getList } from "@/api/bigScreen";
1 year ago
import echarts from "echarts";
require("echarts/theme/macarons"); // echarts theme
1 year ago
export default {
data() {
1 year ago
return {
totalData: [],
};
1 year ago
},
methods: {
1 year ago
async getChartData() {
1 year ago
try {
1 year ago
const res = (
await getList(
{
type: "kangyangfuwu",
},
false
)
)?.data;
1 year ago
this.totalData = JSON.parse(res?.find((i) => i.key === "barchart")?.value);
1 year ago
this.lineChartData = JSON.parse(
res?.find((i) => i.key === "linechart")?.value
);
this.initLineChart();
1 year ago
1 year ago
this.chartData = JSON.parse(
res?.find((i) => i.key === "barchart")?.value
);
1 year ago
this.initChart();
} catch (err) {
1 year ago
console.error(err);
1 year ago
}
},
1 year ago
initChart() {
1 year ago
this.chart = echarts.init(
document.querySelector("#property-bar-chart"),
"macarons"
);
1 year ago
this.setOptions(this.chartData);
},
1 year ago
initLineChart() {
this.chartLine = echarts.init(
document.querySelector("#property-line-chart")
);
this.setLineOptions(this.lineChartData);
1 year ago
},
1 year ago
setOptions(chartdata) {
1 year ago
let color = [
"#c95038",
"#e1884a",
"#ebb34c",
"#316922",
"#71dc7a",
"#6bb7be",
"#2050e0",
"#9952f6",
];
1 year ago
this.chart.setOption({
1 year ago
tooltip: {
1 year ago
trigger: "axis",
1 year ago
axisPointer: {
1 year ago
type: "shadow",
},
1 year ago
},
1 year ago
grid: {
top: 10,
1 year ago
left: "2%",
1 year ago
right: "5.8%",
1 year ago
bottom: "3%",
containLabel: true,
1 year ago
},
1 year ago
xAxis: {
1 year ago
type: "log",
axisLine: {
lineStyle: {
color: '#5b7be8' // 设置x轴轴线颜色为红色
}
},
1 year ago
splitLine: {
1 year ago
show: true,
1 year ago
lineStyle: {
1 year ago
color: "#5b7be8",
1 year ago
},
},
1 year ago
},
yAxis: {
1 year ago
type: "category",
data: this.chartData.map((i) => i.label),
1 year ago
axisLabel: {
textStyle: {
1 year ago
color: "#fff",
},
},
1 year ago
},
series: [
{
1 year ago
name: "人数",
type: "bar",
data: this.chartData.map((i) => i.value),
1 year ago
label: {
show: true,
1 year ago
avoidLabelOverlap: true,
position: 'insideRight',
1 year ago
color: "#fff",
fontWeight: "bold",
1 year ago
formatter: params => {
7 days ago
return params.data > 10000 ? `${params.data/10000}万+`: `${params.data}+`
1 year ago
}
1 year ago
},
itemStyle: {
color: (params) => {
1 year ago
return color[params.dataIndex];
1 year ago
},
1 year ago
barBorderRadius: [0, 4, 4, 0],
1 year ago
},
1 year ago
},
],
});
1 year ago
},
1 year ago
setLineOptions() {
this.chartLine.setOption({
tooltip: {
trigger: "axis",
axisPointer: {
lineStyle: {
1 year ago
color: "#6786f1",
1 year ago
},
},
1 year ago
},
1 year ago
legend: {
top: 0,
textStyle: {
fontSize: 14,
color: "#F1F1F3",
},
1 year ago
},
1 year ago
grid: {
top: "50px",
left: "2%",
right: "4%",
1 year ago
bottom: "10px",
1 year ago
containLabel: true,
1 year ago
},
1 year ago
xAxis: [
{
type: "category",
boundaryGap: false,
axisLine: {
lineStyle: {
color: '#395e9c',
},
},
axisLabel: {
textStyle: {
color: '#395e9c',
},
},
1 year ago
data: this.lineChartData?.year || [],
1 year ago
},
],
yAxis: [
{
type: "value",
axisTick: {
show: false,
},
axisLine: {
lineStyle: {
color: "#384b8f",
type: "dashed"
},
},
axisLabel: {
margin: 10,
textStyle: {
color: "#fff",
fontSize: 14,
},
},
splitLine: {
lineStyle: {
color: "#384b8f",
},
},
},
],
1 year ago
series: [
{
1 year ago
name: "政府",
type: "line",
smooth: true,
symbol: "circle",
symbolSize: 8,
lineStyle: {
normal: {
width: 4,
},
},
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(
0,
1,
1,
0,
[
{
offset: 0,
color: "rgba(0,0,0,0)",
},
{
offset: 0.8,
color: "rgba(226, 172, 113, 0.4)",
},
],
false
),
shadowColor: "rgba(0, 0, 0, 0.1)",
1 year ago
shadowBlur: 10,
1 year ago
},
1 year ago
},
1 year ago
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(
0,
0,
0,
1,
[
{
offset: 0,
color: "#e0a26e",
},
{
offset: 0.8,
color: "#872d4a",
},
],
false
),
1 year ago
},
},
1 year ago
data: this.lineChartData?.data.find(i => i.label === '政府')?.value,
1 year ago
},
{
name: "商业",
type: "line",
smooth: true,
symbol: "circle",
symbolSize: 8,
lineStyle: {
normal: {
width: 4,
},
},
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(
0,
1,
1,
0,
[
{
offset: 0,
color: "rgba(0,0,0,0)",
},
{
offset: 0.8,
color: "rgba(96, 191, 250, 0.4)",
},
],
false
),
shadowColor: "rgba(0, 0, 0, 0.1)",
shadowBlur: 10,
},
},
itemStyle: {
normal: {
color: "rgb(96, 191, 250)",
},
},
1 year ago
data: this.lineChartData?.data.find(i => i.label === '商业')?.value,
1 year ago
},
],
});
},
1 year ago
},
computed: {},
mounted() {
1 year ago
this.getChartData();
},
};
1 year ago
</script>
<style scoped lang="scss">
.center-left {
1 year ago
flex-shrink: 0;
width: 383px;
height: 100%;
1 year ago
display: flex;
flex-direction: column;
1 year ago
.show-data {
margin-top: 35px;
$itemColors: linear-gradient(0deg, #d91e19 0%, #d95f39 99%, #d95f39 100%),
linear-gradient(0deg, #e67725 0%, #ff9d62 100%),
linear-gradient(0deg, #f6aa2c 0%, #f8db36 100%, #f8db36 100%),
linear-gradient(0deg, #f6aa2c 0%, #f8db36 100%, #f8db36 100%),
linear-gradient(0deg, #d91e19 0%, #d95f39 99%, #d95f39 100%),
linear-gradient(0deg, #e67725 0%, #ff9d62 100%),
linear-gradient(0deg, #f6aa2c 0%, #f8db36 100%, #f8db36 100%),
linear-gradient(0deg, #f6aa2c 0%, #f8db36 100%, #f8db36 100%);
@for $index from 1 through length($itemColors) {
&-item:nth-child(#{$index}) {
& > div:nth-child(1) {
background: nth($itemColors, $index);
}
}
}
1 year ago
&-swipe {
display: flex;
align-items: center;
justify-content: space-between;
}
1 year ago
&-item {
1 year ago
height: 100%;
1 year ago
flex: 1;
1 year ago
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
1 year ago
text-align: center;
box-shadow: inset 0 0 6px 4px #1a3674;
&__num {
1 year ago
width: 100%;
flex: 1;
1 year ago
border-radius: 5px 5px 0 0;
1 year ago
font-size: 32px;
1 year ago
color: #ffffff;
font-weight: bold;
}
&__label {
1 year ago
flex: 1;
1 year ago
border-radius: 0 0 5px 5px;
font-size: 16px;
color: #ffffff;
}
}
.show-data-item + .show-data-item {
margin-left: 5px;
}
}
1 year ago
.business-buy {
height: 382px;
&__body {
1 year ago
.digital {
width: 205px;
height: 188px;
margin: auto;
position: relative;
& > img {
width: 205px;
height: 188px;
display: block;
}
1 year ago
1 year ago
&-item {
font-size: 20px;
color: #31abe3;
font-weight: bold;
z-index: 2;
position: absolute;
}
&-item:nth-child(1) {
top: 46%;
right: -36%;
}
&-item:nth-child(2) {
left: 50%;
bottom: 10%;
}
&-item:nth-child(3) {
left: -20%;
bottom: 0;
}
}
1 year ago
.progress {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 20px;
padding: 0 15px;
&-item {
width: 91px;
position: relative;
}
&-name {
color: #fff;
text-align: center;
width: 52px;
height: 20px;
border-radius: 10px;
background-color: #0052e9;
position: absolute;
bottom: 6px;
left: calc(50% - 26px);
}
&-rate {
color: #00deff;
font-size: 20px;
transform: translate(-50%, -50%);
position: absolute;
top: 50%;
left: 50%;
}
}
}
}
.property {
height: 243px;
.chart-legend {
display: flex;
&__item {
display: flex;
align-items: center;
margin-left: 18px;
& > div {
width: 18px;
height: 18px;
border-radius: 4px;
margin-right: 15px;
}
& > p {
font-size: 16px;
}
}
}
}
}
1 year ago
#property-bar-chart {
height: 355px;
1 year ago
width: 100%;
1 year ago
margin-top: 30px;
1 year ago
}
1 year ago
#property-line-chart {
margin-top: 20px;
1 year ago
width: 100%;
1 year ago
height: 190px;
1 year ago
}
</style>