From 6409d2d348e7919b553a32e9d398c22cb92d1087 Mon Sep 17 00:00:00 2001 From: helloDy <1615073571@qq.com> Date: Tue, 23 Jul 2024 17:59:11 +0800 Subject: [PATCH 1/2] bug --- src/views/produce/data/index.vue | 39 ++++++++++++++++---------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/src/views/produce/data/index.vue b/src/views/produce/data/index.vue index f6697f2..609b212 100644 --- a/src/views/produce/data/index.vue +++ b/src/views/produce/data/index.vue @@ -1,7 +1,7 @@ @@ -392,8 +392,8 @@ export default { // 工厂名称 this.factoryListabbr const factoryNameArray = (this.listQuery.factory.length === 0 || this.listQuery.factory.length === this.factoryListabbr.length) ? [0, 1] : this.listQuery.factory const seriesArray = [] - typeArray.forEach((type, typeIndex) => { - factoryNameArray.forEach((fac, facIndex) => { + factoryNameArray.forEach((fac, facIndex) => { + typeArray.forEach((type, typeIndex) => { const series = { data: Array(xAxisData.length).fill(0), type: 'bar', @@ -407,27 +407,26 @@ export default { seriesArray.push(series) }) }) - // 构造series的data - const seriesDataArray = [] - Object.values(data).forEach((item) => { - let seriesData = [] - // item[0].datestr 为日期 - typeArray.forEach(t => { - const zidr = ['chipYield', 'componentYield', 'bipvProductOutput'][t] + + // 按工厂分 + const arrayByFacArray = Object.groupBy(dataList, (member) => member.factory) + // const seriesDataArray = [] + let n = 0 + Object.values(arrayByFacArray).forEach((item) => { + typeArray.forEach(type => { + const typeName = ['chipYield', 'componentYield', 'bipvProductOutput'][type] + let seriesData = Array(xAxisData.length).fill(0) item.forEach(it => { - seriesData.push(it[zidr]) + xAxisData.forEach((x, xindex) => { + if (x === it['datestr']) { + seriesData[xindex] = it[typeName] + } + }) }) + seriesArray[n].data = seriesData + n ++ }) - seriesDataArray.push(seriesData) }) - for (let y = 0; y < seriesArray.length; y ++) { - const days = [] - seriesDataArray.forEach(a => { - days.push(a[y]) - }) - // 赋值完成 - seriesArray[y].data = days - } // 添加工厂 const validSeriesArray = [] From 3e2661581e5605c7789b63ed0a8e102d68b7f6b8 Mon Sep 17 00:00:00 2001 From: helloDy <1615073571@qq.com> Date: Wed, 24 Jul 2024 14:51:26 +0800 Subject: [PATCH 2/2] bug --- src/views/produce/data/index.vue | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/views/produce/data/index.vue b/src/views/produce/data/index.vue index 87923f3..4c18944 100644 --- a/src/views/produce/data/index.vue +++ b/src/views/produce/data/index.vue @@ -1,7 +1,7 @@ @@ -39,7 +39,7 @@ + placeholder="开始时间" @change="getYear"> ~ {