Bläddra i källkod

考勤点名模块

master
yxq 4 månader sedan
förälder
incheckning
c51584129e
6 ändrade filer med 202 tillägg och 170 borttagningar
  1. +18
    -19
      SafeCampus.WEB/src/api/modules/attendance/attendanceApi.ts
  2. +1
    -2
      SafeCampus.WEB/src/api/modules/attendance/index.ts
  3. +1
    -1
      SafeCampus.WEB/src/components/TreeFilter/index.vue
  4. +9
    -1
      SafeCampus.WEB/src/views/attendance/passenger/components/detailTable/index.vue
  5. +56
    -100
      SafeCampus.WEB/src/views/attendance/studentsReturn/components/returnConfirm/index.vue
  6. +117
    -47
      SafeCampus.WEB/src/views/attendance/studentsReturn/index.vue

SafeCampus.WEB/src/api/modules/attendance/studentsReturn.ts → SafeCampus.WEB/src/api/modules/attendance/attendanceApi.ts Visa fil

@@ -1,5 +1,5 @@
/**
* @description 学生归寝
* @description 考勤事件管理
* @license Apache License Version 2.0
* @Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
* @remarks
@@ -13,31 +13,30 @@
* @see https://gitee.com/dotnetmoyu/SimpleAdmin
*/
import { moduleRequest } from "@/api/request";
import { ReqId, SysUserPersonnel } from "@/api/interface";
const http = moduleRequest("/business/dfieldApi/");
const http = moduleRequest("/business/attendanceApi/");

/**
* @Description: 单页管理
* @Author: SYY
* @Author: yxq
* @Date: 2023-12-15 15:34:54
*/
const attendanceStudentsReturn = {
/** 查询底库列表 */
page(params: SysUserPersonnel.ClassPage) {
return http.get("test", params);
const attendanceApi = {
/** 查询考勤记录列表 */
page(params: any) {
return http.get("getPageList", params);
},
/** 删除底库 */
delete(params: ReqId) {
return http.delete("test", params);
/** 查询所有列表 */
list(params: any) {
return http.get("getNoPageList", params);
},
/** 创建底库 */
add(params: SysUserPersonnel.ClassPage) {
return http.post("test", params);
/** 添加考勤记录 */
add(params: any) {
return http.post("add", params);
},
/** 根据楼栋查询出入记录 */
pageByBuild(params: any) {
return http.get("getPageListByBuild", params);
},
/** 更新底库 */
update(params: SysUserPersonnel.ClassPage) {
return http.put("test", params);
}
};

export { attendanceStudentsReturn };
export { attendanceApi };

+ 1
- 2
SafeCampus.WEB/src/api/modules/attendance/index.ts Visa fil

@@ -15,5 +15,4 @@
export * from "./behaviorTrace";
export * from "./passenger";
export * from "./roolcall";
export * from "./studentsReturn";

export * from "./attendanceApi";

+ 1
- 1
SafeCampus.WEB/src/components/TreeFilter/index.vue Visa fil

@@ -86,8 +86,8 @@ const setSelected = () => {
};

onBeforeMount(async () => {
setSelected();
await getRequestData();
setSelected();
});

// 使用 nextTick 防止打包后赋值不生效,开发环境是正常的


+ 9
- 1
SafeCampus.WEB/src/views/attendance/passenger/components/detailTable/index.vue Visa fil

@@ -6,7 +6,15 @@
<template>
<div>
<form-container v-model="visible" :title="`分片详情`" form-size="800px" @close="onClose">
<ProTable ref="proTable" title="分片详情" height="500px" :data="tableData" :columns="columns"></ProTable>
<ProTable
:toolButton="false"
:pagination="false"
ref="proTable"
title="分片详情"
height="500px"
:data="tableData"
:columns="columns"
></ProTable>
<template #footer>
<el-button @click="onClose"> 关闭 </el-button>
</template>


+ 56
- 100
SafeCampus.WEB/src/views/attendance/studentsReturn/components/returnConfirm/index.vue Visa fil

@@ -1,21 +1,30 @@
<!--
* @Description: 人脸识别失败表格
* @Description: 未归寝
* @Author: yxq
* @Date: 2023-12-15 15:45:59
-->
<template>
<div>
<form-container v-model="visible" row-key="id" :title="`${propsInfo.record.qinshibianhao}归寝确认`" form-size="800px" @close="onClose">
<ProTable ref="noFaceTableRef" title="归寝确认" height="500px" :data="tableData" :columns="columns">
<form-container v-model="visible" row-key="id" :title="`寝室${propsInfo.record.name}归寝确认`" form-size="800px" @close="onClose">
<ProTable
ref="noReturnTableRef"
:request-auto="false"
title="归寝确认"
height="500px"
:pagination="false"
:columns="columns"
:request-api="userManageDormitoryApi.returnDetail"
:data-callback="dataCallback"
>
<!-- 表格 header 按钮 -->
<template #tableHeader="scope">
<s-button
type="primary"
:disabled="!scope.isSelected"
icon="check"
prefix="人工"
suffix="确认"
@click="personConfirm(scope.selectedListIds, '确认已归寝')"
prefix="确认"
suffix="归寝"
@click="personConfirm(scope.selectedList, '确认已归寝')"
/>
</template>
</ProTable>
@@ -26,118 +35,39 @@
<!-- 预览头像 -->
<el-dialog v-model="imgVisible" title="查看头像" width="830px">
<div style="display: flex; align-items: center; justify-content: center">
<img class="detailpic" :src="faceUrl" alt="" />
<img class="detailpic" :src="'/api/' + faceUrl" alt="" />
</div>
</el-dialog>
</div>
</template>
<script setup lang="tsx" name="attendanceStudentsReturn">
import { AttendanceStudentsReturn, attendanceStudentsReturn } from "@/api";
import { ColumnProps, noFaceTableInstance } from "@/components/noFaceTableRef/interface";
import { userManageDormitoryApi,attendanceApi } from "@/api";
import { ColumnProps,ProTableInstance } from "@/components/ProTable/interface";
import { FormOptEnum } from "@/enums";
import { useHandleData } from "@/hooks";
import { formatDate } from "@/utils";

const visible = ref(false); //是否显示
// 弹框参数
const propsInfo = reactive<FormProps.Base<AttendanceStudentsReturn.PassengerInfo>>({
const propsInfo = reactive<FormProps.Base<{}>>({
opt: FormOptEnum.VIEW, //操作类型
record: {}, //弹框数据
disabled: false
});
/**
* 打开弹框
* @param props 弹框参数
*/
function onOpen(props: FormProps.Base<AttendanceStudentsReturn.PassengerInfo>) {
Object.assign(propsInfo, props); //合并参数
visible.value = true; //显示弹框
if (props.record.id) {
//如果传了id,就去请求api获取record
attendanceStudentsReturn.detail({ id: props.record.id }).then(res => {
propsInfo.record = res.data;
});
}
}

const tableData = ref([
{
id:'1',
studentname: "张三",
faces: [
{
faceUrl:
"http://deepvision.oss-cn-zhangjiakou.aliyuncs.com/dfield-cruising/online/person-set/quanjiang/DEMO00001/8746a847ecd64c1696b37f4cdf617a18/5dc35e4c7af84b3fb5aab70156574873.jpg?Expires=1721375257&OSSAccessKeyId=STS.NTfeBHwzU7kivsSS2EypREace&Signature=c1aTbDc1hNISq%2BV05o0slEfoCTI%3D&security-token=CAIS0wN1q6Ft5B2yfSjIr5fTLvj8mqV0gKmCdFXitzIQdf9%2BqqTIhzz2IHFMf3huCeodsv8%2BlGxS5%2FgelrpqVpZDR03Na8RHwrly1lv5O9KY4x49TRng0s%2FLI3OaLjKm9hi7AYygPgK0GJqEb1TDiVUto9%2FTfimjWFqIKICAjYUdAP0cQgi%2Fa0gwZrJRPRAwh8IGEnHTOP2xUHvtmXGCNFd0nQB%2BhGhjk7TdpPeR8R3Dllb35%2FYIroDqWPieYtJrIY10XqWBvqx%2FfbGT1zVLuVoYtvV6gaFc5zbcv9abRFVf4hiCP6%2Ff6MBuNw5%2Fae94efZNp%2BOukuZj6K6B1db7xhtVI%2BBOUiPZA4mr2IzdBeqvNNcwc7m8F1no9YjXbsGs9EEGGStLaVgVI4F8dyAhWEd9FWjgR%2FX5qAyQUGCKULOY1aw6651xwmjz8MCCT1r1GOTBindGasVnMxh5Z0JMjDK9aNkKfgFUbVJ8BrGTCIh%2FYx0bsq7yowDIEyp71TRMo%2Bbu%2FDBhIifKpO4VN7AxMup1DPwu2wNCxORK3yyybb5sa3aTR6942p%2F%2FF5VxFNPqOx1rmCMf4znuW4yrvNkAVvNcuIqdR8aLhaLIEbHzoKxuEKRnrfsIeBqAAUB%2FCKIuI1UaCj4LYX8DyIYOI8tUKFsMguPHpPENaK9Lcz5ZhB%2BrX6BcQfNWOLhDx7KyRE28vtEs2uolAhLTRaZsZFjbAZE5Ngt09%2FbSXdD%2FR%2BOlGMpQdp752x5lOlvPsJp1skuFLbramyqY4oj4tVwv1OLWpcsEc3AEosPalpAuIAA%3D"
},
],
louceng:'3',
qinshi:'301',
},
{
id:'2',
studentname: "李四",
faces: [
{
faceUrl:
"http://deepvision.oss-cn-zhangjiakou.aliyuncs.com/dfield-cruising/online/person-set/quanjiang/DEMO00001/8746a847ecd64c1696b37f4cdf617a18/5dc35e4c7af84b3fb5aab70156574873.jpg?Expires=1721375257&OSSAccessKeyId=STS.NTfeBHwzU7kivsSS2EypREace&Signature=c1aTbDc1hNISq%2BV05o0slEfoCTI%3D&security-token=CAIS0wN1q6Ft5B2yfSjIr5fTLvj8mqV0gKmCdFXitzIQdf9%2BqqTIhzz2IHFMf3huCeodsv8%2BlGxS5%2FgelrpqVpZDR03Na8RHwrly1lv5O9KY4x49TRng0s%2FLI3OaLjKm9hi7AYygPgK0GJqEb1TDiVUto9%2FTfimjWFqIKICAjYUdAP0cQgi%2Fa0gwZrJRPRAwh8IGEnHTOP2xUHvtmXGCNFd0nQB%2BhGhjk7TdpPeR8R3Dllb35%2FYIroDqWPieYtJrIY10XqWBvqx%2FfbGT1zVLuVoYtvV6gaFc5zbcv9abRFVf4hiCP6%2Ff6MBuNw5%2Fae94efZNp%2BOukuZj6K6B1db7xhtVI%2BBOUiPZA4mr2IzdBeqvNNcwc7m8F1no9YjXbsGs9EEGGStLaVgVI4F8dyAhWEd9FWjgR%2FX5qAyQUGCKULOY1aw6651xwmjz8MCCT1r1GOTBindGasVnMxh5Z0JMjDK9aNkKfgFUbVJ8BrGTCIh%2FYx0bsq7yowDIEyp71TRMo%2Bbu%2FDBhIifKpO4VN7AxMup1DPwu2wNCxORK3yyybb5sa3aTR6942p%2F%2FF5VxFNPqOx1rmCMf4znuW4yrvNkAVvNcuIqdR8aLhaLIEbHzoKxuEKRnrfsIeBqAAUB%2FCKIuI1UaCj4LYX8DyIYOI8tUKFsMguPHpPENaK9Lcz5ZhB%2BrX6BcQfNWOLhDx7KyRE28vtEs2uolAhLTRaZsZFjbAZE5Ngt09%2FbSXdD%2FR%2BOlGMpQdp752x5lOlvPsJp1skuFLbramyqY4oj4tVwv1OLWpcsEc3AEosPalpAuIAA%3D"
},
],
louceng:'3',
qinshi:'302',
},
{
id:'3',
studentname: "张三",
faces: [
{
faceUrl:
"http://deepvision.oss-cn-zhangjiakou.aliyuncs.com/dfield-cruising/online/person-set/quanjiang/DEMO00001/8746a847ecd64c1696b37f4cdf617a18/5dc35e4c7af84b3fb5aab70156574873.jpg?Expires=1721375257&OSSAccessKeyId=STS.NTfeBHwzU7kivsSS2EypREace&Signature=c1aTbDc1hNISq%2BV05o0slEfoCTI%3D&security-token=CAIS0wN1q6Ft5B2yfSjIr5fTLvj8mqV0gKmCdFXitzIQdf9%2BqqTIhzz2IHFMf3huCeodsv8%2BlGxS5%2FgelrpqVpZDR03Na8RHwrly1lv5O9KY4x49TRng0s%2FLI3OaLjKm9hi7AYygPgK0GJqEb1TDiVUto9%2FTfimjWFqIKICAjYUdAP0cQgi%2Fa0gwZrJRPRAwh8IGEnHTOP2xUHvtmXGCNFd0nQB%2BhGhjk7TdpPeR8R3Dllb35%2FYIroDqWPieYtJrIY10XqWBvqx%2FfbGT1zVLuVoYtvV6gaFc5zbcv9abRFVf4hiCP6%2Ff6MBuNw5%2Fae94efZNp%2BOukuZj6K6B1db7xhtVI%2BBOUiPZA4mr2IzdBeqvNNcwc7m8F1no9YjXbsGs9EEGGStLaVgVI4F8dyAhWEd9FWjgR%2FX5qAyQUGCKULOY1aw6651xwmjz8MCCT1r1GOTBindGasVnMxh5Z0JMjDK9aNkKfgFUbVJ8BrGTCIh%2FYx0bsq7yowDIEyp71TRMo%2Bbu%2FDBhIifKpO4VN7AxMup1DPwu2wNCxORK3yyybb5sa3aTR6942p%2F%2FF5VxFNPqOx1rmCMf4znuW4yrvNkAVvNcuIqdR8aLhaLIEbHzoKxuEKRnrfsIeBqAAUB%2FCKIuI1UaCj4LYX8DyIYOI8tUKFsMguPHpPENaK9Lcz5ZhB%2BrX6BcQfNWOLhDx7KyRE28vtEs2uolAhLTRaZsZFjbAZE5Ngt09%2FbSXdD%2FR%2BOlGMpQdp752x5lOlvPsJp1skuFLbramyqY4oj4tVwv1OLWpcsEc3AEosPalpAuIAA%3D"
},
],
louceng:'4',
qinshi:'401',
},
{
id:'4',
studentname: "李四",
faces: [
{
faceUrl:
"http://deepvision.oss-cn-zhangjiakou.aliyuncs.com/dfield-cruising/online/person-set/quanjiang/DEMO00001/8746a847ecd64c1696b37f4cdf617a18/5dc35e4c7af84b3fb5aab70156574873.jpg?Expires=1721375257&OSSAccessKeyId=STS.NTfeBHwzU7kivsSS2EypREace&Signature=c1aTbDc1hNISq%2BV05o0slEfoCTI%3D&security-token=CAIS0wN1q6Ft5B2yfSjIr5fTLvj8mqV0gKmCdFXitzIQdf9%2BqqTIhzz2IHFMf3huCeodsv8%2BlGxS5%2FgelrpqVpZDR03Na8RHwrly1lv5O9KY4x49TRng0s%2FLI3OaLjKm9hi7AYygPgK0GJqEb1TDiVUto9%2FTfimjWFqIKICAjYUdAP0cQgi%2Fa0gwZrJRPRAwh8IGEnHTOP2xUHvtmXGCNFd0nQB%2BhGhjk7TdpPeR8R3Dllb35%2FYIroDqWPieYtJrIY10XqWBvqx%2FfbGT1zVLuVoYtvV6gaFc5zbcv9abRFVf4hiCP6%2Ff6MBuNw5%2Fae94efZNp%2BOukuZj6K6B1db7xhtVI%2BBOUiPZA4mr2IzdBeqvNNcwc7m8F1no9YjXbsGs9EEGGStLaVgVI4F8dyAhWEd9FWjgR%2FX5qAyQUGCKULOY1aw6651xwmjz8MCCT1r1GOTBindGasVnMxh5Z0JMjDK9aNkKfgFUbVJ8BrGTCIh%2FYx0bsq7yowDIEyp71TRMo%2Bbu%2FDBhIifKpO4VN7AxMup1DPwu2wNCxORK3yyybb5sa3aTR6942p%2F%2FF5VxFNPqOx1rmCMf4znuW4yrvNkAVvNcuIqdR8aLhaLIEbHzoKxuEKRnrfsIeBqAAUB%2FCKIuI1UaCj4LYX8DyIYOI8tUKFsMguPHpPENaK9Lcz5ZhB%2BrX6BcQfNWOLhDx7KyRE28vtEs2uolAhLTRaZsZFjbAZE5Ngt09%2FbSXdD%2FR%2BOlGMpQdp752x5lOlvPsJp1skuFLbramyqY4oj4tVwv1OLWpcsEc3AEosPalpAuIAA%3D"
},
],
louceng:'3',
qinshi:'301',
},
{
id:'5',
studentname: "张三",
faces: [
{
faceUrl:
"http://deepvision.oss-cn-zhangjiakou.aliyuncs.com/dfield-cruising/online/person-set/quanjiang/DEMO00001/8746a847ecd64c1696b37f4cdf617a18/5dc35e4c7af84b3fb5aab70156574873.jpg?Expires=1721375257&OSSAccessKeyId=STS.NTfeBHwzU7kivsSS2EypREace&Signature=c1aTbDc1hNISq%2BV05o0slEfoCTI%3D&security-token=CAIS0wN1q6Ft5B2yfSjIr5fTLvj8mqV0gKmCdFXitzIQdf9%2BqqTIhzz2IHFMf3huCeodsv8%2BlGxS5%2FgelrpqVpZDR03Na8RHwrly1lv5O9KY4x49TRng0s%2FLI3OaLjKm9hi7AYygPgK0GJqEb1TDiVUto9%2FTfimjWFqIKICAjYUdAP0cQgi%2Fa0gwZrJRPRAwh8IGEnHTOP2xUHvtmXGCNFd0nQB%2BhGhjk7TdpPeR8R3Dllb35%2FYIroDqWPieYtJrIY10XqWBvqx%2FfbGT1zVLuVoYtvV6gaFc5zbcv9abRFVf4hiCP6%2Ff6MBuNw5%2Fae94efZNp%2BOukuZj6K6B1db7xhtVI%2BBOUiPZA4mr2IzdBeqvNNcwc7m8F1no9YjXbsGs9EEGGStLaVgVI4F8dyAhWEd9FWjgR%2FX5qAyQUGCKULOY1aw6651xwmjz8MCCT1r1GOTBindGasVnMxh5Z0JMjDK9aNkKfgFUbVJ8BrGTCIh%2FYx0bsq7yowDIEyp71TRMo%2Bbu%2FDBhIifKpO4VN7AxMup1DPwu2wNCxORK3yyybb5sa3aTR6942p%2F%2FF5VxFNPqOx1rmCMf4znuW4yrvNkAVvNcuIqdR8aLhaLIEbHzoKxuEKRnrfsIeBqAAUB%2FCKIuI1UaCj4LYX8DyIYOI8tUKFsMguPHpPENaK9Lcz5ZhB%2BrX6BcQfNWOLhDx7KyRE28vtEs2uolAhLTRaZsZFjbAZE5Ngt09%2FbSXdD%2FR%2BOlGMpQdp752x5lOlvPsJp1skuFLbramyqY4oj4tVwv1OLWpcsEc3AEosPalpAuIAA%3D"
},
],
louceng:'5',
qinshi:'502',
}
]);
// 获取 noFaceTableRef 元素,调用其获取刷新数据方法(还能获取到当前查询参数,方便导出携带参数)
const noFaceTableRef = ref<noFaceTableInstance>();
// 获取 noReturnTableRef 元素,调用其获取刷新数据方法(还能获取到当前查询参数,方便导出携带参数)
const noReturnTableRef = ref<ProTableInstance>();
// 表格配置项
const columns: ColumnProps[] = [
{ type: "selection" },
{
prop: "louceng",
label: "楼层"
},
{
prop: "qinshi",
label: "寝室编号"
prop: "name",
label: "学生姓名"
},
{
prop: "studentname",
label: "学生姓名"
prop: "personSetName",
label: "班级"
},
{
prop: "faces",
@@ -145,7 +75,7 @@ const columns: ColumnProps[] = [
render: scope => {
return (
<img
src={scope.row.faces.length > 0 ? scope.row.faces[0].faceUrl : ""}
src={scope.row.faces.length > 0 ? '/api/'+scope.row.faces[0].faceUrl : ""}
onClick={() => viewHeadImage(scope)}
style="width:50px;height:50px;cursor:pointer"
alt=""
@@ -154,6 +84,25 @@ const columns: ColumnProps[] = [
}
}
];
/**
* 打开弹框
* @param props 弹框参数
*/
function onOpen(props: FormProps.Base<{}>) {
Object.assign(propsInfo, props); //合并参数
visible.value = true; //显示弹框
nextTick(()=>{
noReturnTableRef.value!.searchParam.id = props.record.id;
noReturnTableRef.value!.searchParam.returnTime = props.record.ReturnTime;
noReturnTableRef.value.search()
})
}
const dataCallback = (res:any)=>{
if(!res.attendanceDtos)return res.personInfos
return res.personInfos.filter(e=>{
return !res.attendanceDtos.find(e1=>e1.personId == e.personId)
})
}
// 图片预览
const imgVisible = ref(false);
const faceUrl = ref('');
@@ -162,8 +111,15 @@ const viewHeadImage = (scope: any) => {
imgVisible.value = true
};
/** 人工确认 */
async function personConfirm(ids: string[], msg: string) {
await useHandleData(attendanceStudentsReturn.delete, {id: ids.toString() }, msg);
async function personConfirm(list:any, msg: string) {
list = list.map(e=>{
return {
personSetId:e.personSetId,
personId:e.personId,
tick:formatDate(new Date().valueOf())
}
})
await useHandleData(attendanceApi.add, list, msg);
RefreshTable(); //刷新表格
}
/** 关闭表单*/
@@ -172,7 +128,7 @@ function onClose() {
}
// 刷新表格
const RefreshTable = () => {
noFaceTableRef.value?.refresh();
noReturnTableRef.value?.refresh();
};
// 暴露给父组件的方法
defineExpose({


+ 117
- 47
SafeCampus.WEB/src/views/attendance/studentsReturn/index.vue Visa fil

@@ -1,72 +1,138 @@
<!--
* @Description: 教师点名
* @Description: 学生归寝
* @Author: yxq
* @Date: 2024-7-16
* @Date: 2024-7-24
-->
<template>
<div class="table-box">
<ProTable ref="proTable" title="教师点名" :columns="columns" :data="data">
<!-- 表格操作栏 -->
<template #operation="scope">
<el-space>
<s-button
:disabled="!scope.row.noFaceNum"
link
prefix="人工"
:opt="FormOptEnum.EDIT"
suffix="确认"
@click="onOpen(FormOptEnum.VIEW, scope.row)"
/>
</el-space>
<div class="main-box">
<TreeFilter
ref="treeFilter"
label="name"
id="id"
width="300px"
:show-all="false"
:isData="true"
:data="treeData"
:default-value="defaultValue"
@change="changeTreeFilter"
>
<template v-slot:header>
<h4 style="margin: 0 0 15px; font-size: 18px; font-weight: bold; color: var(--el-color-info-dark-2); letter-spacing: 0.5px">所属楼栋</h4>
</template>
</ProTable>
<ReturnConfirm ref="ReturnConfirmRef" />
<template v-slot:label="{ row }">
<span class="custom-tree-node">
<span>{{ row.node.label }}</span>
</span>
</template>
</TreeFilter>
<div class="table-box">
<ProTable ref="proTable" title="教师点名" :request-auto="false" :columns="columns" :request-api="userManageDormitoryApi.returnList">
<!-- 表格 header 按钮 -->
<template #tableHeader>
<div style="display: flex; align-items: center">
<el-date-picker
v-model="ReturnTime"
:clearable="false"
value-format="YYYY-MM-DD"
type="date"
placeholder="选择查询日期"
@change="retrunTimeChange"
>
</el-date-picker>
<div style="margin-left: 15px; color: #606266">归寝时间:{{ returnTime }}</div>
</div>
</template>
<!-- 表格操作栏 -->
<template #operation="scope">
<el-space>
<!-- :disabled="!scope.row.noReturnNum" -->
<s-button link prefix="归寝" :opt="FormOptEnum.EDIT" suffix="确认" @click="onOpen(FormOptEnum.VIEW, scope.row)" />
</el-space>
</template>
</ProTable>
<ReturnConfirm ref="ReturnConfirmRef" />
</div>
</div>
</template>
<script setup lang="ts">
import { attendanceStudentsReturn, AttendanceStudentsReturn } from "@/api";
import { userManageDormitoryApi } from "@/api";
import { ColumnProps, ProTableInstance } from "@/components/ProTable/interface";
import { FormOptEnum } from "@/enums";
import ReturnConfirm from "./components/returnConfirm/index.vue";
const data = ref([
{
louceng: "3",
qinshibianhao: "306",
qinshirenshu: "6",
guiqinNum: "5",
noFaceNum: "1"
},
{
louceng: "3",
qinshibianhao: "307",
qinshirenshu: "8",
guiqinNum: "6",
noFaceNum: "2"
}
]);
// 获取 ProTable 元素,调用其获取刷新数据方法(还能获取到当前查询参数,方便导出携带参数)
const proTable = ref<ProTableInstance>();
/**左侧楼栋**/
import TreeFilter from "@/components/TreeFilter/index.vue";
import { formatDate } from "@/utils";
const treeFilter = ref<InstanceType<typeof TreeFilter> | null>(null);
//楼栋切换
const buildId = ref<number | string>();
function changeTreeFilter(val: number | string) {
console.log(treeFilter.value?.treeData);
buildId.value = val;
proTable.value!.pageable.pageNum = 1;
proTable.value!.searchParam.buildId = val;
proTable.value!.search();
}
// 初始化数据
const treeData = ref([]);
const defaultValue = ref("");
const ReturnTime = ref("");
let ReturnTimeDefault = "";
const returnTime = ref();
onMounted(() => {
// 设置默认查询日期
let date = formatDate(new Date().valueOf());
ReturnTime.value = date.substring(0, 10);
proTable.value!.searchParam.ReturnTime = ReturnTime.value;
ReturnTimeDefault = ReturnTime.value;
// 请求楼栋
userManageDormitoryApi.list().then(res => {
if (res.code == 200) {
if (res.data.length) {
treeData.value = res.data;
defaultValue.value = res.data[0].id.toString();
buildId.value = defaultValue.value;
// 请求表格
proTable.value!.pageable.pageNum = 1;
proTable.value!.searchParam.buildId = defaultValue.value;
proTable.value!.search();
}
}
});
// 归寝时间
userManageDormitoryApi.getReturnTime().then(res => {
if (res.code == 200) {
returnTime.value = res.data.timeBegin + " ~ " + res.data.timeEnd;
}
});
});
// 查询日期修改
const retrunTimeChange = () => {
proTable.value!.pageable.pageNum = 1;
proTable.value!.searchParam.ReturnTime = ReturnTime.value || ReturnTimeDefault;
proTable.value!.search();
};
// 获取 ProTable 元素,调用其获取刷新数据方法(还能获取到当前查询参数,方便导出携带参数)
// 表格配置项
const columns: ColumnProps[] = [
{
prop: "louceng",
label: "楼层"
},
{
prop: "qinshibianhao",
prop: "name",
label: "寝室编号"
},
{
prop: "qinshirenshu",
prop: "personCount",
label: "寝室人数"
},
{
prop: "guiqinNum",
prop: "dormitoryCount",
label: "归寝人数"
},
{
prop: "noFaceNum",
label: "未归寝人数"
prop: "noDormitoryCount",
label: "未归寝人数",
render: scope => {
return scope.row.personCount - scope.row.dormitoryCount;
}
},
{ prop: "operation", label: "操作", width: 250, fixed: "right" }
];
@@ -76,10 +142,14 @@ const ReturnConfirmRef = ref<InstanceType<typeof ReturnConfirm> | null>(null);
* @param opt 操作类型
* @param record 弹框数据
*/
function onOpen(opt: FormOptEnum, record: {} | AttendanceStudentsReturn.studentsReturnInfo = {}) {
function onOpen(opt: FormOptEnum, record = {}) {
switch (opt) {
case FormOptEnum.VIEW:
ReturnConfirmRef.value?.onOpen({ opt: opt, record: record, successful: RefreshTable });
ReturnConfirmRef.value?.onOpen({
opt: opt,
record: { ...record, ReturnTime: ReturnTime.value || ReturnTimeDefault },
successful: RefreshTable
});
break;
}
}


Laddar…
Avbryt
Spara