Files
h5/src/views/StudentSafetyAttendance/AttendanceForm/index.vue
T

147 lines
3.7 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div>
<!-- 搜索 -->
<div class="form-adapt-container">
<el-card shadow="hover">
<CommonHead
@search-data="searchForm"
@reset-data="reset"
@newly-data="add"
></CommonHead>
<!-- newly-data删除所选事件 -->
<!-- reset-data重置表单内容 -->
<!-- search-data搜索事件接收被搜索的内容 -->
<el-form size="mini" label-width="100px" class="mt35 mb35">
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4" class="mb20">
<el-form-item label="日期范围选择">
<el-date-picker
v-model="dateRange"
type="daterange"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
>
</el-date-picker>
</el-form-item>
</el-col>
</el-form>
</el-card>
<CommonTablesImg
v-loading="loading"
:delete-func="deleteData"
:edit-func="editData"
:columns="columns"
:data="attendanceData"
></CommonTablesImg>
<Pagination
:total="total"
:pageNum="query.pageNum"
:pageSize="query.pageSize"
@clickCurrent="onClickCurrent"
@clickSize="onClickSize"
/>
</div>
</div>
</template>
<script>
import columns from "./columns";
import { rqObtainingSafetyAttendanceTeachers } from "../api";
export default {
data() {
return {
form: {
userName: null, // 用户名
contactInformation: null, //联系方式
},
columns,
query: {
pageNum: 1,
pageSize: 10,
},
dateRange: ["", ""],
total: 0, // 总页数,
// 考勤表单数据
attendanceData: [],
loading: false,
};
},
created() {
this.getAttendanceFormData();
},
methods: {
// 添加
add() {
this.$message("考勤数据无法添加");
},
// 重置按钮
reset() {
this.bus.$emit("onCurrentContextmenuClick", {
id: 0,
path: this.$route.path,
});
},
// 删除
deleteData(id) {
this.$message("考勤数据暂时无法删除");
},
// 编辑
editData(item) {
this.$message("考勤数据暂时无法被编辑");
},
// 点击切换页数
onClickCurrent(val) {
this.query.pageNum = val;
this.getAttendanceFormData();
},
// 点击了每页页数
onClickSize(val) {
this.query.pageSize = val;
this.getAttendanceFormData();
},
// 搜索按钮
searchForm() {
this.getAttendanceFormData();
},
// 获取表单数据
async getAttendanceFormData() {
try {
this.loading = true;
let result = await rqObtainingSafetyAttendanceTeachers(
this.query.pageNum,
this.query.pageSize,
this.dateRange[0],
this.dateRange[1]
);
// this.attendanceData = result.records;
this.attendanceData = result.records.map(item =>{
item.pictureUrl = 'data:image/' + item.imgType + ';base64,'+item.faceImg // 将base64图片添加前缀处理
return item
})
this.loading = false;
this.total = result.total;
// if (result.code == 200) {
// this.loading = false;
// this.attendanceData = result.data.records;
// this.total = result.data.total;
// } else {
// this.loading = false;
// this.$message.error("网络错误");
// }
} catch (error) {
this.loading = false;
this.$message.error("网络错误");
}
},
},
};
</script>
<style lang="scss" scoped></style>