提交
This commit is contained in:
1 parent
b8da4c17bf
commit
d9ea1caae8
15 files changed
+1233
-68
No files matched your search
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user