diff --git a/ruoyi-ui/src/views/benyi/checkinstatisticsschool/index.vue b/ruoyi-ui/src/views/benyi/checkinstatisticsschool/index.vue index e7d8a5b14..cbf8bfcdf 100644 --- a/ruoyi-ui/src/views/benyi/checkinstatisticsschool/index.vue +++ b/ruoyi-ui/src/views/benyi/checkinstatisticsschool/index.vue @@ -41,7 +41,7 @@
-

{{this.user.dept.deptName}}班级儿童考勤表

+

{{ this.deptName }}班级儿童考勤表

考勤月份:{{ this.month }} ------ 班级总数:{{ this.classcount }} ------ 幼儿总数:{{ this.chilidcount }} @@ -86,7 +86,7 @@ export default { data() { return { //用户信息 - user: {}, + deptName: "", //幼儿总数 chilidcount: "", //班级数量 @@ -144,8 +144,9 @@ export default { }, methods: { getUser() { - getUserProfile().then(response => { - this.user = response.data; + getUserProfile().then((response) => { + // console.log(response.data); + this.deptName = response.data.dept.deptName; }); }, getNowTime() { @@ -167,6 +168,10 @@ export default { column_name: "bjmc", sort: "班级", }); + this.tableHead.push({ + column_name: "zj", + sort: "总计", + }); response.rows.forEach((res) => { this.tableHead.push({ column_name: "", @@ -196,6 +201,39 @@ export default { response.rows.forEach((res) => { this.tableData.push({ bjmc: res.bjmc, + 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" ? "" @@ -326,6 +364,22 @@ export default { this.loading = false; }); }, + avg(a1) { + console.log("a" + a1.length); + //bug 这个地方的分母a 应该取值所有班级的最大值 + var a = 0; + var sum = 0; + a1.forEach((res) => { + if (res > 0) { + a = a + 1; + sum = sum + res; + } + }); + if (a == 0) { + return ""; + } + return parseFloat(((sum / a) * 100).toFixed(2)) + "%"; + }, /** 搜索按钮操作 */ handleQuery() { this.queryParams.pageNum = 1;