From 1ef4615587b3b5707112135d8b5d2841bcf20295 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=9D=A8?= <666> Date: Tue, 15 Oct 2024 15:24:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BD=9C=E4=B8=9A=E6=89=B9=E9=98=85?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=E4=BF=AE=E6=94=B9=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../classOverview/distribution/echarts.vue | 21 +++++---- .../classOverview/distribution/stuList.vue | 44 ++++++++++++------- 2 files changed, 41 insertions(+), 24 deletions(-) diff --git a/src/renderer/src/views/classTask/container/classOverview/distribution/echarts.vue b/src/renderer/src/views/classTask/container/classOverview/distribution/echarts.vue index 9f6ae08..d139c2f 100644 --- a/src/renderer/src/views/classTask/container/classOverview/distribution/echarts.vue +++ b/src/renderer/src/views/classTask/container/classOverview/distribution/echarts.vue @@ -15,11 +15,11 @@ const chartRef = ref(null); // 数据源 const dataList = ref([ - {name: '优', value: 0,rating:1}, - {name: '优-', value: 0,rating:2}, - {name: '良', value: 0,rating:3}, - {name: '良-', value: 0,rating:4}, - {name: '差', value: 0,rating:5}, + {name: '完美', value: 0,rating:1,max:100,min:100,}, + {name: '优秀', value: 0,rating:2,max:99,min:80,}, + {name: '良好', value: 0,rating:3,max:79,min:70,}, + {name: '及格', value: 0,rating:4,max:69,min:60,}, + {name: '不及格', value: 0,rating:5,max:59,min:0,}, ]); // 根据数据生成不同的颜色 @@ -81,10 +81,13 @@ function initChart() { } // 获取表的数据 const showEcharts =() => { - useOverview.tableList.forEach(item => { - const index = dataList.value.findIndex(item1 => item1.rating === item.rating) - if(index !== -1) - dataList.value[index].value ++ + useOverview.tableList.forEach((item,index) => { + if(item.rating === 0) return // 没批改不计数 + dataList.value.forEach((item1,index1) => { + if(item1.min <= Number(item.scoingRate) && Number(item.scoingRate) <= item1.max ){ + item1.value ++ + } + }) }) } watch(() => useOverview.tableList,() => { diff --git a/src/renderer/src/views/classTask/container/classOverview/distribution/stuList.vue b/src/renderer/src/views/classTask/container/classOverview/distribution/stuList.vue index df21f66..c1de098 100644 --- a/src/renderer/src/views/classTask/container/classOverview/distribution/stuList.vue +++ b/src/renderer/src/views/classTask/container/classOverview/distribution/stuList.vue @@ -1,7 +1,7 @@