|
|
@@ -20,7 +20,7 @@
|
|
|
<div class="search_area">
|
|
|
<el-input
|
|
|
v-model="searchKeyword"
|
|
|
- placeholder="请输入姓名/账号"
|
|
|
+ placeholder="请输入账号/手机号"
|
|
|
@input="HandleSearch"
|
|
|
>
|
|
|
<template #append>
|
|
|
@@ -85,7 +85,7 @@
|
|
|
></span>
|
|
|
<span :class="row.status === 1 ? 'status_active' : 'status_disabled'">
|
|
|
{{ row.status === 1 ? '启用' : '禁用' }}
|
|
|
- </span>
|
|
|
+ </span>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
@@ -162,44 +162,59 @@ interface Teacher {
|
|
|
}
|
|
|
|
|
|
const tableData = ref<Teacher[]>([])
|
|
|
+const allData = ref<Teacher[]>([])
|
|
|
const tableLoading = ref(false)
|
|
|
const pageNum = ref(1)
|
|
|
const pageSize = ref(20)
|
|
|
const total = ref(0)
|
|
|
const tableHeight = ref(0)
|
|
|
+const API_PAGE_SIZE = 7000
|
|
|
|
|
|
// 跨页连续序号
|
|
|
const GetTableIndex = (index: number) => {
|
|
|
return (pageNum.value - 1) * pageSize.value + index + 1
|
|
|
}
|
|
|
|
|
|
-// 获取教师列表
|
|
|
+// 前端 Tab 筛选 + 分页
|
|
|
+const FilterAndPaginate = () => {
|
|
|
+ let filteredData = [...allData.value]
|
|
|
+
|
|
|
+ if (currentTab.value === 'bound') {
|
|
|
+ filteredData = filteredData.filter(item => item.binXKW === 1)
|
|
|
+ } else if (currentTab.value === 'unbound') {
|
|
|
+ filteredData = filteredData.filter(item => item.binXKW === 0)
|
|
|
+ }
|
|
|
+
|
|
|
+ total.value = filteredData.length
|
|
|
+ const start = (pageNum.value - 1) * pageSize.value
|
|
|
+ const end = start + pageSize.value
|
|
|
+ tableData.value = filteredData.slice(start, end)
|
|
|
+}
|
|
|
+
|
|
|
+// 获取教师列表(接口一次拉取,前端分页)
|
|
|
const GetTeacherList = async () => {
|
|
|
tableLoading.value = true
|
|
|
try {
|
|
|
const params: Record<string, any> = {
|
|
|
schoolId: schoolId.value,
|
|
|
- pageNum: pageNum.value,
|
|
|
- pageSize: pageSize.value,
|
|
|
- }
|
|
|
- if (currentTab.value === 'bound') {
|
|
|
- params.binXKW = 1
|
|
|
- } else if (currentTab.value === 'unbound') {
|
|
|
- params.binXKW = 0
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: API_PAGE_SIZE,
|
|
|
}
|
|
|
if (searchKeyword.value) {
|
|
|
- params.queryStr = searchKeyword.value
|
|
|
+ params.word = searchKeyword.value
|
|
|
}
|
|
|
const res = await getAllTeacher(params)
|
|
|
if (res.code === 200 && res.data) {
|
|
|
- tableData.value = res.data.records || []
|
|
|
- total.value = Number(res.data.total) || 0
|
|
|
+ allData.value = res.data.records || []
|
|
|
+ FilterAndPaginate()
|
|
|
} else {
|
|
|
+ allData.value = []
|
|
|
tableData.value = []
|
|
|
total.value = 0
|
|
|
}
|
|
|
} catch (error) {
|
|
|
console.error('获取教师列表失败', error)
|
|
|
+ allData.value = []
|
|
|
tableData.value = []
|
|
|
total.value = 0
|
|
|
} finally {
|
|
|
@@ -207,29 +222,29 @@ const GetTeacherList = async () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// 切换Tab
|
|
|
+// 切换Tab(前端筛选)
|
|
|
const ChangeTab = (tab: string) => {
|
|
|
currentTab.value = tab
|
|
|
pageNum.value = 1
|
|
|
- GetTeacherList()
|
|
|
+ FilterAndPaginate()
|
|
|
}
|
|
|
|
|
|
-// 搜索
|
|
|
+// 搜索(接口模糊查询)
|
|
|
const HandleSearch = () => {
|
|
|
pageNum.value = 1
|
|
|
GetTeacherList()
|
|
|
}
|
|
|
|
|
|
-// 分页操作
|
|
|
+// 分页操作(前端分页)
|
|
|
const HandleCurrentChange = (val: number) => {
|
|
|
pageNum.value = val
|
|
|
- GetTeacherList()
|
|
|
+ FilterAndPaginate()
|
|
|
}
|
|
|
|
|
|
const HandleSizeChange = (val: number) => {
|
|
|
pageSize.value = val
|
|
|
pageNum.value = 1
|
|
|
- GetTeacherList()
|
|
|
+ FilterAndPaginate()
|
|
|
}
|
|
|
|
|
|
// 返回
|