This commit is contained in:
zlwu committed 2025-08-12 22:16:59 +08:00
1 parent b8da4c17bf
commit d9ea1caae8
15 files changed
+1233 -68

No files matched your search

@@ -0,0 +1,63 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DormBedStudentVO, DormBedStudentForm, DormBedStudentQuery } from '@/api/xg/xgss/dormBedStudent/dormBedStudent/types';
/**
* 查询床位学生分配关系列表
* @param query
* @returns {*}
*/
export const listDormBedStudent = (query?: DormBedStudentQuery): AxiosPromise<DormBedStudentVO[]> => {
return request({
url: '/dormBedStudent/dormBedStudent/list',
method: 'get',
params: query
});
};
/**
* 查询床位学生分配关系详细
* @param id
*/
export const getDormBedStudent = (id: string | number): AxiosPromise<DormBedStudentVO> => {
return request({
url: '/dormBedStudent/dormBedStudent/' + id,
method: 'get'
});
};
/**
* 新增床位学生分配关系
* @param data
*/
export const addDormBedStudent = (data: DormBedStudentForm) => {
return request({
url: '/dormBedStudent/dormBedStudent',
method: 'post',
data: data
});
};
/**
* 修改床位学生分配关系
* @param data
*/
export const updateDormBedStudent = (data: DormBedStudentForm) => {
return request({
url: '/dormBedStudent/dormBedStudent',
method: 'put',
data: data
});
};
/**
* 删除床位学生分配关系
* @param id
*/
export const delDormBedStudent = (id: string | number | Array<string | number>) => {
return request({
url: '/dormBedStudent/dormBedStudent/' + id,
method: 'delete'
});
};
@@ -0,0 +1,231 @@
export interface DormBedStudentVO {
/**
* 主键ID
*/
id: string | number;
/**
* 分配学院ID
*/
collegeId: string | number;
/**
* 分配专业ID
*/
majorId: string | number;
/**
* 分配班级ID
*/
classId: string | number;
/**
* 分配学生ID
*/
studentId: string | number;
/**
* 床位ID
*/
bedId: string | number;
/**
* 房间ID
*/
roomId: string | number;
/**
* 宿舍楼ID
*/
buildingId: string | number;
/**
* 宿舍区ID
*/
areaId: string | number;
/**
* 校区ID
*/
campusId: string | number;
/**
* 状态(0正常 1已退宿)
*/
status: string;
/**
* 分配时间
*/
assignTime: string;
/**
* 退宿时间
*/
checkoutTime: string;
/**
* 删除标志(0代表存在 1代表删除)
*/
deleted: string;
/**
* 备注
*/
remark: string;
}
export interface DormBedStudentForm extends BaseEntity {
/**
* 主键ID
*/
id?: string | number;
/**
* 分配学院ID
*/
collegeId?: string | number;
/**
* 分配专业ID
*/
majorId?: string | number;
/**
* 分配班级ID
*/
classId?: string | number;
/**
* 分配学生ID
*/
studentId?: string | number;
/**
* 床位ID
*/
bedId?: string | number;
/**
* 房间ID
*/
roomId?: string | number;
/**
* 宿舍楼ID
*/
buildingId?: string | number;
/**
* 宿舍区ID
*/
areaId?: string | number;
/**
* 校区ID
*/
campusId?: string | number;
/**
* 状态(0正常 1已退宿)
*/
status?: string;
/**
* 分配时间
*/
assignTime?: string;
/**
* 退宿时间
*/
checkoutTime?: string;
/**
* 删除标志(0代表存在 1代表删除)
*/
deleted?: string;
/**
* 备注
*/
remark?: string;
}
export interface DormBedStudentQuery extends PageQuery {
/**
* 分配学院ID
*/
collegeId?: string | number;
/**
* 分配专业ID
*/
majorId?: string | number;
/**
* 分配班级ID
*/
classId?: string | number;
/**
* 分配学生ID
*/
studentId?: string | number;
/**
* 床位ID
*/
bedId?: string | number;
/**
* 房间ID
*/
roomId?: string | number;
/**
* 宿舍楼ID
*/
buildingId?: string | number;
/**
* 宿舍区ID
*/
areaId?: string | number;
/**
* 校区ID
*/
campusId?: string | number;
/**
* 状态(0正常 1已退宿)
*/
status?: string;
/**
* 分配时间
*/
assignTime?: string;
/**
* 退宿时间
*/
checkoutTime?: string;
/**
* 删除标志(0代表存在 1代表删除)
*/
deleted?: string;
/**
* 日期范围参数
*/
params?: any;
}
@@ -87,6 +87,12 @@
<el-col :span="1.5">
<el-button :disabled="single" icon="Edit" @click="handleUpdate()"> 修改 </el-button>
</el-col>
<el-col :span="1.5">
<el-button type="primary" :disabled="multiple" @click="handleBatchApplyBed()"> 批量申请床位 </el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" :disabled="multiple" @click="handleBatchCancelBed()"> 批量取消床位 </el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-button :disabled="multiple" icon="Delete" @click="handleDelete()"> 删除 </el-button>
</el-col> -->
@@ -2125,6 +2131,73 @@ const handleDelete = async (row?: StudentVO) => {
}
};
/** 批量申请床位按钮操作 */
const handleBatchApplyBed = async () => {
if (ids.value.length === 0) {
ElMessage.warning('请选择要申请床位的学生');
return;
}
const [err] = await to(
ElMessageBox.confirm(`确认为选中的 ${ids.value.length} 名学生申请床位吗?`, '批量申请床位', {
confirmButtonText: '确认申请',
cancelButtonText: '取消',
type: 'info'
})
);
if (!err) {
try {
const res = await service.post('/studentMsg/studentMsg/batchApplyBed', {
studentIds: ids.value
});
if (res && res.code === 200) {
await getList();
ElMessage.success('批量申请床位成功');
} else {
ElMessage.error(res?.msg || '批量申请床位失败');
}
} catch (error) {
console.error('批量申请床位失败:', error);
ElMessage.error('批量申请床位失败,请重试');
}
}
};
/** 批量取消床位按钮操作 */
const handleBatchCancelBed = async () => {
if (ids.value.length === 0) {
ElMessage.warning('请选择要取消床位的学生');
return;
}
const [err] = await to(
ElMessageBox.confirm('请确认是否取消,会将学生已有宿舍清除!!!', '批量取消床位', {
confirmButtonText: '确认取消',
cancelButtonText: '取消',
type: 'warning',
dangerouslyUseHTMLString: true
})
);
if (!err) {
try {
const res = await service.post('/studentMsg/studentMsg/batchCancelBed', {
studentIds: ids.value
});
if (res && res.code === 200) {
await getList();
ElMessage.success('批量取消床位成功');
} else {
ElMessage.error(res?.msg || '批量取消床位失败');
}
} catch (error) {
console.error('批量取消床位失败:', error);
ElMessage.error('批量取消床位失败,请重试');
}
}
};
/** 查看详情按钮操作 */
const handleDetail = async (row: StudentVO) => {
const studentId = row?.id;