From 12f6f0cfd25b19dbf17de93cf6764e2955230516 Mon Sep 17 00:00:00 2001 From: paidaxing444 <12qwaszx> Date: Mon, 28 Sep 2020 15:27:46 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E8=80=83=E5=8B=A4=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E4=BC=98=E5=8C=96;=E6=96=B0=E5=A2=9E=E6=80=BB?= =?UTF-8?q?=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../benyi/checkinstatisticsclass/index.vue | 62 ++++++++++++++++++- .../benyi/checkinstatisticsschool/index.vue | 2 +- 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/ruoyi-ui/src/views/benyi/checkinstatisticsclass/index.vue b/ruoyi-ui/src/views/benyi/checkinstatisticsclass/index.vue index 754252b8e..209fcc93c 100644 --- a/ruoyi-ui/src/views/benyi/checkinstatisticsclass/index.vue +++ b/ruoyi-ui/src/views/benyi/checkinstatisticsclass/index.vue @@ -160,6 +160,10 @@ export default { column_name: "name", sort: "姓名", }); + this.tableHead.push({ + column_name: "zj", + sort: "总计", + }); response.rows.forEach((res) => { this.tableHead.push({ column_name: "", @@ -178,12 +182,45 @@ export default { listChildCheck(this.queryParams).then((response) => { console.log(response.rows); this.bjmc = response.rows[0].bjmc; - this.childcount = response.rows.length; + this.childcount = response.rows.length - 1; this.jsmc = response.rows[0].zbjsmc; // this.tableData = response.rows; response.rows.forEach((res) => { this.tableData.push({ name: res.name, + zj: this.avg([ + res.day1, + res.day2, + res.day3, + res.day4, + res.day5, + res.day6, + res.day7, + res.day8, + res.day9, + res.day10, + res.day11, + res.day12, + res.day13, + res.day14, + res.day15, + res.day16, + res.day17, + res.day18, + res.day19, + res.day20, + res.day21, + res.day22, + res.day23, + res.day24, + res.day25, + res.day26, + res.day27, + res.day28, + res.day29, + res.day30, + res.day31, + ]), day1: res.day1 == "0%" ? "" : res.day1, day2: res.day2 == "0%" ? "" : res.day2, day3: res.day3 == "0%" ? "" : res.day3, @@ -220,6 +257,29 @@ export default { this.loading = false; }); }, + avg(a1) { + console.log("a" + a1); + //bug 这个地方的分母a 应该取值所有班级的最大值 + var a = 0; + var sum = 0; + a1.forEach((res) => { + if (res != "" && res != "0%" && res != null) { + // console.log("res:" + res); + a = a + 1; + if (res == "在园") { + sum = sum + 1; + } + if (res.indexOf("%") != -1) { + // console.log(res.split("%")[0]); + sum = sum + parseInt(res.split("%")[0])/100; + } + } + }); + if (a == 0) { + return ""; + } + return parseFloat(((sum / a) * 100).toFixed(2)) + "%"; + }, /** 搜索按钮操作 */ handleQuery() { this.queryParams.pageNum = 1; diff --git a/ruoyi-ui/src/views/benyi/checkinstatisticsschool/index.vue b/ruoyi-ui/src/views/benyi/checkinstatisticsschool/index.vue index cbf8bfcdf..47f11b9bb 100644 --- a/ruoyi-ui/src/views/benyi/checkinstatisticsschool/index.vue +++ b/ruoyi-ui/src/views/benyi/checkinstatisticsschool/index.vue @@ -365,7 +365,7 @@ export default { }); }, avg(a1) { - console.log("a" + a1.length); + // console.log("a" + a1.length); //bug 这个地方的分母a 应该取值所有班级的最大值 var a = 0; var sum = 0;