From ba9eec51cfd3a21965582f84a2a255b4f16ec250 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BA=9E=E4=B8=9C=E6=9E=97?= Date: Wed, 8 Dec 2021 20:42:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=B4=E5=BA=A6=E5=AF=B9=E6=AF=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../statistic/inner/component/comparison.vue | 59 +++++++++++-------- 1 file changed, 33 insertions(+), 26 deletions(-) diff --git a/src/views/water/lake/statistic/inner/component/comparison.vue b/src/views/water/lake/statistic/inner/component/comparison.vue index 727826b..9c7b1f3 100644 --- a/src/views/water/lake/statistic/inner/component/comparison.vue +++ b/src/views/water/lake/statistic/inner/component/comparison.vue @@ -3,7 +3,7 @@
- + { + filterData[index] = {} filterData[index].type = item.type; filterData[index].pointName = item.pointName; // 筛选出年份 - // if(Array.isArray(item.data)){ - // item.data.forEach((single,i)=>{ - // filterData[index]['comprehensiveNutrition'+i] = single.comprehensiveNutrition; - // filterData[index]['level'+i] = single.level; - // filterData[index]['overflow'+i] = single.overflow; - // filterData[index]['waterType'+i] = single.waterType; - // filterData[index]['year'+i] = single.year; + if(Array.isArray(item.data)){ + item.data.forEach((single,i)=>{ + filterData[index]['comprehensiveNutrition'+i] = single.comprehensiveNutrition; + filterData[index]['level'+i] = single.level; + filterData[index]['overflow'+i] = single.overflow; + filterData[index]['waterType'+i] = single.waterType; + filterData[index]['year'+i] = single.year; - // addCloumns[index].title = single.year - - // if(i==0){ - // addCloumns[index].children = [ - // { title: "水质类别", dataIndex: `waterType${i}`, sorter: true }, - // { title: "综合营养状态指数", dataIndex: `comprehensiveNutrition${i}`, sorter: true }, - // { title: "级别", dataIndex: `level${i}`, sorter: true }, - // { - // title: "超标项目(超标倍数)", - // dataIndex: `overflow${i}`, - // sorter: true, - // }, - // ] - // } + addCloumns[index] = {} + addCloumns[index].title = single.year + addCloumns[index].align = 'center' + if(i==0){ + addCloumns[index].children = [ + { title: "水质类别", dataIndex: `waterType${i}`, sorter: true,align:'center' }, + { title: "综合营养状态指数", dataIndex: `comprehensiveNutrition${i}`, sorter: true,align:'center' }, + { title: "级别", dataIndex: `level${i}`, sorter: true,align:'center' }, + { + title: "超标项目(超标倍数)", + align:'center', + dataIndex: `overflow${i}`, + sorter: true, + }, + ] + } - // }) - // } + }) + } }) } @@ -177,7 +181,7 @@ console.log('filterData',filterData) this.columns = [ { title: "类别", dataIndex: "type", sorter: true }, - { title: "点位名称", dataIndex: "pointName", sorter: true }, + { title: "点位名称", dataIndex: "pointName", sorter: true}, ...addCloumns ] this.datasource = filterData; @@ -215,4 +219,7 @@ console.log('filterData',filterData) \ No newline at end of file