fix: 修复班级切换时选中状态保持问题

This commit is contained in:
QDKF 2025-09-25 20:29:08 +08:00
parent 8297d62258
commit 41cccd9f7a

View File

@ -1665,19 +1665,22 @@ const handleTemplateDownload = (type?: string) => {
// //
const handleSearch = () => { const handleSearch = () => {
// filteredData // filteredData
// //
paginationPage.value = 1 paginationPage.value = 1
selectedRowKeys.value = [] //
} }
// //
watch(searchKeyword, () => { watch(searchKeyword, () => {
paginationPage.value = 1 paginationPage.value = 1
selectedRowKeys.value = [] //
}) })
// //
const clearSearch = () => { const clearSearch = () => {
searchKeyword.value = '' searchKeyword.value = ''
paginationPage.value = 1 paginationPage.value = 1
selectedRowKeys.value = [] //
} }
// //
@ -1839,9 +1842,10 @@ watch(
if (newClassId !== oldClassId) { if (newClassId !== oldClassId) {
// watch // watch
selectedDepartment.value = newClassId ? String(newClassId) : '' selectedDepartment.value = newClassId ? String(newClassId) : ''
// //
searchKeyword.value = '' searchKeyword.value = ''
paginationPage.value = 1 paginationPage.value = 1
selectedRowKeys.value = [] //
loadData(newClassId) loadData(newClassId)
} }
}, },
@ -1857,9 +1861,10 @@ watch(
// props.classIdprops // props.classIdprops
const currentPropsClassId = props.classId ? String(props.classId) : '' const currentPropsClassId = props.classId ? String(props.classId) : ''
if (newDepartmentId !== oldDepartmentId && newDepartmentId !== currentPropsClassId) { if (newDepartmentId !== oldDepartmentId && newDepartmentId !== currentPropsClassId) {
// //
searchKeyword.value = '' searchKeyword.value = ''
paginationPage.value = 1 paginationPage.value = 1
selectedRowKeys.value = [] //
const targetClassId = newDepartmentId || null const targetClassId = newDepartmentId || null
loadData(targetClassId) loadData(targetClassId)
} }