合并静态首页代码至master #1

Merged
zwq merged 16 commits from home-add-map into master 2024-04-11 16:43:00 +08:00
4 changed files with 317 additions and 10 deletions
Showing only changes of commit 28ec95ba81 - Show all commits

View File

@ -0,0 +1,57 @@
<!--
filename: Bipv.vue
author: liubin
date: 2024-04-10 15:39:54
description:
-->
<template>
<right-chart-base
:legend="legend"
:series="series"
:xAxis="xAxis"
:vHeight="20"
class="bipv-chart"
/>
</template>
<script>
import RightChartBase from "./RightChartBase.vue";
export default {
name: "BipvChart",
components: { RightChartBase },
props: {
legend: {
type: Array,
default: () => [
{ label: "2023年", color: "#12f7f1" },
{ label: "2024年", color: "#58adfa" },
],
},
xAxis: {
type: Array,
default: () => ["成都", "邯郸", "株洲", "瑞昌", "heels", "socks"],
},
series: {
type: Array,
default: () => [
{
name: "2023年",
data: Array.from({ length: 7 }, () =>
Math.floor(Math.random() * 1000)
),
},
{
name: "2024年",
data: Array.from({ length: 7 }, () =>
Math.floor(Math.random() * 1000)
),
},
],
},
},
};
</script>
<style scoped lang="scss"></style>

View File

@ -1,5 +1,5 @@
<!-- <!--
filename: chip-invest.vue filename: left-chart-base
author: liubin author: liubin
date: 2024-04-10 08:59:28 date: 2024-04-10 08:59:28
description: description:
@ -16,7 +16,11 @@
>{{ item.label }}</span >{{ item.label }}</span
> >
</div> </div>
<div ref="chart" style="max-width: 22vw; height: 34vh"></div> <div
ref="chart"
style="max-width: 22vw"
:style="{ height: vHeight + 'vh' }"
></div>
</chart-container> </chart-container>
</template> </template>
@ -26,12 +30,16 @@ import ChartContainerVue from "../components/ChartContainer.vue";
import chartMixin from "../mixins/chart.js"; import chartMixin from "../mixins/chart.js";
export default { export default {
name: "chip-investChart", name: "LeftChartBase",
components: { components: {
ChartContainer: ChartContainerVue, ChartContainer: ChartContainerVue,
}, },
mixins: [chartMixin], mixins: [chartMixin],
props: { props: {
vHeight: {
type: Number,
default: 34,
},
legend: { legend: {
type: Array, type: Array,
required: true, required: true,
@ -53,7 +61,7 @@ export default {
left: "3%", left: "3%",
right: "4%", right: "4%",
bottom: "0", bottom: "0",
top: "12%", top: "15%",
containLabel: true, containLabel: true,
}, },
tooltip: {}, tooltip: {},
@ -212,7 +220,7 @@ export default {
display: inline-block; display: inline-block;
width: 10px; width: 10px;
height: 10px; height: 10px;
background-color: attr(data-color); background-color: #ccc;
border-radius: 2px; border-radius: 2px;
margin-right: 0.22vw; margin-right: 0.22vw;
} }

View File

@ -0,0 +1,242 @@
<!--
filename: right-chart-base
author: liubin
date: 2024-04-10 08:59:28
description:
-->
<template>
<chart-container class="right-chart-base">
<div class="legend">
<span
v-for="item in legend"
:key="item.label"
class="legend-item"
:style="{ fontSize: isFullscreen ? '16px' : '12px' }"
>{{ item.label }}</span
>
</div>
<div
ref="chart"
style="max-width: 22vw"
:style="{ height: vHeight + 'vh' }"
></div>
</chart-container>
</template>
<script>
import screenfull from "screenfull";
import ChartContainerVue from "../components/ChartContainer.vue";
import chartMixin from "../mixins/chart.js";
export default {
name: "RightChartBase",
components: {
ChartContainer: ChartContainerVue,
},
mixins: [chartMixin],
props: {
vHeight: {
type: Number,
default: 34,
},
legend: {
type: Array,
required: true,
},
xAxis: {
type: Array,
required: true,
},
series: {
type: Array,
required: true,
},
},
data() {
return {
isFullscreen: false,
options: {
grid: {
left: "3%",
right: "4%",
bottom: "0",
top: "15%",
containLabel: true,
},
tooltip: {},
xAxis: {
axisTick: {
show: false,
},
axisLine: {
lineStyle: {
color: "#4561AE",
},
},
axisLabel: {
color: "#fff",
fontSize: 12,
},
data: this.xAxis,
},
yAxis: {
name: "单位/片",
nameTextStyle: {
color: "#fff",
fontSize: 12,
},
axisTick: {
show: false,
},
axisLabel: {
color: "#fff",
fontSize: 12,
},
axisLine: {
show: true,
lineStyle: {
color: "#4561AE",
},
},
splitLine: {
lineStyle: {
color: "#4561AE",
},
},
},
series: [
{
name: "2023年",
type: "bar",
barWidth: 12,
itemStyle: {
borderRadius: [10, 10, 0, 0],
color: {
type: "linear",
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: "#12f7f1", // 0%
},
{
offset: 0.35,
color: "#12f7f177", // 100%
},
{
offset: 0.75,
color: "#12f7f133", // 100%
},
{
offset: 1,
color: "transparent", // 100%
},
],
global: false, // false
},
},
data: this.series[0].data,
},
{
name: "2024年",
type: "bar",
barWidth: 12,
// tooltip: {
// valueFormatter: function (value) {
// return value + " ml";
// },
// },
itemStyle: {
borderRadius: [10, 10, 0, 0],
color: {
type: "linear",
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: "#57abf8", // 0%
},
{
offset: 1,
color: "#364BFE66", // 100%
},
],
global: false, // false
},
},
data: this.series[1].data,
},
],
},
};
},
watch: {
isFullscreen(val) {
this.options.series.map((item) => {
item.barWidth = val ? 24 : 12;
});
this.options.xAxis.axisLabel.fontSize = val ? 18 : 12;
this.options.yAxis.axisLabel.fontSize = val ? 18 : 12;
this.options.yAxis.nameTextStyle.fontSize = val ? 18 : 12;
this.initOptions(this.options);
},
},
mounted() {
this.initOptions(this.options);
if (screenfull.isEnabled) {
screenfull.on("change", () => {
this.isFullscreen = screenfull.isFullscreen;
});
}
},
};
</script>
<style scoped lang="scss">
.left-chart-base {
// position: relative;
.legend {
position: absolute;
top: 5.2vh;
right: 1vw;
}
.legend-item {
position: relative;
font-size: 12px;
margin-right: 0.67vw;
&::before {
content: "";
display: inline-block;
width: 10px;
height: 10px;
background-color: #ccc;
border-radius: 2px;
margin-right: 0.22vw;
}
}
.legend-item:nth-child(1):before {
background-color: #12f7f1;
}
.legend-item:nth-child(2):before {
background-color: #58adfa;
}
/** add more */
// .legend-item:nth-child(3):before {
// background-color: #f7f1;
// }
}
</style>

View File

@ -23,11 +23,9 @@
icon="std" icon="std"
title="标准组件产出" title="标准组件产出"
></db-container> ></db-container>
<db-container <db-container side="right" icon="bipv" title="BIPV产出">
side="right" <bipv-chart />
icon="bipv" </db-container>
title="BIPV产出"
></db-container>
</div> </div>
</div> </div>
</div> </div>
@ -49,6 +47,7 @@ import Container from "./dashboard/components/Container.vue";
import ChartContainer from "./dashboard/components/ChartContainer.vue"; import ChartContainer from "./dashboard/components/ChartContainer.vue";
import FtoChart from "./dashboard/charts/Fto.vue"; import FtoChart from "./dashboard/charts/Fto.vue";
import ChipInvestChart from "./dashboard/charts/ChipInvest.vue"; import ChipInvestChart from "./dashboard/charts/ChipInvest.vue";
import BipvChart from "./dashboard/charts/Bipv.vue";
export default { export default {
name: "Index", name: "Index",
@ -59,6 +58,7 @@ export default {
ChartContainer, ChartContainer,
FtoChart, FtoChart,
ChipInvestChart, ChipInvestChart,
BipvChart,
}, },
data() { data() {
return { return {