From 41cccd9f7ad549802332a8b7dd5716e06cbb2ef4 Mon Sep 17 00:00:00 2001 From: QDKF Date: Thu, 25 Sep 2025 20:29:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=8F=AD=E7=BA=A7?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E6=97=B6=E9=80=89=E4=B8=AD=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E4=BF=9D=E6=8C=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/teacher/ClassManagement.vue | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/components/teacher/ClassManagement.vue b/src/components/teacher/ClassManagement.vue index 4c67096..b186c2f 100644 --- a/src/components/teacher/ClassManagement.vue +++ b/src/components/teacher/ClassManagement.vue @@ -1665,19 +1665,22 @@ const handleTemplateDownload = (type?: string) => { // 搜索处理 const handleSearch = () => { // 搜索是实时的,通过计算属性filteredData自动过滤 - // 重置到第一页 + // 重置到第一页并清空选中状态 paginationPage.value = 1 + selectedRowKeys.value = [] // 搜索时清空选中状态 } -// 监听搜索关键词变化,重置分页 +// 监听搜索关键词变化,重置分页并清空选中状态 watch(searchKeyword, () => { paginationPage.value = 1 + selectedRowKeys.value = [] // 搜索时清空选中状态 }) // 清空搜索 const clearSearch = () => { searchKeyword.value = '' paginationPage.value = 1 + selectedRowKeys.value = [] // 清空搜索时也清空选中状态 } // 学员库相关方法 @@ -1839,9 +1842,10 @@ watch( if (newClassId !== oldClassId) { // 同步更新选择器的状态(不触发选择器的watch) selectedDepartment.value = newClassId ? String(newClassId) : '' - // 切换班级时清空搜索 + // 切换班级时清空搜索和选中状态 searchKeyword.value = '' paginationPage.value = 1 + selectedRowKeys.value = [] // 清空选中的学生 loadData(newClassId) } }, @@ -1857,9 +1861,10 @@ watch( // 如果当前props.classId存在且与选择器值一致,说明是props驱动的变化,不需要重复加载 const currentPropsClassId = props.classId ? String(props.classId) : '' if (newDepartmentId !== oldDepartmentId && newDepartmentId !== currentPropsClassId) { - // 切换班级时清空搜索 + // 切换班级时清空搜索和选中状态 searchKeyword.value = '' paginationPage.value = 1 + selectedRowKeys.value = [] // 清空选中的学生 const targetClassId = newDepartmentId || null loadData(targetClassId) }