班级考勤统计优化

This commit is contained in:
paidaxing444 2020-09-27 16:35:19 +08:00
parent 8e1658187f
commit 37d282b949

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,27 +19,48 @@
></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;">儿童考勤表</h2> <h2 style="text-align: center">儿童考勤表</h2>
<h4 style="text-align: left"> <h4 style="text-align: left">
班级名称{{ this.bjmc }}------ 班级名称{{ this.bjmc }} ------ 考勤月份{{ this.month }} ------
考勤月份{{ this.month }}------ 在册人数{{ this.childcount }} ------ 班长姓名{{ this.jsmc }}
在册人数{{ this.childcount }} ------
班长姓名{{ this.jsmc }} ------
</h4> </h4>
<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>
@ -42,7 +68,7 @@
</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"
@ -106,8 +132,8 @@ export default {
], ],
// //
queryParams: { queryParams: {
month: "" month: "",
} },
}; };
}, },
created() { created() {
@ -128,17 +154,16 @@ export default {
if (this.queryParams.month == "") { if (this.queryParams.month == "") {
this.queryParams.month = this.month; this.queryParams.month = this.month;
} }
await listDatetime(this.queryParams).then(response => { await listDatetime(this.queryParams).then((response) => {
console.log(response.rows); console.log(response.rows);
this.tableHead.push({ this.tableHead.push({
column_name: "name", column_name: "name",
sort: "姓名" sort: "姓名",
}); });
response.rows.forEach(res => { response.rows.forEach((res) => {
this.tableHead.push({ this.tableHead.push({
column_name: "", column_name: "",
sort: res.sort sort: res.sort,
}); });
}); });
}); });
@ -150,9 +175,9 @@ export default {
if (this.queryParams.month == "") { if (this.queryParams.month == "") {
this.queryParams.month = this.month; this.queryParams.month = this.month;
} }
listChildCheck(this.queryParams).then(response => { listChildCheck(this.queryParams).then((response) => {
console.log(response.rows); console.log(response.rows);
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;
@ -175,6 +200,6 @@ export default {
//console.log(this.$refs.printMe); //console.log(this.$refs.printMe);
this.$print(this.$refs.printMe); this.$print(this.$refs.printMe);
}, },
} },
}; };
</script> </script>