|
|
@@ -56,16 +56,26 @@
|
|
|
{{ row.phone || '-' }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column prop="gradeName" label="年级" width="160" align="center">
|
|
|
+ <template #default="{ row }">
|
|
|
+ {{ row.gradeName || '-' }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="subjectName" label="科目" width="160" align="center">
|
|
|
+ <template #default="{ row }">
|
|
|
+ {{ row.subjectName || '-' }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column prop="binXKW" label="是否绑定学科网" width="160" align="center">
|
|
|
<template #default="{ row }">
|
|
|
{{ row.binXKW === 1 ? '是' : '否' }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="xkwId" label="学科网" width="160" align="center">
|
|
|
+ <!-- <el-table-column prop="xkwId" label="学科网" width="160" align="center">
|
|
|
<template #default="{ row }">
|
|
|
{{ row.xkwId || '-' }}
|
|
|
</template>
|
|
|
- </el-table-column>
|
|
|
+ </el-table-column> -->
|
|
|
<el-table-column prop="status" label="状态" width="80" align="center">
|
|
|
<template #default="{ row }">
|
|
|
<div class="status_container">
|
|
|
@@ -152,7 +162,6 @@ interface Teacher {
|
|
|
}
|
|
|
|
|
|
const tableData = ref<Teacher[]>([])
|
|
|
-const allData = ref<Teacher[]>([])
|
|
|
const tableLoading = ref(false)
|
|
|
const pageNum = ref(1)
|
|
|
const pageSize = ref(20)
|
|
|
@@ -164,72 +173,63 @@ const GetTableIndex = (index: number) => {
|
|
|
return (pageNum.value - 1) * pageSize.value + index + 1
|
|
|
}
|
|
|
|
|
|
-// 前端筛选 + 分页
|
|
|
-const FilterAndPaginate = () => {
|
|
|
- let filteredData = [...allData.value]
|
|
|
-
|
|
|
- // tab筛选
|
|
|
- if (currentTab.value === 'bound') {
|
|
|
- filteredData = filteredData.filter(item => item.binXKW === 1)
|
|
|
- } else if (currentTab.value === 'unbound') {
|
|
|
- filteredData = filteredData.filter(item => item.binXKW === 0)
|
|
|
- }
|
|
|
-
|
|
|
- // 搜索筛选
|
|
|
- if (searchKeyword.value) {
|
|
|
- const keyword = searchKeyword.value.toLowerCase()
|
|
|
- filteredData = filteredData.filter(item =>
|
|
|
- (item.userName || '').toLowerCase().includes(keyword) ||
|
|
|
- (item.userAccount || '').toLowerCase().includes(keyword)
|
|
|
- )
|
|
|
- }
|
|
|
-
|
|
|
- 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
|
|
|
+ }
|
|
|
+ if (searchKeyword.value) {
|
|
|
+ params.queryStr = searchKeyword.value
|
|
|
}
|
|
|
const res = await getAllTeacher(params)
|
|
|
- allData.value = res.data || []
|
|
|
- FilterAndPaginate()
|
|
|
+ if (res.code === 200 && res.data) {
|
|
|
+ tableData.value = res.data.records || []
|
|
|
+ total.value = Number(res.data.total) || 0
|
|
|
+ } else {
|
|
|
+ tableData.value = []
|
|
|
+ total.value = 0
|
|
|
+ }
|
|
|
} catch (error) {
|
|
|
console.error('获取教师列表失败', error)
|
|
|
+ tableData.value = []
|
|
|
+ total.value = 0
|
|
|
} finally {
|
|
|
tableLoading.value = false
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// 切换Tab(前端筛选)
|
|
|
+// 切换Tab
|
|
|
const ChangeTab = (tab: string) => {
|
|
|
currentTab.value = tab
|
|
|
pageNum.value = 1
|
|
|
- FilterAndPaginate()
|
|
|
+ GetTeacherList()
|
|
|
}
|
|
|
|
|
|
-// 搜索(前端筛选)
|
|
|
+// 搜索
|
|
|
const HandleSearch = () => {
|
|
|
pageNum.value = 1
|
|
|
- FilterAndPaginate()
|
|
|
+ GetTeacherList()
|
|
|
}
|
|
|
|
|
|
-// 分页操作(前端分页)
|
|
|
+// 分页操作
|
|
|
const HandleCurrentChange = (val: number) => {
|
|
|
pageNum.value = val
|
|
|
- FilterAndPaginate()
|
|
|
+ GetTeacherList()
|
|
|
}
|
|
|
|
|
|
const HandleSizeChange = (val: number) => {
|
|
|
pageSize.value = val
|
|
|
pageNum.value = 1
|
|
|
- FilterAndPaginate()
|
|
|
+ GetTeacherList()
|
|
|
}
|
|
|
|
|
|
// 返回
|