fix: 修复床位分配对象展示与卫生检查提交误报校验

恢复房间床位详情完整关联查询以显示学院/班级/学生;修复卫生检查 Web/移动端表单校验误报,并将房间学生 ID 以字符串返回避免精度丢失。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
“wuzhen”andCursor committed 2026-08-20 15:17:41 +08:00
1 parent 3518ea697e
commit 6a0f1206fa
6 files changed
+193 -131

No files matched your search

@@ -522,7 +522,7 @@ const syncClassOptionsFromStudents = (students: any[], preferClassId?: string |
const key = String(student.classId);
if (!map.has(key)) {
map.set(key, {
classId: student.classId,
classId: key,
className: student.className || key
});
}
@@ -1255,7 +1255,25 @@ const handleDownloadAttachment = async (file: any) => {
// 提交表单
const submitForm = async () => {
try {
await hygieneFormRef.value?.validate();
if (!classOptions.value.length) {
ElMessage.error('当前寝室无在住学生班级,无法提交宿舍扣分');
return;
}
try {
await hygieneFormRef.value?.validate();
} catch (validateError: any) {
console.error('表单校验失败:', validateError);
let firstMsg = '请检查表单填写是否完整';
if (validateError && typeof validateError === 'object') {
const firstField = Object.values(validateError)[0] as any;
if (Array.isArray(firstField) && firstField[0]?.message) {
firstMsg = firstField[0].message;
}
}
ElMessage.error(firstMsg);
return;
}
if ((hygieneForm.totalScore || 0) > 100) {
ElMessage.error('宿舍合计扣分不能超过100分');
@@ -1342,7 +1360,7 @@ const submitForm = async () => {
} catch (error) {
console.error('提交表单失败:', error);
if (window.ElMessage) {
window.ElMessage.error('请检查表单填写是否完整');
window.ElMessage.error('保存失败,请重试');
}
} finally {
buttonLoading.value = false;
@@ -480,7 +480,7 @@ const syncClassOptionsFromStudents = (students: any[], preferClassId?: string |
const key = String(classId);
if (!map.has(key)) {
map.set(key, {
classId,
classId: key,
className: (student.className || '').toString().trim() || key
});
}
@@ -936,7 +936,25 @@ const handleDownloadAttachment = async (file: any) => {
// 提交表单
const submitForm = async () => {
try {
await hygieneFormRef.value?.validate();
if (!classOptions.value.length) {
ElMessage.error('当前寝室无在住学生班级,无法提交宿舍扣分');
return;
}
try {
await hygieneFormRef.value?.validate();
} catch (validateError: any) {
console.error('表单校验失败:', validateError);
let firstMsg = '请检查表单填写是否完整';
if (validateError && typeof validateError === 'object') {
const firstField = Object.values(validateError)[0] as any;
if (Array.isArray(firstField) && firstField[0]?.message) {
firstMsg = firstField[0].message;
}
}
ElMessage.error(firstMsg);
return;
}
if ((hygieneForm.totalScore || 0) > 100) {
ElMessage.error('宿舍合计扣分不能超过100分');
@@ -1056,7 +1074,7 @@ const submitForm = async () => {
}
} catch (error) {
console.error('提交表单失败:', error);
ElMessage.error('请检查表单填写是否完整');
ElMessage.error('保存失败,请重试');
} finally {
buttonLoading.value = false;
}