feat(admin): 为投递管理页面添加分页功能

This commit is contained in:
TianyangZhang 2026-03-25 17:01:42 +08:00
parent 85e5cbd9c9
commit 00abe1da15
1 changed files with 33 additions and 4 deletions

View File

@ -25,6 +25,16 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<div style="margin-top: 16px; text-align: right;">
<el-pagination
v-model:current-page="currentPage"
:page-size="pageSize"
:total="total"
@current-change="handlePageChange"
layout="total, prev, pager, next, jumper"
/>
</div>
<el-dialog v-model="resumeVisible" title="简历详情" width="700px"> <el-dialog v-model="resumeVisible" title="简历详情" width="700px">
<div v-if="currentResume" class="resume-detail"> <div v-if="currentResume" class="resume-detail">
<!-- 基本信息 --> <!-- 基本信息 -->
@ -104,6 +114,9 @@ const applications = ref([])
const loading = ref(false) const loading = ref(false)
const resumeVisible = ref(false) const resumeVisible = ref(false)
const currentResume = ref(null) const currentResume = ref(null)
const currentPage = ref(1)
const pageSize = ref(20)
const total = ref(0)
const genderMap = { const genderMap = {
'male': '男', 'male': '男',
@ -112,17 +125,33 @@ const genderMap = {
'': '-' '': '-'
} }
onMounted(async () => { const fetchApplications = async (page = 1) => {
loading.value = true loading.value = true
const { data } = await getManageApplications() try {
const { data } = await getManageApplications({ page })
applications.value = data.results applications.value = data.results
total.value = data.count
currentPage.value = page
} catch (error) {
ElMessage.error('加载投递列表失败,请重试')
} finally {
loading.value = false loading.value = false
}
}
function handlePageChange(newPage) {
fetchApplications(newPage)
}
onMounted(() => {
fetchApplications()
}) })
async function updateStatus(row) { async function updateStatus(row) {
try { try {
await updateApplicationStatus(row.id, { status: row.status }) await updateApplicationStatus(row.id, { status: row.status })
ElMessage.success('状态已更新,求职者将收到邮件通知') ElMessage.success('状态已更新,求职者将收到邮件通知')
fetchApplications(currentPage.value)
} catch { ElMessage.error('更新失败') } } catch { ElMessage.error('更新失败') }
} }