初始化

This commit is contained in:
hezhidong
2024-01-30 09:30:56 +08:00
parent a38cfb023d
commit ff582f261b
213 changed files with 37514 additions and 4 deletions
@@ -0,0 +1,29 @@
export default [
{
label: "id",
prop: "id",
type: "text",
},
{
label: "姓名",
prop: "username",
type: "text",
},
{
label: "进出类型",
prop: "deviceLabel",
type: "text",
},
{
label: "图像",
prop: "pictureUrl",
type: "image",
},
{
label: "时间",
prop: "createTime",
type: "text",
},
]
@@ -0,0 +1,137 @@
<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="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd HH:mm:ss"
>
</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 {
name: "AttendanceForm",
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]
);
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>
@@ -0,0 +1,18 @@
export default [
{
label: "deptId",
prop: "deptId",
type: "text",
},
{
label: "ruleIds",
prop: "ruleIds",
type: "text",
},
{
label: "校区/学段/年级/班级",
prop: "name",
type: "text",
},
]
@@ -0,0 +1,114 @@
<template>
<el-table
border
:header-cell-style="{
background: '#f5f7fa',
}"
:data="tableData"
style="width: 100%; margin-top: 20px"
height="650"
size="mini"
>
<el-table-column
v-if="column.label !== 'deptId' && column.label !== 'ruleIds'"
v-for="(column, index) in tableColumns"
:key="index"
:prop="column.prop"
:label="column.label"
width="auto"
>
<template slot-scope="scope">
<span> {{ scope.row[column.prop] }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="280">
<template slot-scope="scope">
<el-button
@click="handleRegistered(scope.row)"
class="el-icon-view"
type="text"
size="small"
>考勤规则</el-button
>
<el-popconfirm @confirm="handleDelete(scope.row)" :title="'确定要删除吗?'">
<el-button
slot="reference"
style="margin-left: 10px; color: red"
class="el-icon-delete"
type="text"
size="small"
>删除</el-button
>
</el-popconfirm>
</template>
</el-table-column>
</el-table>
</template>
<script>
export default {
name: "CommonTablesImg",
props: {
columns: {
type: Array,
required: true,
},
data: {
type: Array,
required: true,
},
deleteFunc: {
type: Function,
default: () => {},
},
editFunc: {
type: Function,
default: () => {},
},
registeredFunc: {
type: Function,
default: () => {},
},
},
name: "CommonTables",
data() {
return {};
},
methods: {
// 删除事件
handleDelete(row) {
this.deleteFunc(row.id);
},
handleRegistered(row) {
this.registeredFunc(row);
},
},
computed: {
tableColumns() {
// 处理传进来的列配置,返回符合 Element UI 表格要求的配置
return this.columns.map((column) => {
return {
label: column.label,
prop: column.prop,
type: column.type,
};
});
},
tableData() {
// 处理传进来的数据,返回符合 Element UI 表格要求的数据
return this.data.map((rowData) => {
let row = {};
for (let column of this.columns) {
row[column.prop] = rowData[column.prop];
}
return row;
});
},
},
};
</script>
<style lang="scss" scoped></style>
@@ -0,0 +1,470 @@
<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-select
v-model="form.campusDid"
placeholder="请选择校区查询学段"
filterable
clearable
class="w100"
>
<el-option
v-for="(item, index) in formCampusData"
:key="index"
@click.native="select(item)"
:label="item.name"
:value="item.deptId"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4" class="mb20">
<el-form-item label="查询年级">
<el-select
v-model="form.academicStageDid"
placeholder="请选择学段查询年级"
filterable
clearable
class="w100"
>
<el-option
v-for="(item, index) in fromStageData"
:key="index"
@click.native="selectStage(item)"
:label="item.name"
:value="item.deptId"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4" class="mb20">
<el-form-item label="查询班级">
<el-select
v-model="form.GradeDid"
placeholder="请选择年级查询班级"
filterable
clearable
class="w100"
>
<el-option
v-for="(item, index) in fromGradeData"
:key="index"
@click.native="selectGrade(item)"
:label="item.name"
:value="item.deptId"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-form>
</el-card>
<InterestClassTabes
v-loading="loading"
:delete-func="deleteData"
:columns="columns"
:data="campusData"
:registered-func="check"
></InterestClassTabes>
<Pagination
:total="total"
:pageNum="query.pageNum"
:pageSize="query.pageSize"
@clickCurrent="onClickCurrent"
@clickSize="onClickSize"
/>
<!-- 对话框 -->
<el-dialog
title="考勤规则"
:visible.sync="dialogVisible"
width="35%"
:before-close="handleClose"
>
<el-form label-position="right" label-width="150px">
<el-button
@click="addATimePeriod"
type="primary"
size="mini"
icon="el-icon-plus"
>添加规则</el-button
>
<el-form-item label="请输入到校时间">
<el-time-picker
value-format="HH:mm:ss"
size="mini"
arrow-control
v-model="stit.startTime"
placeholder="请输入到校时间"
>
</el-time-picker>
</el-form-item>
<el-form-item
v-if="rulesList.length > 0"
label="请选择时间范围"
v-for="(ionc, index) in rulesList"
:key="index"
>
<el-time-picker
value-format="HH:mm:ss"
size="mini"
arrow-control
v-model="rulesList[index].startTime"
placeholder="起始时间"
>
</el-time-picker>
<el-time-picker
value-format="HH:mm:ss"
size="mini"
arrow-control
v-model="rulesList[index].endTime"
placeholder="结束时间"
>
</el-time-picker>
<el-button
style="margin-left: 10px"
@click="deleteRule(ionc)"
type="danger"
icon="el-icon-delete"
circle
></el-button>
<div>
<el-checkbox v-model="rulesList[index].checkedEnter">进校</el-checkbox>
<el-checkbox v-model="rulesList[index].checkedExit">出校</el-checkbox>
</div>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false" size="mini">取 消</el-button>
<el-button type="primary" size="mini" @click="confirmSettingRules"
>确 定</el-button
>
</span>
</el-dialog>
</div>
</div>
</template>
<script>
import columns from "./columns";
import {
rqAttendanceRuleData,
rqSetOrModifyAttendanceRules,
rqviewRuleDetails,
} from "../api";
import InterestClassTabes from "./components/InterestClassTabes";
export default {
name: "roleManagement",
data() {
return {
checkList: [
{ id: 1, value: false, label: "进校" },
{ id: 2, value: false, label: "出校" },
],
form: {
campusDid: "",
academicStageDid: "",
GradeDid: "",
},
//下拉框校区数据
formCampusData: [],
//下拉框学段数据
fromStageData: [],
//下拉框年级数据
fromGradeData: [],
columns,
query: {
pageNum: 1,
pageSize: 10,
},
// 规则列表
loading: false,
total: 0, // 总页数,
campusData: [], //校区数据,
dialogVisible: false,
modifyRuleData: {
// 部门id
deptId: null,
rules: [],
},
rulesList: [],
// 第一个绑定的值到校时间
stit: { startTime: "", endTime: "", flag: 4 },
};
},
components: {
InterestClassTabes,
},
created() {
this.getCampusRuleData();
},
methods: {
// 删除
deleteData(id) {
this.$message("删除组织请联系组织管理员");
},
// 点击切换页数
onClickCurrent(pageNum) {
console.log("点击切换页数" + pageNum);
this.query.pageNum = pageNum;
},
// 点击了每页页数
onClickSize(pageSize) {
this.pageSize = pageSize;
this.query.pageSize = pageSize;
console.log(pageSize);
},
// 获取校区规则数据
async getCampusRuleData() {
try {
this.loading = true;
let result = await rqAttendanceRuleData(0);
if (result.code == 200) {
this.loading = false;
this.campusData = result.data;
this.formCampusData = result.data;
} else {
this.loading = false;
this.$message.error("网络错误");
}
} catch (error) {
this.loading = false;
this.$message.error("网络错误");
}
},
// 根据校区depId查学段
async select(val) {
try {
this.loading = true;
let dpId = val.deptId;
let result = await rqAttendanceRuleData(dpId);
if (result.code == 200) {
this.loading = false;
this.campusData = result.data;
this.fromStageData = result.data;
} else {
this.loading = false;
this.$message.error("网络错误");
}
} catch (error) {
this.loading = false;
this.$message.error("网络错误");
}
},
// 根据学段depId查年级
async selectStage(val) {
try {
this.loading = true;
let dpId = val.deptId;
let result = await rqAttendanceRuleData(dpId);
if (result.code == 200) {
this.campusData = result.data;
this.fromGradeData = result.data;
this.loading = false;
} else {
this.loading = false;
this.$message.error("网络错误");
}
} catch (error) {
this.loading = false;
this.$message.error("网络错误");
}
},
// 根据年级查班级
async selectGrade(val) {
try {
this.loading = true;
let dpId = val.deptId;
let result = await rqAttendanceRuleData(dpId);
if (result.code == 200) {
this.campusData = result.data;
this.loading = false;
} else {
this.loading = false;
this.$message.error("网络错误");
}
} catch (error) {
this.loading = false;
this.$message.error("网络错误");
}
},
// 搜索按钮
searchForm() {
this.$message("请选择下拉框搜索");
},
// 重置按钮
reset() {
this.bus.$emit("onCurrentContextmenuClick", {
id: 0,
path: this.$route.path,
});
},
// 添加
add() {
this.$message("新增组织请联系组织管理员");
},
// 查看
async check(item) {
let { deptId, ruleIds } = item;
console.log(item);
this.rulesList = [];
this.dialogVisible = true;
this.modifyRuleData.rules = [];
(this.stit = { startTime: "", endTime: "", flag: 4 }),
(this.modifyRuleData.deptId = deptId);
console.log(item);
const FlagEnum = {
// 进
INTO: 0,
// 出
OUT: 1,
// 到校时间
MORNING: 2,
};
console.log(ruleIds);
this.dialogVisible = true;
try {
let result = await rqviewRuleDetails(ruleIds);
if (result.code == 200) {
let dataRes = result.data;
dataRes.forEach((itmese, index) => {
itmese.checkedEnter = "";
itmese.checkedExit = "";
// 进
let enter = this.decryption(FlagEnum.INTO, itmese.flag);
let Exit = this.decryption(FlagEnum.OUT, itmese.flag);
console.log(enter);
console.log(Exit);
console.log(itmese);
itmese.checkedEnter = enter;
itmese.checkedExit = Exit;
// console.log(itmese);
});
dataRes.forEach((itmese, index) => {
if (itmese.flag == 4) {
this.stit.startTime = itmese.startTime;
if (itmese.id) {
this.stit.id = itmese.id;
}
result.data.splice(index, 1);
}
});
console.log(dataRes);
this.rulesList = dataRes;
}
} catch (error) {
this.$message.error("网络错误");
}
},
handleClose(done) {
this.$confirm("确认关闭?")
.then((_) => {
done();
})
.catch((_) => {});
},
// 确定设置规则
async confirmSettingRules() {
if (this.stit.startTime) {
const FlagEnum = {
// 进
INTO: 0,
// 出
OUT: 1,
// 到校时间
MORNING: 2,
};
this.rulesList.forEach((item, index) => {
let res = this.encryption(FlagEnum.INTO, item.checkedEnter, item.flag);
let result = this.encryption(FlagEnum.OUT, item.checkedExit, res);
item.flag = result;
delete item.checkedEnter;
delete item.checkedExit;
delete item.faId;
});
this.dialogVisible = false;
this.rulesList.unshift(this.stit);
this.modifyRuleData.rules = this.rulesList;
console.log(this.modifyRuleData);
try {
let res = await rqSetOrModifyAttendanceRules(this.modifyRuleData);
console.log(res);
if (res.code == 200) {
this.$message.success("设置成功");
this.getCampusRuleData();
} else {
this.$message.error("网络错误");
}
} catch (error) {
this.$message.error("网络错误");
}
} else {
this.$message.warning("请设置到校时间");
}
},
// 添加一个时间段
addATimePeriod() {
let it = {
startTime: "",
endTime: "",
flag: 0,
checkedEnter: false,
checkedExit: false,
};
let num = Math.floor(Math.random() * 1000);
it.faId = num;
this.rulesList.push(it);
},
// 删除一个时间段
deleteRule(items) {
console.log(items);
let myArray = this.rulesList.filter(function (item) {
return item.faId !== items.faId;
});
this.rulesList = myArray;
},
//加密
encryption(flagEnum, bool, flag) {
let bitValue = 1 << flagEnum;
flag = bool ? flag | bitValue : flag & ~bitValue;
return flag;
},
// 解密
decryption(flagEnum, flag) {
let bitValue = 1 << flagEnum;
return (flag & bitValue) == bitValue;
},
},
};
</script>
<style lang="scss" scoped></style>
+27
View File
@@ -0,0 +1,27 @@
import request from '@/utils/request';
// 获取当前用户老师可查看的考勤表单
export const rqObtainingSafetyAttendanceTeachers = (current,size,startTime,endTime) => request({
url: `/attendance/equipment/entranceLog/all?current=${current}&size=${size}&startTime=${startTime}&endTime=${endTime}`,
method: 'get',
})
// 获取考勤规则数据
export const rqAttendanceRuleData = (superId) => request({
url: `/user-dept/user/dept/${superId}`,
method: 'get',
})
// 设置或修改考勤规则
export const rqSetOrModifyAttendanceRules = (data) => request({
url: `/user-dept/user/rule`,
method: 'post',
data
})
// 使用id查询规则详情
export const rqviewRuleDetails= (id) => request({
url: `/user-dept/user/rule?ids=${id}`,
method: 'get',
})