班级考勤统计优化

This commit is contained in:
paidaxing444 2020-09-27 17:06:24 +08:00
parent 37d282b949
commit 730bab82fc
2 changed files with 73 additions and 38 deletions

View File

@ -67,13 +67,13 @@
</el-table> </el-table>
</div> </div>
<pagination <!-- <pagination
v-show="total > 0" v-show="total > 0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> /> -->
</div> </div>
</template> </template>
@ -180,8 +180,43 @@ export default {
this.bjmc = response.rows[0].bjmc; this.bjmc = response.rows[0].bjmc;
this.childcount = response.rows.length; this.childcount = response.rows.length;
this.jsmc = response.rows[0].zbjsmc; this.jsmc = response.rows[0].zbjsmc;
this.tableData = response.rows; // this.tableData = response.rows;
this.total = response.total; response.rows.forEach((res) => {
this.tableData.push({
name: res.name,
day1: res.day1 == "0%" ? "" : res.day1,
day2: res.day2 == "0%" ? "" : res.day2,
day3: res.day3 == "0%" ? "" : res.day3,
day4: res.day4 == "0%" ? "" : res.day4,
day5: res.day5 == "0%" ? "" : res.day5,
day6: res.day6 == "0%" ? "" : res.day6,
day7: res.day7 == "0%" ? "" : res.day7,
day8: res.day8 == "0%" ? "" : res.day8,
day9: res.day9 == "0%" ? "" : res.day9,
day10: res.day10 == "0%" ? "" : res.day10,
day11: res.day11 == "0%" ? "" : res.day11,
day12: res.day12 == "0%" ? "" : res.day12,
day13: res.day13 == "0%" ? "" : res.day13,
day14: res.day14 == "0%" ? "" : res.day14,
day15: res.day15 == "0%" ? "" : res.day15,
day16: res.day16 == "0%" ? "" : res.day16,
day17: res.day17 == "0%" ? "" : res.day17,
day18: res.day18 == "0%" ? "" : res.day18,
day19: res.day19 == "0%" ? "" : res.day19,
day20: res.day20 == "0%" ? "" : res.day20,
day21: res.day21 == "0%" ? "" : res.day21,
day22: res.day22 == "0%" ? "" : res.day22,
day23: res.day23 == "0%" ? "" : res.day23,
day24: res.day24 == "0%" ? "" : res.day24,
day25: res.day25 == "0%" ? "" : res.day25,
day26: res.day26 == "0%" ? "" : res.day26,
day27: res.day27 == "0%" ? "" : res.day27,
day28: res.day28 == "0%" ? "" : res.day28,
day29: res.day29 == "0%" ? "" : res.day29,
day30: res.day30 == "0%" ? "" : res.day30,
day31: res.day31 == "0%" ? "" : res.day31,
});
});
this.loading = false; this.loading = false;
}); });
}, },

View File

@ -542,76 +542,76 @@
and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-31')) as day31 and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-31')) as day31
from by_child c from by_child c
where c.status = '0' where c.status = '0'
<if test="classid != null and classid != ''">and c.classid = #{classid}</if> and c.classid = #{classid}
<!-- 数据范围过滤 --> <!-- 数据范围过滤 -->
-- ${dataScope} -- ${dataScope}
union all union all
select '','classid', '小计','','', select '',classid, '小计','','',
CONCAT(convert(((select count(*) from by_child_checkin_detail where CONCAT(convert(((select count(*) from by_child_checkin_detail where
type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-01') and classid=c.classid) / count(*)*100),decimal), '%') as day1, type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-01') and classid=#{classid}) / count(*)*100),decimal), '%') as day1,
CONCAT(convert(((select count(*) from by_child_checkin_detail where CONCAT(convert(((select count(*) from by_child_checkin_detail where
type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-02') and classid=c.classid) / count(*)*100),decimal), '%') as day2, type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-02') and classid=#{classid}) / count(*)*100),decimal), '%') as day2,
CONCAT(convert(((select count(*) from by_child_checkin_detail where CONCAT(convert(((select count(*) from by_child_checkin_detail where
type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-03') and classid=c.classid) / count(*)*100),decimal), '%') as day3, type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-03') and classid=#{classid}) / count(*)*100),decimal), '%') as day3,
CONCAT(convert(((select count(*) from by_child_checkin_detail where CONCAT(convert(((select count(*) from by_child_checkin_detail where
type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-04') and classid=c.classid) / count(*)*100),decimal), '%') as day4, type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-04') and classid=#{classid}) / count(*)*100),decimal), '%') as day4,
CONCAT(convert(((select count(*) from by_child_checkin_detail where CONCAT(convert(((select count(*) from by_child_checkin_detail where
type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-05') and classid=c.classid) / count(*)*100),decimal), '%') as day5, type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-05') and classid=#{classid}) / count(*)*100),decimal), '%') as day5,
CONCAT(convert(((select count(*) from by_child_checkin_detail where CONCAT(convert(((select count(*) from by_child_checkin_detail where
type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-06') and classid=c.classid) / count(*)*100),decimal), '%') as day6, type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-06') and classid=#{classid}) / count(*)*100),decimal), '%') as day6,
CONCAT(convert(((select count(*) from by_child_checkin_detail where CONCAT(convert(((select count(*) from by_child_checkin_detail where
type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-07') and classid=c.classid) / count(*)*100),decimal), '%') as day7, type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-07') and classid=#{classid}) / count(*)*100),decimal), '%') as day7,
CONCAT(convert(((select count(*) from by_child_checkin_detail where CONCAT(convert(((select count(*) from by_child_checkin_detail where
type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-08') and classid=c.classid) / count(*)*100),decimal), '%') as day8, type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-08') and classid=#{classid}) / count(*)*100),decimal), '%') as day8,
CONCAT(convert(((select count(*) from by_child_checkin_detail where CONCAT(convert(((select count(*) from by_child_checkin_detail where
type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-09') and classid=c.classid) / count(*)*100),decimal), '%') as day9, type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-09') and classid=#{classid}) / count(*)*100),decimal), '%') as day9,
CONCAT(convert(((select count(*) from by_child_checkin_detail where CONCAT(convert(((select count(*) from by_child_checkin_detail where
type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-10') and classid=c.classid) / count(*)*100),decimal), '%') as day10, type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-10') and classid=#{classid}) / count(*)*100),decimal), '%') as day10,
CONCAT(convert(((select count(*) from by_child_checkin_detail where CONCAT(convert(((select count(*) from by_child_checkin_detail where
type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-11') and classid=c.classid) / count(*)*100),decimal), '%') as day11, type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-11') and classid=#{classid}) / count(*)*100),decimal), '%') as day11,
CONCAT(convert(((select count(*) from by_child_checkin_detail where CONCAT(convert(((select count(*) from by_child_checkin_detail where
type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-12') and classid=c.classid) / count(*)*100),decimal), '%') as day12, type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-12') and classid=#{classid}) / count(*)*100),decimal), '%') as day12,
CONCAT(convert(((select count(*) from by_child_checkin_detail where CONCAT(convert(((select count(*) from by_child_checkin_detail where
type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-13') and classid=c.classid) / count(*)*100),decimal), '%') as day13, type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-13') and classid=#{classid}) / count(*)*100),decimal), '%') as day13,
CONCAT(convert(((select count(*) from by_child_checkin_detail where CONCAT(convert(((select count(*) from by_child_checkin_detail where
type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-14') and classid=c.classid) / count(*)*100),decimal), '%') as day14, type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-14') and classid=#{classid}) / count(*)*100),decimal), '%') as day14,
CONCAT(convert(((select count(*) from by_child_checkin_detail where CONCAT(convert(((select count(*) from by_child_checkin_detail where
type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-15') and classid=c.classid) / count(*)*100),decimal), '%') as day15, type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-15') and classid=#{classid}) / count(*)*100),decimal), '%') as day15,
CONCAT(convert(((select count(*) from by_child_checkin_detail where CONCAT(convert(((select count(*) from by_child_checkin_detail where
type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-16') and classid=c.classid) / count(*)*100),decimal), '%') as day16, type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-16') and classid=#{classid}) / count(*)*100),decimal), '%') as day16,
CONCAT(convert(((select count(*) from by_child_checkin_detail where CONCAT(convert(((select count(*) from by_child_checkin_detail where
type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-17') and classid=c.classid) / count(*)*100),decimal), '%') as day17, type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-17') and classid=#{classid}) / count(*)*100),decimal), '%') as day17,
CONCAT(convert(((select count(*) from by_child_checkin_detail where CONCAT(convert(((select count(*) from by_child_checkin_detail where
type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-18') and classid=c.classid) / count(*)*100),decimal), '%') as day18, type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-18') and classid=#{classid}) / count(*)*100),decimal), '%') as day18,
CONCAT(convert(((select count(*) from by_child_checkin_detail where CONCAT(convert(((select count(*) from by_child_checkin_detail where
type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-19') and classid=c.classid) / count(*)*100),decimal), '%') as day19, type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-19') and classid=#{classid}) / count(*)*100),decimal), '%') as day19,
CONCAT(convert(((select count(*) from by_child_checkin_detail where CONCAT(convert(((select count(*) from by_child_checkin_detail where
type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-20') and classid=c.classid) / count(*)*100),decimal), '%') as day20, type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-20') and classid=#{classid}) / count(*)*100),decimal), '%') as day20,
CONCAT(convert(((select count(*) from by_child_checkin_detail where CONCAT(convert(((select count(*) from by_child_checkin_detail where
type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-21') and classid=c.classid) / count(*)*100),decimal), '%') as day21, type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-21') and classid=#{classid}) / count(*)*100),decimal), '%') as day21,
CONCAT(convert(((select count(*) from by_child_checkin_detail where CONCAT(convert(((select count(*) from by_child_checkin_detail where
type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-22') and classid=c.classid) / count(*)*100),decimal), '%') as day22, type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-22') and classid=#{classid}) / count(*)*100),decimal), '%') as day22,
CONCAT(convert(((select count(*) from by_child_checkin_detail where CONCAT(convert(((select count(*) from by_child_checkin_detail where
type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-23') and classid=c.classid) / count(*)*100),decimal), '%') as day23, type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-23') and classid=#{classid}) / count(*)*100),decimal), '%') as day23,
CONCAT(convert(((select count(*) from by_child_checkin_detail where CONCAT(convert(((select count(*) from by_child_checkin_detail where
type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-24') and classid=c.classid) / count(*)*100),decimal), '%') as day24, type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-24') and classid=#{classid}) / count(*)*100),decimal), '%') as day24,
CONCAT(convert(((select count(*) from by_child_checkin_detail where CONCAT(convert(((select count(*) from by_child_checkin_detail where
type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-25') and classid=c.classid) / count(*)*100),decimal), '%') as day25, type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-25') and classid=#{classid}) / count(*)*100),decimal), '%') as day25,
CONCAT(convert(((select count(*) from by_child_checkin_detail where CONCAT(convert(((select count(*) from by_child_checkin_detail where
type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-26') and classid=c.classid) / count(*)*100),decimal), '%') as day26, type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-26') and classid=#{classid}) / count(*)*100),decimal), '%') as day26,
CONCAT(convert(((select count(*) from by_child_checkin_detail where CONCAT(convert(((select count(*) from by_child_checkin_detail where
type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-27') and classid=c.classid) / count(*)*100),decimal), '%') as day27, type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-27') and classid=#{classid}) / count(*)*100),decimal), '%') as day27,
CONCAT(convert(((select count(*) from by_child_checkin_detail where CONCAT(convert(((select count(*) from by_child_checkin_detail where
type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-28') and classid=c.classid) / count(*)*100),decimal), '%') as day28, type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-28') and classid=#{classid}) / count(*)*100),decimal), '%') as day28,
CONCAT(convert(((select count(*) from by_child_checkin_detail where CONCAT(convert(((select count(*) from by_child_checkin_detail where
type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-29') and classid=c.classid) / count(*)*100),decimal), '%') as day29, type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-29') and classid=#{classid}) / count(*)*100),decimal), '%') as day29,
CONCAT(convert(((select count(*) from by_child_checkin_detail where CONCAT(convert(((select count(*) from by_child_checkin_detail where
type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-30') and classid=c.classid) / count(*)*100),decimal), '%') as day30, type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-30') and classid=#{classid}) / count(*)*100),decimal), '%') as day30,
CONCAT(convert(((select count(*) from by_child_checkin_detail where CONCAT(convert(((select count(*) from by_child_checkin_detail where
type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-31') and classid=c.classid) / count(*)*100),decimal), '%') as day31 type='01' and date_format(create_time,'%Y-%m-%d')=concat(#{month},'-31') and classid=#{classid}) / count(*)*100),decimal), '%') as day31
from by_child c from by_child c
where c.status = '0' where c.status = '0'
<if test="classid != null and classid != ''">and c.classid = #{classid}</if> and c.classid = #{classid}
<!-- 数据范围过滤 --> <!-- 数据范围过滤 -->
-- ${dataScope} -- ${dataScope}
</select> </select>