From c34b4a4c64ff9f24bceef1db4b4080db1529a18b Mon Sep 17 00:00:00 2001 From: yinq <1345442242@qq.com> Date: Wed, 22 Nov 2023 10:34:38 +0800 Subject: [PATCH] =?UTF-8?q?update=20-=20=E8=B4=A7=E9=81=93=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../report/inventoryStatistics/index.vue | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/views/report/inventoryStatistics/index.vue b/src/views/report/inventoryStatistics/index.vue index a0e1183..490f875 100644 --- a/src/views/report/inventoryStatistics/index.vue +++ b/src/views/report/inventoryStatistics/index.vue @@ -46,7 +46,7 @@
-
货道占用统计
+
货道占用统计(货道容量:{{this.spaceNumber}} 已占用容量:{{this.occupancyNumber}})
@@ -116,7 +116,9 @@ export default { xValue: ['货道01', '货道02', '货道03', '货道04', '货道05', '货道06', '货道07'], yValueOne: [120, 132, 101, 134, 90, 230, 210], yValueTwo: [150, 232, 201, 154, 190, 330, 410] - } + }, + spaceNumber: 0, + occupancyNumber: 0, } }, created() { @@ -130,6 +132,8 @@ export default { }, mounted() { this.$nextTick(() => { + this.barChart = echarts.init(this.$refs.barChart); + this.pieChart = echarts.init(this.$refs.pieChart); this.initPieChart(); this.initBarChart(); }); @@ -151,13 +155,15 @@ export default { this.barChartData = { xValue: response.data.map(item => item.storeName + item.spaceName), yValueOne: response.data.map(item => item.spaceStock), - yValueTwo: response.data.map(item => item.spaceCapacity), + yValueTwo: response.data.map(item => item.spaceCapacity - item.spaceStock), }; + this.spaceNumber = response.data.map(item => item.spaceCapacity).reduce((accumulator, currentValue) => accumulator + currentValue); + this.occupancyNumber = response.data.map(item => item.spaceStock).reduce((accumulator, currentValue) => accumulator + currentValue); + console.log(this.spaceNumber) this.initBarChart(); }); }, initPieChart() { - this.pieChart = echarts.init(this.$refs.pieChart); // 在这里添加饼图的数据和配置 const option = { tooltip: { @@ -192,7 +198,6 @@ export default { this.pieChart.setOption(option); }, initBarChart() { - this.barChart = echarts.init(this.$refs.barChart); // 在这里添加柱状图的数据和配置 const option = { tooltip: { @@ -230,13 +235,13 @@ export default { data: this.barChartData.yValueOne }, { - name: '货道容量', + name: '货道空余容量', type: 'bar', stack: 'Ad', emphasis: { focus: 'series' }, - data: this.barChartData.yValueTwo + data: this.barChartData.yValueTwo, }, ] };