From ceb411180f57c51397b0d78042da9c2945f1918c Mon Sep 17 00:00:00 2001 From: "DESKTOP-FUDKNA8\\znjsz" Date: Thu, 18 Apr 2024 17:00:05 +0800 Subject: [PATCH] done home --- src/views/dashboard/charts/Fto.vue | 1 - src/views/dashboard/charts/LeftChartBase.vue | 33 +++++++++++----- src/views/dashboard/charts/RightChartBase.vue | 39 +++++++++++++------ src/views/dashboard/components/Container.vue | 1 + 4 files changed, 53 insertions(+), 21 deletions(-) diff --git a/src/views/dashboard/charts/Fto.vue b/src/views/dashboard/charts/Fto.vue index 98744f5..d72a4e0 100644 --- a/src/views/dashboard/charts/Fto.vue +++ b/src/views/dashboard/charts/Fto.vue @@ -35,7 +35,6 @@ export default { computed: { series() { const ftoInvest = this.$store.getters.home.ftoInvest; - if (!ftoInvest || !ftoInvest.current || !ftoInvest.previous) { return [ { diff --git a/src/views/dashboard/charts/LeftChartBase.vue b/src/views/dashboard/charts/LeftChartBase.vue index b6dfa53..179c5fb 100644 --- a/src/views/dashboard/charts/LeftChartBase.vue +++ b/src/views/dashboard/charts/LeftChartBase.vue @@ -56,6 +56,7 @@ export default { data() { return { isFullscreen: false, + actualOptions: null, options: { grid: { left: "3%", @@ -107,7 +108,7 @@ export default { }, series: [ { - name: this.series[0].name, + name: '', // this.series[0].name, type: "bar", barWidth: 12, itemStyle: { @@ -139,10 +140,10 @@ export default { global: false, // 缺省为 false }, }, - data: this.series[0].data, + data: [], // this.series[0].data, }, { - name: this.series[1].name, + name: '', // this.series[1].name, type: "bar", barWidth: 12, // tooltip: { @@ -171,7 +172,7 @@ export default { global: false, // 缺省为 false }, }, - data: this.series[1].data, + data: [], // this.series[1].data, }, ], }, @@ -180,16 +181,30 @@ export default { watch: { /** 全屏状态切换时,对柱子粗细和字体大小进行相应调整 */ isFullscreen(val) { - this.options.series.map((item) => { + this.actualOptions.series.map((item) => { item.barWidth = val ? 18 : 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); + this.actualOptions.xAxis.axisLabel.fontSize = val ? 18 : 12; + this.actualOptions.yAxis.axisLabel.fontSize = val ? 18 : 12; + this.actualOptions.yAxis.nameTextStyle.fontSize = val ? 18 : 12; + this.initOptions(this.actualOptions); + }, + series(val) { + if (!val) { + this.initOptions(this.options); + return; + } + const actualOptions = JSON.parse(JSON.stringify(this.options)); + actualOptions.series[0].data = val[0].data; + actualOptions.series[0].name = val[0].name; + actualOptions.series[1].data = val[1].data; + actualOptions.series[1].name = val[1].name; + this.actualOptions = actualOptions; + this.initOptions(actualOptions); }, }, mounted() { + this.actualOptions = this.options; this.initOptions(this.options); if (screenfull.isEnabled) { diff --git a/src/views/dashboard/charts/RightChartBase.vue b/src/views/dashboard/charts/RightChartBase.vue index c139c56..781b3c4 100644 --- a/src/views/dashboard/charts/RightChartBase.vue +++ b/src/views/dashboard/charts/RightChartBase.vue @@ -107,7 +107,7 @@ export default { }, series: [ { - name: "2024年目标值", + name: "", // "2024年目标值", type: "line", lineStyle: { color: "#f3c000", @@ -139,10 +139,10 @@ export default { global: false, // 缺省为 false }, }, - data: this.series[0].data, + data: [], // this.series[0].data, }, { - name: "2023年", + name: "", // "2023年", type: "bar", barWidth: 12, itemStyle: { @@ -174,10 +174,10 @@ export default { global: false, // 缺省为 false }, }, - data: this.series[1].data, + data: [], // this.series[1].data, }, { - name: "2024年", + name: "", // "2024年", type: "bar", barWidth: 12, // tooltip: { @@ -206,25 +206,42 @@ export default { global: false, // 缺省为 false }, }, - data: this.series[2].data, + data: [], // this.series[2].data, }, ], }, + actualOptions: null, }; }, watch: { /** 全屏状态切换时,对柱子粗细和字体大小进行相应调整 */ isFullscreen(val) { - this.options.series.map((item) => { + this.actualOptions.series.map((item) => { item.barWidth = val ? 18 : 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); + this.actualOptions.xAxis.axisLabel.fontSize = val ? 18 : 12; + this.actualOptions.yAxis.axisLabel.fontSize = val ? 18 : 12; + this.actualOptions.yAxis.nameTextStyle.fontSize = val ? 18 : 12; + this.initOptions(this.actualOptions); + }, + series(val) { + if (!val) { + this.initOptions(this.options); + return; + } + const actualOptions = JSON.parse(JSON.stringify(this.options)); + actualOptions.series[0].data = val[0].data; + actualOptions.series[0].name = val[0].name; + actualOptions.series[1].data = val[1].data; + actualOptions.series[1].name = val[1].name; + actualOptions.series[2].data = val[2].data; + actualOptions.series[2].name = val[2].name; + this.actualOptions = actualOptions; + this.initOptions(actualOptions); }, }, mounted() { + this.actualOptions = this.options; this.initOptions(this.options); if (screenfull.isEnabled) { diff --git a/src/views/dashboard/components/Container.vue b/src/views/dashboard/components/Container.vue index 4292491..1fe7626 100644 --- a/src/views/dashboard/components/Container.vue +++ b/src/views/dashboard/components/Container.vue @@ -9,6 +9,7 @@