From d950a89b2ff5da5b2e0f6db759899a1065404d94 Mon Sep 17 00:00:00 2001 From: Jack <1638169491@qq.com> Date: Thu, 4 Aug 2022 16:12:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B9=96=E9=87=8C=E5=A4=A7=E5=B1=8F=EF=BC=9A?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=20jChart/bar/JBarChart.vue=20=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=B0=81=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../projectHuScreen/jChart/bar/JBarChart.vue | 23 ++-- .../laborManage/leftBottom.vue | 127 +++++++----------- 2 files changed, 59 insertions(+), 91 deletions(-) diff --git a/src/views/projectAdmin/dataBoard/projectHuScreen/jChart/bar/JBarChart.vue b/src/views/projectAdmin/dataBoard/projectHuScreen/jChart/bar/JBarChart.vue index b674067c..1c88d2fa 100644 --- a/src/views/projectAdmin/dataBoard/projectHuScreen/jChart/bar/JBarChart.vue +++ b/src/views/projectAdmin/dataBoard/projectHuScreen/jChart/bar/JBarChart.vue @@ -26,7 +26,10 @@ export default { default: () => [] }, yData: { - required: true, + type: Array, + default: () => [] + }, + series: { type: Array, default: () => [] } @@ -40,7 +43,15 @@ export default { }, methods: { createChart() { - const { title, grid, color, xData, yData } = this + const { title, grid, color, xData, yData, series } = this + const configSeries = (series => { + if (series.length) { + return series.map(item => ({ data: item.data, type: 'bar', barWidth: 15 })) + } else { + return [{ data: yData, type: 'bar', barWidth: 15 }] + } + })(series) + const option = { title: { text: title.text, @@ -104,13 +115,7 @@ export default { show: false } }, - series: [ - { - data: yData, - type: 'bar', - barWidth: 15 - } - ] + series: configSeries } this.jBarChart.setOption(option) } diff --git a/src/views/projectAdmin/dataBoard/projectHuScreen/laborManage/leftBottom.vue b/src/views/projectAdmin/dataBoard/projectHuScreen/laborManage/leftBottom.vue index 131a6b5c..ff3fa32d 100644 --- a/src/views/projectAdmin/dataBoard/projectHuScreen/laborManage/leftBottom.vue +++ b/src/views/projectAdmin/dataBoard/projectHuScreen/laborManage/leftBottom.vue @@ -1,112 +1,75 @@ - -