学校考勤统计小计

This commit is contained in:
paidaxing444 2020-09-25 10:25:26 +08:00
parent 3db6468b9c
commit 1a8b7861ea
2 changed files with 269 additions and 41 deletions

View File

@ -1,6 +1,11 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> <el-form
:model="queryParams"
ref="queryForm"
:inline="true"
label-width="68px"
>
<el-form-item label="选择月份" prop="month"> <el-form-item label="选择月份" prop="month">
<el-date-picker <el-date-picker
clearable clearable
@ -14,20 +19,44 @@
></el-date-picker> ></el-date-picker>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> type="primary"
<el-button type="primary" plain size="mini" icon="el-icon-printer" @click="prints">打印</el-button> icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
<el-button
type="primary"
plain
size="mini"
icon="el-icon-printer"
@click="prints"
>打印</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div ref="printMe"> <div ref="printMe">
<h2 style="text-align:center;">幼儿园班级儿童考勤表({{this.month}})</h2> <h2 style="text-align: center">幼儿园班级儿童考勤表({{ this.month }})</h2>
<el-table v-loading="loading" style="width: 100%" border :data="tableData"> <el-table
<template v-for="(item,index) in tableHead"> v-loading="loading"
style="width: 100%"
border
:data="tableData"
>
<template v-for="(item, index) in tableHead">
<el-table-column <el-table-column
:prop=" item.column_name==''?'day'+(item.sort+1) : item.column_name" :prop="
:fixed="item.column_name!=''" item.column_name == ''
:label=" item.column_name==''?(item.sort+1)+'' : item.sort" ? 'day' + (item.sort + 1)
: item.column_name
"
:fixed="item.column_name != ''"
:label="item.column_name == '' ? item.sort + 1 + '' : item.sort"
:key="index" :key="index"
></el-table-column> ></el-table-column>
</template> </template>
@ -141,37 +170,130 @@ export default {
response.rows.forEach((res) => { response.rows.forEach((res) => {
this.tableData.push({ this.tableData.push({
bjmc: res.bjmc, bjmc: res.bjmc,
day1: res.day1 == "0" ? "" : res.day1 * 100 + "%", day1:
day2: res.day2 == "0" ? "" : res.day2 * 100 + "%", res.day1 == "0"
day3: res.day3 == "0" ? "" : res.day3 * 100 + "%", ? ""
day4: res.day4 == "0" ? "" : res.day4 * 100 + "%", : parseFloat((res.day1 * 100).toFixed(2)) + "%",
day5: res.day5 == "0" ? "" : res.day5 * 100 + "%", day2:
day6: res.day6 == "0" ? "" : res.day6 * 100 + "%", res.day2 == "0"
day7: res.day7 == "0" ? "" : res.day7 * 100 + "%", ? ""
day8: res.day8 == "0" ? "" : res.day8 * 100 + "%", : parseFloat((res.day2 * 100).toFixed(2)) + "%",
day9: res.day9 == "0" ? "" : res.day9 * 100 + "%", day3:
day10: res.day10 == "0" ? "" : res.day10 * 100 + "%", res.day3 == "0"
day11: res.day11 == "0" ? "" : res.day11 * 100 + "%", ? ""
day12: res.day12 == "0" ? "" : res.day12 * 100 + "%", : parseFloat((res.day3 * 100).toFixed(2)) + "%",
day13: res.day13 == "0" ? "" : res.day13 * 100 + "%", day4:
day14: res.day14 == "0" ? "" : res.day14 * 100 + "%", res.day4 == "0"
day15: res.day15 == "0" ? "" : res.day15 * 100 + "%", ? ""
day16: res.day16 == "0" ? "" : res.day16 * 100 + "%", : parseFloat((res.day4 * 100).toFixed(2)) + "%",
day17: res.day17 == "0" ? "" : res.day17 * 100 + "%", day5:
day18: res.day18 == "0" ? "" : res.day18 * 100 + "%", res.day5 == "0"
day19: res.day19 == "0" ? "" : res.day19 * 100 + "%", ? ""
day20: res.day20 == "0" ? "" : res.day20 * 100 + "%", : parseFloat((res.day5 * 100).toFixed(2)) + "%",
day21: res.day21 == "0" ? "" : res.day21 * 100 + "%", day6:
day22: res.day22 == "0" ? "" : res.day22 * 100 + "%", res.day6 == "0"
day23: res.day23 == "0" ? "" : res.day23 * 100 + "%", ? ""
day24: res.day24 == "0" ? "" : res.day24 * 100 + "%", : parseFloat((res.day6 * 100).toFixed(2)) + "%",
day25: res.day25 == "0" ? "" : res.day25 * 100 + "%", day7:
day26: res.day26 == "0" ? "" : res.day26 * 100 + "%", res.day7 == "0"
day27: res.day27 == "0" ? "" : res.day27 * 100 + "%", ? ""
day28: res.day28 == "0" ? "" : res.day28 * 100 + "%", : parseFloat((res.day7 * 100).toFixed(2)) + "%",
day29: res.day29 == "0" ? "" : res.day29 * 100 + "%", day8:
day30: res.day30 == "0" ? "" : res.day30 * 100 + "%", res.day8 == "0"
day31: res.day31 == "0" ? "" : res.day31 * 100 + "%", ? ""
: parseFloat((res.day8 * 100).toFixed(2)) + "%",
day9:
res.day9 == "0"
? ""
: parseFloat((res.day9 * 100).toFixed(2)) + "%",
day10:
res.day10 == "0"
? ""
: parseFloat((res.day10 * 100).toFixed(2)) + "%",
day11:
res.day11 == "0"
? ""
: parseFloat((res.day11 * 100).toFixed(2)) + "%",
day12:
res.day12 == "0"
? ""
: parseFloat((res.day12 * 100).toFixed(2)) + "%",
day13:
res.day13 == "0"
? ""
: parseFloat((res.day13 * 100).toFixed(2)) + "%",
day14:
res.day14 == "0"
? ""
: parseFloat((res.day14 * 100).toFixed(2)) + "%",
day15:
res.day15 == "0"
? ""
: parseFloat((res.day15 * 100).toFixed(2)) + "%",
day16:
res.day16 == "0"
? ""
: parseFloat((res.day16 * 100).toFixed(2)) + "%",
day17:
res.day17 == "0"
? ""
: parseFloat((res.day17 * 100).toFixed(2)) + "%",
day18:
res.day18 == "0"
? ""
: parseFloat((res.day18 * 100).toFixed(2)) + "%",
day19:
res.day19 == "0"
? ""
: parseFloat((res.day19 * 100).toFixed(2)) + "%",
day20:
res.day20 == "0"
? ""
: parseFloat((res.day20 * 100).toFixed(2)) + "%",
day21:
res.day21 == "0"
? ""
: parseFloat((res.day21 * 100).toFixed(2)) + "%",
day22:
res.day22 == "0"
? ""
: parseFloat((res.day22 * 100).toFixed(2)) + "%",
day23:
res.day23 == "0"
? ""
: parseFloat((res.day23 * 100).toFixed(2)) + "%",
day24:
res.day24 == "0"
? ""
: parseFloat((res.day24 * 100).toFixed(2)) + "%",
day25:
res.day25 == "0"
? ""
: parseFloat((res.day25 * 100).toFixed(2)) + "%",
day26:
res.day26 == "0"
? ""
: parseFloat((res.day26 * 100).toFixed(2)) + "%",
day27:
res.day27 == "0"
? ""
: parseFloat((res.day27 * 100).toFixed(2)) + "%",
day28:
res.day28 == "0"
? ""
: parseFloat((res.day28 * 100).toFixed(2)) + "%",
day29:
res.day29 == "0"
? ""
: parseFloat((res.day29 * 100).toFixed(2)) + "%",
day30:
res.day30 == "0"
? ""
: parseFloat((res.day30 * 100).toFixed(2)) + "%",
day31:
res.day31 == "0"
? ""
: parseFloat((res.day31 * 100).toFixed(2)) + "%",
}); });
}); });
this.total = response.total; this.total = response.total;

View File

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