班级考勤部分代码

This commit is contained in:
sk1551
2020-09-23 18:41:19 +08:00
parent 08588a7324
commit b2811387f8
8 changed files with 751 additions and 409 deletions

View File

@ -2,69 +2,69 @@ import request from '@/utils/request'
// 查询班级信息列表
export function listClass(query) {
return request({
url: '/system/class/list',
method: 'get',
params: query
})
return request({
url: '/system/class/list',
method: 'get',
params: query
})
}
// 查询班级信息详细
export function getClass(bjbh) {
return request({
url: '/system/class/' + bjbh,
method: 'get'
})
return request({
url: '/system/class/' + bjbh,
method: 'get'
})
}
// 新增班级信息
export function addClass(data) {
return request({
url: '/system/class',
method: 'post',
data: data
})
return request({
url: '/system/class',
method: 'post',
data: data
})
}
// 修改班级信息
export function updateClass(data) {
return request({
url: '/system/class',
method: 'put',
data: data
})
return request({
url: '/system/class',
method: 'put',
data: data
})
}
// 删除班级信息
export function delClass(bjbh) {
return request({
url: '/system/class/' + bjbh,
method: 'delete'
})
return request({
url: '/system/class/' + bjbh,
method: 'delete'
})
}
// 清空班级教师信息
export function delJsClass(bjbh) {
return request({
url: '/system/class/deljs/' + bjbh,
method: 'delete'
})
return request({
url: '/system/class/deljs/' + bjbh,
method: 'delete'
})
}
// 导出班级信息
export function exportClass(query) {
return request({
url: '/system/class/export',
method: 'get',
params: query
})
return request({
url: '/system/class/export',
method: 'get',
params: query
})
}
// 查询班级信息列表
export function listClassCheck(query) {
return request({
url: '/system/class/checklist',
method: 'get',
params: query
})
return request({
url: '/system/class/checklist',
method: 'get',
params: query
})
}

View File

@ -1,174 +1,105 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
<el-form-item label="班级编码" prop="classid">
<el-select v-model="queryParams.classid" placeholder="请选择班级">
<el-option
v-for="dict in classOptions"
:key="dict.bjbh"
:label="dict.bjmc"
:value="dict.bjbh"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="幼儿姓名" prop="childname">
<el-input
v-model="queryParams.childname"
placeholder="请输入幼儿姓名"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="出勤类型" prop="type">
<el-select v-model="queryParams.type" placeholder="请选择出勤类型" clearable size="small">
<el-option
v-for="dict in checkinOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item label="考勤时间" prop="createTime">
<el-date-picker
clearable
size="small"
style="width: 200px"
v-model="queryParams.createTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择考勤时间"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['benyi:checkindetail:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['benyi:checkindetail:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['benyi:checkindetail:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['benyi:checkindetail:export']"
>导出</el-button>
</el-col>
</el-row>
<el-table v-loading="loading" :data="detailList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" :selectable="checkSelectable" />
<el-table-column label="编号" align="center" prop="id" />
<!-- <el-table-column label="学校编码" align="center" prop="schoolid" /> -->
<el-table-column label="班级编码" align="center" prop="classid" :formatter="classFormat" />
<!-- <el-table-column label="幼儿编码" align="center" prop="childid" /> -->
<el-table-column label="幼儿姓名" align="center" prop="childname" />
<el-table-column label="出勤类型" align="center" prop="type" :formatter="typeFormat" />
<el-table-column label="考勤时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="创建人" align="center" prop="createuserid" /> -->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['benyi:checkindetail:edit']"
:disabled="!checkSelectable(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['benyi:checkindetail:remove']"
:disabled="!checkSelectable(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改幼儿考勤对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="选择幼儿" prop="childname">
<el-checkbox
:indeterminate="isIndeterminate"
v-model="checkAll"
@change="handleCheckAllChange"
:disabled="isable"
>全选</el-checkbox>
<div style="margin: 15px 0;"></div>
<el-checkbox-group v-model="checkedChilds" @change="handlecheckedChildsChange">
<el-checkbox
v-for="child in childs"
:label="child.id"
:key="child.id"
:disabled="isable"
>{{child.name}}</el-checkbox>
</el-checkbox-group>
<el-input v-model="form.childname" v-if="false" />
</el-form-item>
<el-form-item label="出勤类型" prop="type">
<el-select v-model="form.type" placeholder="请选择出勤类型">
<el-option
v-for="dict in checkinOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
<div class="table-container" ref="printMe">
<h2 class="title">{{title}}</h2>
<div class="table">
<div class="print no-print">
<el-button type="primary" plain size="mini" icon="el-icon-printer" @click="prints"></el-button>
</div>
</el-dialog>
<table>
<tr class="align-center">
<!-- <td v-for="h in headerData" :key="h.title">
<b class="table-title">{{h.title}}</b>
{{h.name}}
</td>-->
<td class="w140">
<b class="table-title">班级</b>
{{classid}}
</td>
<td>
<b class="table-title">班级人数</b>
{{30}}
</td>
<td>
<b class="table-title">月份</b>
{{9}}
</td>
<td>
<b class="table-title">学期</b>
{{1}}学期
</td>
<td>
<b class="table-title">学年</b>
{{2020}}
</td>
<td>
<b class="table-title">班主任</b>
{{month}}
</td>
<td>
<b class="table-title">本月出勤率</b>
{{month}}%
</td>
<td colspan="3">
<b class="table-title">本月出勤率</b>
{{month}}%
</td>
</tr>
<tr class="align-center">
<td rowspan="5">
<span>周教学目标</span>
</td>
<td style="width: 140px;">社会</td>
<td>{{sh}}</td>
<td colspan="4"></td>
</tr>
<tr class="align-center">
<td>语言</td>
<td>{{yy}}</td>
<td colspan="4"></td>
</tr>
<tr class="align-center">
<td>健康</td>
<td>{{jk}}</td>
<td colspan="4"></td>
</tr>
<tr class="align-center">
<td>科学</td>
<td>{{kx}}</td>
<td colspan="4"></td>
</tr>
<tr class="align-center">
<td>艺术</td>
<td>{{ys}}</td>
<td colspan="4"></td>
</tr>
<tr v-for="item in planweekitemList" :key="item.id">
<td v-if="item.activitytime" :rowspan="bodyData.planweekitemList.length" class="align-center">
<span>{{item.activitytime}}</span>
</td>
<td class="align-center">{{item.activitytime}}</td>
<td colspan="4">{{item.activitytime}}</td>
</tr>
<tr class="align-center table-bg">
<td v-for="h in bodyData.title" :key="h.prop">
<b>{{h.label}}</b>
</td>
</tr>
<tr v-for="item in bodyData.planweekitemList" :key="item.id">
<td v-if="item.theme" :rowspan="bodyData.planweekitemList.length" class="align-center">
<span>{{item.theme}}</span>
</td>
<td class="align-center">{{item.activitytime}}</td>
<td class="align-center">{{item.day}}</td>
<td class="align-center">{{activitytypeFormat(item.activitytype)}}</td>
<td class="align-center">{{(item.content)}}</td>
</tr>
</table>
<!-- <p
class="warning"
>此周计划表不需要发给家长只需上报教学主管制定班级一周教学与活动计划表请使用班级管理模块中教学与游戏活动周计划表以上报教学主管和作为周计划通知发给家长</p>-->
</div>
</div>
</template>
@ -190,31 +121,49 @@ export default {
name: "Detail",
data() {
return {
isable: false,
checkAll: false,
checkedChilds: [],
childs: [],
isIndeterminate: false,
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 总条数
total: 0,
// 幼儿考勤表格数据
detailList: [],
//字典
checkinOptions: [],
//班级
classOptions: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
tableData: [],
title: "教学与游戏活动周计划表",
schoolid: "",
classid: "",
childid: "",
childname: "",
type: "",
createuserid: "",
month: "",
bodyData: {
title: [
{
label: "日期",
prop: "activitytime",
},
{
label: "星期",
prop: "day",
},
{
label: "区域活动形式",
prop: "activitytype",
},
{
label: "活动详情",
prop: "content",
},
// {
// label: "周四",
// prop: "help",
// },
// {
// label: "周五",
// prop: "help",
// },
],
planweekitemList: [
{
theme: "春天的颜色",
},
],
},
// 查询参数
queryParams: {
pageNum: 1,
@ -227,19 +176,6 @@ export default {
createuserid: undefined,
createTime: undefined
},
// 表单参数
form: {},
// 表单校验
rules: {
childname: [
{
required: true,
message: "请至少选择一个幼儿",
trigger: "blur"
}
],
type: [{ required: true, message: "出勤类型不能为空", trigger: "blur" }]
}
};
},
created() {
@ -293,171 +229,75 @@ export default {
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
prints() {
//console.log(this.$refs.printMe);
this.$print(this.$refs.printMe);
},
// 表单重置
reset() {
this.form = {
id: undefined,
schoolid: undefined,
classid: undefined,
childid: undefined,
childname: undefined,
type: undefined,
createuserid: undefined,
createTime: undefined
};
this.resetForm("form");
this.checkedChilds = [];
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id);
this.single = selection.length != 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.isable = false;
this.open = true;
this.title = "幼儿考勤";
listByCheck(null).then(response => {
this.childs = response.rows;
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.isable = true;
const id = row.id || this.ids;
getDetail(id).then(response => {
this.form = response.data;
listChild(null).then(response => {
this.childs = response.rows;
});
this.checkedChilds.push(response.data.childid);
this.open = true;
this.title = "修改幼儿考勤";
});
},
/** 提交按钮 */
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.childname == "") {
this.msgError("请至少选择一个幼儿");
return;
}
if (valid) {
if (this.form.id != undefined) {
updateDetail(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("修改考勤成功");
this.open = false;
this.getList();
}
});
} else {
//提交
addDetail(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("添加考勤成功");
this.open = false;
this.getList();
}
});
}
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm(
'是否确认删除幼儿考勤编号为"' + ids + '"的数据项?',
"警告",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}
)
.then(function() {
return delDetail(ids);
})
.then(() => {
this.getList();
this.msgSuccess("删除成功");
})
.catch(function() {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm("是否确认导出所有幼儿考勤数据项?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(function() {
return exportDetail(queryParams);
})
.then(response => {
this.download(response.msg);
})
.catch(function() {});
},
handleCheckAllChange(val) {
// this.checkedChilds = val ? this.childs : [];
// this.isIndeterminate = false;
this.checkedChilds = [];
this.childs.forEach(item => {
//当全选被选中的时候,循环遍历源数据,把数据的每一项加入到默认选中的数组去
this.checkedChilds.push(item.id);
});
this.checkedChilds = val ? this.checkedChilds : []; //三元表达式如果val的值为true那么就把当前默认选中的值赋值给自身这样页面页面上所有的元素就都选中了。如果为false就是取消全选
this.isIndeterminate = false; //官网说这是个样式控制,是来控制,什么时候半选的,要不要都无所谓,看你需求
//console.log(this.checkedChilds);
var cids = "";
this.checkedChilds.forEach(item => {
//当全选被选中的时候,循环遍历源数据,把数据的每一项加入到默认选中的数组去
cids = cids + item + ",";
});
console.log(cids);
this.form.childname = cids;
},
handlecheckedChildsChange(value) {
let checkedCount = value.length;
this.checkAll = checkedCount === this.childs.length;
this.isIndeterminate =
checkedCount > 0 && checkedCount < this.childs.length;
//console.log(this.checkedChilds);
var cids = "";
this.checkedChilds.forEach(item => {
//当全选被选中的时候,循环遍历源数据,把数据的每一项加入到默认选中的数组去
cids = cids + item + ",";
});
console.log(cids);
this.form.childname = cids;
}
}
};
</script>
</script>
<style lang="scss">
.table-container {
padding: 30px 10%;
.w140 {
width: 140px;
}
.w200 {
width: 200px;
}
.title {
margin: 0;
font-size: 18px;
text-align: center;
padding: 15px 0;
}
.align-center {
text-align: center;
}
.table {
font-size: 14px;
.print {
display: flex;
justify-content: flex-end;
padding-bottom: 10px;
}
p {
margin: 0;
}
table {
width: 100%;
border-collapse: collapse;
}
table td {
border: #ccc solid 1px;
line-height: 24px;
padding: 8px 5px;
}
.table-title {
font-size: 16px;
}
.table-bg {
background: #f8f8f8;
}
}
.warning {
padding-top: 20px;
font-size: 12px;
color: #666;
}
}
@media print {
.table-container {
padding: 30px 0;
}
.print {
opacity: 0;
}
}
/*去除页眉页脚*/
@page {
size: auto; /* auto is the initial value */
margin: 3mm; /* this affects the margin in the printer settings */
}
</style>