fix: 更新SignupModal中的搜索功能以重置页码

This commit is contained in:
huweihang
2025-12-18 16:36:53 +08:00
parent 7a9063ffae
commit 148ab93b07

View File

@@ -32,7 +32,8 @@
<div class="tab-search"> <div class="tab-search">
<span class="label">姓名</span> <span class="label">姓名</span>
<el-input v-model="nameSearch.keyword" placeholder="请输入姓名" size="small" clearable class="input" /> <el-input v-model="nameSearch.keyword" placeholder="请输入姓名" size="small" clearable class="input" />
<el-button type="primary" size="small" @click="onSearchStu"> <!-- 点击搜索时认为是一次新的搜索页码应重置为第 1 -->
<el-button type="primary" size="small" @click="onSearchStu(true)">
搜索 搜索
</el-button> </el-button>
<el-button size="small" @click="resetStu">重置</el-button> <el-button size="small" @click="resetStu">重置</el-button>
@@ -412,7 +413,15 @@ export default {
this.projectParams.studentName = ""; this.projectParams.studentName = "";
this.getProjectStu(); this.getProjectStu();
}, },
onSearchStu() { /**
* 获取“快速选人”列表
* @param {Boolean} resetPage 是否重置到第 1 页(新的搜索条件或重置时需要)
*/
onSearchStu(resetPage = false) {
// 当关键字、组织等搜索条件变化或点击“搜索”按钮时,应将页码重置为 1
if (resetPage) {
this.stuTable.pageNo = 1;
}
fetchQuickStudents({ fetchQuickStudents({
...this.nameSearch, ...this.nameSearch,
pageNo: this.stuTable.pageNo, pageNo: this.stuTable.pageNo,
@@ -451,6 +460,8 @@ export default {
}, },
resetStu() { resetStu() {
this.nameSearch = { keyword: "", departId: "" }; this.nameSearch = { keyword: "", departId: "" };
// 重置时也应从第 1 页重新加载
this.stuTable.pageNo = 1;
this.onSearchStu(); this.onSearchStu();
}, },
fetchOrgTree() { fetchOrgTree() {