2025-12-08 07:17:59 +00:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="index-lists">
|
|
|
|
|
|
<el-card class="!border-none" shadow="never">
|
|
|
|
|
|
<el-form ref="formRef" class="mb-[-16px]" :model="queryParams" :inline="true">
|
|
|
|
|
|
<el-form-item label="报名编号" prop="applicationNumber">
|
|
|
|
|
|
<el-input class="w-[280px]" v-model="queryParams.applicationNumber" />
|
|
|
|
|
|
</el-form-item>
|
2025-12-10 06:27:13 +00:00
|
|
|
|
<el-form-item label="姓名" prop="name">
|
|
|
|
|
|
<el-input class="w-[280px]" v-model="queryParams.name" />
|
|
|
|
|
|
</el-form-item>
|
2025-12-08 07:17:59 +00:00
|
|
|
|
<el-form-item label="审核状态" prop="approvalStatus">
|
2025-12-10 01:13:06 +00:00
|
|
|
|
<el-select
|
|
|
|
|
|
v-model="queryParams.approvalStatus"
|
|
|
|
|
|
class="w-[280px]"
|
|
|
|
|
|
clearable
|
|
|
|
|
|
@change="getLists()"
|
|
|
|
|
|
>
|
2025-12-08 07:17:59 +00:00
|
|
|
|
<el-option label="待审核" :value="0" />
|
2025-12-10 01:13:06 +00:00
|
|
|
|
<el-option label="已审核" :value="1" />
|
2025-12-08 07:17:59 +00:00
|
|
|
|
<el-option label="审核不通过" :value="2" />
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="报名时间" prop="applicationTime">
|
|
|
|
|
|
<daterange-picker
|
|
|
|
|
|
v-model:startTime="queryParams.applicationTimeStart"
|
|
|
|
|
|
v-model:endTime="queryParams.applicationTimeEnd"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item>
|
|
|
|
|
|
<el-button type="primary" @click="resetPage">查询</el-button>
|
|
|
|
|
|
<el-button @click="resetParams">重置</el-button>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-form>
|
|
|
|
|
|
</el-card>
|
|
|
|
|
|
<el-card class="!border-none mt-4" shadow="never">
|
2025-12-16 01:39:12 +00:00
|
|
|
|
<div class="flex mb-4">
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
v-perms="['stuRegistration/edit']"
|
|
|
|
|
|
@click="handleBatchApproval(0)"
|
|
|
|
|
|
:disabled="selectedIds.length === 0"
|
|
|
|
|
|
>
|
|
|
|
|
|
批量撤销
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
v-perms="['stuRegistration/edit']"
|
|
|
|
|
|
type="success"
|
|
|
|
|
|
@click="handleBatchApproval(1)"
|
|
|
|
|
|
:disabled="selectedIds.length === 0"
|
|
|
|
|
|
>
|
|
|
|
|
|
批量通过
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
v-perms="['stuRegistration/edit']"
|
|
|
|
|
|
type="danger"
|
|
|
|
|
|
@click="handleBatchApproval(2)"
|
|
|
|
|
|
:disabled="selectedIds.length === 0"
|
|
|
|
|
|
class="ml-2"
|
|
|
|
|
|
>
|
|
|
|
|
|
批量拒绝
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
</div>
|
2025-12-10 01:13:06 +00:00
|
|
|
|
<el-table
|
2025-12-16 01:39:12 +00:00
|
|
|
|
ref="tableRef"
|
2025-12-10 01:13:06 +00:00
|
|
|
|
class="mt-4"
|
|
|
|
|
|
size="large"
|
|
|
|
|
|
v-loading="pager.loading"
|
|
|
|
|
|
:data="pager.lists"
|
2025-12-16 01:39:12 +00:00
|
|
|
|
@selection-change="handleSelectionChange"
|
2025-12-10 01:13:06 +00:00
|
|
|
|
border
|
|
|
|
|
|
>
|
2025-12-16 01:39:12 +00:00
|
|
|
|
<el-table-column type="selection" width="55" />
|
2025-12-10 01:13:06 +00:00
|
|
|
|
<el-table-column label="报名编号" min-width="100">
|
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
link
|
|
|
|
|
|
@click="handleShowDetail(row.baseInfoId)"
|
|
|
|
|
|
style="text-decoration: underline"
|
|
|
|
|
|
>
|
|
|
|
|
|
{{ row.applicationNumber }}
|
|
|
|
|
|
</el-button>
|
2025-12-08 07:17:59 +00:00
|
|
|
|
</template>
|
2025-12-10 01:13:06 +00:00
|
|
|
|
</el-table-column>
|
2025-12-10 06:27:13 +00:00
|
|
|
|
<el-table-column label="名称" prop="name" min-width="100" />
|
|
|
|
|
|
<el-table-column
|
|
|
|
|
|
label="性别"
|
|
|
|
|
|
prop="gender"
|
|
|
|
|
|
min-width="100"
|
|
|
|
|
|
:formatter="formatGender"
|
|
|
|
|
|
/>
|
|
|
|
|
|
<el-table-column label="籍贯" prop="nativePlace" min-width="100" />
|
2025-12-08 07:17:59 +00:00
|
|
|
|
<el-table-column
|
|
|
|
|
|
label="审核状态"
|
|
|
|
|
|
prop="approvalStatus"
|
|
|
|
|
|
min-width="100"
|
2025-12-10 01:13:06 +00:00
|
|
|
|
:formatter="formatRegistrationStatus"
|
2025-12-08 07:17:59 +00:00
|
|
|
|
/>
|
|
|
|
|
|
<el-table-column label="报名时间" prop="applicationTime" min-width="100" />
|
2025-12-10 01:13:06 +00:00
|
|
|
|
<el-table-column label="操作" width="240" fixed="right">
|
2025-12-08 07:17:59 +00:00
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
v-perms="['stuRegistration/edit']"
|
2025-12-10 01:13:06 +00:00
|
|
|
|
@click="handleRoEdit(row)"
|
|
|
|
|
|
:disabled="row.approvalStatus == 0"
|
2025-12-08 07:17:59 +00:00
|
|
|
|
>
|
2025-12-10 01:13:06 +00:00
|
|
|
|
撤销
|
2025-12-08 07:17:59 +00:00
|
|
|
|
</el-button>
|
|
|
|
|
|
<el-button
|
2025-12-10 01:13:06 +00:00
|
|
|
|
v-perms="['stuRegistration/edit']"
|
|
|
|
|
|
type="success"
|
|
|
|
|
|
@click="handleYesEdit(row)"
|
|
|
|
|
|
:disabled="row.approvalStatus != 0"
|
|
|
|
|
|
>
|
|
|
|
|
|
通过
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
v-perms="['stuRegistration/edit']"
|
2025-12-08 07:17:59 +00:00
|
|
|
|
type="danger"
|
2025-12-10 01:13:06 +00:00
|
|
|
|
@click="handleNoEdit(row)"
|
|
|
|
|
|
:disabled="row.approvalStatus != 0"
|
2025-12-08 07:17:59 +00:00
|
|
|
|
>
|
2025-12-10 01:13:06 +00:00
|
|
|
|
拒绝
|
2025-12-08 07:17:59 +00:00
|
|
|
|
</el-button>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
</el-table>
|
|
|
|
|
|
<div class="flex justify-end mt-4">
|
|
|
|
|
|
<pagination v-model="pager" @change="getLists" />
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</el-card>
|
|
|
|
|
|
<edit-popup v-if="showEdit" ref="editRef" @success="getLists" @close="showEdit = false" />
|
2025-12-10 01:13:06 +00:00
|
|
|
|
<base-popup ref="detailRef" />
|
2025-12-08 07:17:59 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup name="stuRegistration">
|
2025-12-10 01:13:06 +00:00
|
|
|
|
import {
|
|
|
|
|
|
stuRegistrationRegistration,
|
|
|
|
|
|
stuRegistrationRegistrationLists
|
|
|
|
|
|
} from '@/api/stuRegistration'
|
2025-12-08 07:17:59 +00:00
|
|
|
|
import { usePaging } from '@/hooks/usePaging'
|
2025-12-16 01:39:12 +00:00
|
|
|
|
import feedback from '@/utils/feedback'
|
2025-12-08 07:17:59 +00:00
|
|
|
|
|
2025-12-10 01:13:06 +00:00
|
|
|
|
import BasePopup from '../Base.vue'
|
2025-12-08 07:17:59 +00:00
|
|
|
|
import EditPopup from './edit.vue'
|
2025-12-16 01:39:12 +00:00
|
|
|
|
|
2025-12-08 07:17:59 +00:00
|
|
|
|
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
2025-12-10 01:13:06 +00:00
|
|
|
|
const detailRef = shallowRef<InstanceType<typeof BasePopup>>()
|
2025-12-08 07:17:59 +00:00
|
|
|
|
const showEdit = ref(false)
|
|
|
|
|
|
const queryParams = reactive({
|
2025-12-10 06:27:13 +00:00
|
|
|
|
name: '',
|
2025-12-08 07:17:59 +00:00
|
|
|
|
baseInfoId: '',
|
2025-12-10 01:13:06 +00:00
|
|
|
|
approvalStatus: '',
|
2025-12-08 07:17:59 +00:00
|
|
|
|
applicationNumber: '',
|
2025-12-10 01:13:06 +00:00
|
|
|
|
rejectionReason: '',
|
2025-12-08 07:17:59 +00:00
|
|
|
|
admissionStatus: '',
|
|
|
|
|
|
paymentStatus: '',
|
2025-12-10 01:13:06 +00:00
|
|
|
|
registrationStatus: 0,
|
2025-12-08 07:17:59 +00:00
|
|
|
|
applicationTimeStart: '',
|
2025-12-10 01:13:06 +00:00
|
|
|
|
applicationTimeEnd: ''
|
2025-12-08 07:17:59 +00:00
|
|
|
|
})
|
|
|
|
|
|
|
2025-12-10 01:13:06 +00:00
|
|
|
|
const formData = reactive({
|
2025-12-16 01:39:12 +00:00
|
|
|
|
id: [] as number[],
|
2025-12-10 01:13:06 +00:00
|
|
|
|
operation: 0,
|
|
|
|
|
|
reason: ''
|
|
|
|
|
|
})
|
2025-12-08 07:17:59 +00:00
|
|
|
|
|
|
|
|
|
|
const formatRegistrationStatus = (row: any, column: any, cellValue: any) => {
|
|
|
|
|
|
const statusMap: Record<string | number, string> = {
|
|
|
|
|
|
'0': '待审核',
|
|
|
|
|
|
'1': '已审核',
|
|
|
|
|
|
'2': '审核不通过'
|
|
|
|
|
|
}
|
2025-12-10 01:13:06 +00:00
|
|
|
|
const statusText = statusMap[String(cellValue)] || cellValue
|
|
|
|
|
|
// 当审核状态为2(不通过)时,显示拒绝原因
|
|
|
|
|
|
if (cellValue === 2 && row.rejectionReason) {
|
|
|
|
|
|
return `${statusText} : ${row.rejectionReason}`
|
|
|
|
|
|
}
|
|
|
|
|
|
return statusText
|
2025-12-08 07:17:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-12-10 06:27:13 +00:00
|
|
|
|
const formatGender = (value: number) => {
|
|
|
|
|
|
const map: Record<number, string> = {
|
|
|
|
|
|
0: '未知',
|
|
|
|
|
|
1: '男',
|
|
|
|
|
|
2: '女'
|
|
|
|
|
|
}
|
|
|
|
|
|
return map[value] || '未知'
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-12-08 07:17:59 +00:00
|
|
|
|
const { pager, getLists, resetPage, resetParams } = usePaging({
|
|
|
|
|
|
fetchFun: stuRegistrationRegistrationLists,
|
|
|
|
|
|
params: queryParams
|
|
|
|
|
|
})
|
|
|
|
|
|
|
2025-12-16 01:39:12 +00:00
|
|
|
|
// 存储所有选中的学生ID(跨分页)
|
|
|
|
|
|
const selectedIds = ref<number[]>([])
|
|
|
|
|
|
|
|
|
|
|
|
// 处理表格选择变化(同步跨分页选中状态)
|
|
|
|
|
|
const handleSelectionChange = (rows: any[]) => {
|
|
|
|
|
|
const currentPageSelectedIds = rows.map((row) => row.id)
|
|
|
|
|
|
const currentPageAllIds = pager.lists.map((row) => row.id)
|
|
|
|
|
|
currentPageAllIds.forEach((id) => {
|
|
|
|
|
|
if (!currentPageSelectedIds.includes(id)) {
|
|
|
|
|
|
const index = selectedIds.value.indexOf(id)
|
|
|
|
|
|
if (index > -1) {
|
|
|
|
|
|
selectedIds.value.splice(index, 1)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
currentPageSelectedIds.forEach((id) => {
|
|
|
|
|
|
if (!selectedIds.value.includes(id)) {
|
|
|
|
|
|
selectedIds.value.push(id)
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 表格实例引用
|
|
|
|
|
|
const tableRef = shallowRef<any>(null)
|
|
|
|
|
|
|
|
|
|
|
|
// 初始化选中状态(分页切换后回显)
|
|
|
|
|
|
const initSelection = async () => {
|
|
|
|
|
|
await nextTick()
|
|
|
|
|
|
if (!tableRef.value || !pager.lists.length) return
|
|
|
|
|
|
tableRef.value.clearSelection()
|
|
|
|
|
|
pager.lists.forEach((row: any) => {
|
|
|
|
|
|
if (selectedIds.value.includes(row.id)) {
|
|
|
|
|
|
tableRef.value.toggleRowSelection(row, true)
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 监听表格数据变化(分页切换/刷新后触发)
|
|
|
|
|
|
watch(
|
|
|
|
|
|
() => pager.lists,
|
|
|
|
|
|
() => {
|
|
|
|
|
|
initSelection()
|
|
|
|
|
|
},
|
|
|
|
|
|
{ deep: true }
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// 批量审核处理
|
|
|
|
|
|
const handleBatchApproval = async (operation: number) => {
|
|
|
|
|
|
let validIds: number[] = []
|
|
|
|
|
|
let tipText = ''
|
|
|
|
|
|
// 根据操作类型区分校验规则
|
|
|
|
|
|
switch (operation) {
|
|
|
|
|
|
case 0: // 批量撤销:只能操作 已审核(1)/审核不通过(2) 的记录
|
|
|
|
|
|
validIds = selectedIds.value.filter((id) => {
|
|
|
|
|
|
const row = pager.lists.find((item: any) => item.id === id)
|
|
|
|
|
|
return row && row.approvalStatus !== 0
|
|
|
|
|
|
})
|
|
|
|
|
|
tipText = '请选择已审核/审核不通过的学生进行撤销'
|
|
|
|
|
|
break
|
|
|
|
|
|
case 1: // 批量通过:只能操作 待审核(0) 的记录
|
|
|
|
|
|
validIds = selectedIds.value.filter((id) => {
|
|
|
|
|
|
const row = pager.lists.find((item: any) => item.id === id)
|
|
|
|
|
|
return row && row.approvalStatus === 0
|
|
|
|
|
|
})
|
|
|
|
|
|
tipText = '请选择待审核的学生进行通过操作'
|
|
|
|
|
|
break
|
|
|
|
|
|
case 2: // 批量拒绝:只能操作 待审核(0) 的记录
|
|
|
|
|
|
validIds = selectedIds.value.filter((id) => {
|
|
|
|
|
|
const row = pager.lists.find((item: any) => item.id === id)
|
|
|
|
|
|
return row && row.approvalStatus === 0
|
|
|
|
|
|
})
|
|
|
|
|
|
tipText = '请选择待审核的学生进行拒绝操作'
|
|
|
|
|
|
break
|
|
|
|
|
|
default:
|
|
|
|
|
|
return feedback.msgWarning('不支持的操作类型')
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 校验选中的有效数据
|
|
|
|
|
|
if (validIds.length === 0) {
|
|
|
|
|
|
return feedback.msgWarning(tipText)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
// 统一接口参数(和edit.vue保持一致,用ids数组)
|
|
|
|
|
|
await stuRegistrationRegistration({
|
|
|
|
|
|
id: validIds, // 替换原id为ids,和批量逻辑统一
|
|
|
|
|
|
operation
|
|
|
|
|
|
})
|
|
|
|
|
|
// 操作成功提示
|
|
|
|
|
|
const operationText = { 0: '撤销', 1: '通过', 2: '拒绝' }[operation]
|
|
|
|
|
|
feedback.msgSuccess(`批量${operationText}成功`)
|
|
|
|
|
|
// 清空选中状态 + 刷新列表
|
|
|
|
|
|
selectedIds.value = []
|
|
|
|
|
|
getLists()
|
|
|
|
|
|
} catch (err: any) {
|
|
|
|
|
|
feedback.msgError(`批量操作失败:${err.message || '服务器异常'}`)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-12-10 01:13:06 +00:00
|
|
|
|
const handleShowDetail = async (id: number) => {
|
2025-12-08 07:17:59 +00:00
|
|
|
|
await nextTick()
|
2025-12-10 01:13:06 +00:00
|
|
|
|
detailRef.value?.open(id)
|
2025-12-08 07:17:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-12-10 01:13:06 +00:00
|
|
|
|
const handleRoEdit = async (data: any) => {
|
2025-12-16 01:39:12 +00:00
|
|
|
|
formData.id[0] = data.id
|
2025-12-10 01:13:06 +00:00
|
|
|
|
formData.operation = 0
|
|
|
|
|
|
const editData: any = { ...formData }
|
|
|
|
|
|
await stuRegistrationRegistration(editData)
|
|
|
|
|
|
getLists()
|
2025-12-08 07:17:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-12-10 01:13:06 +00:00
|
|
|
|
const handleYesEdit = async (data: any) => {
|
2025-12-16 01:39:12 +00:00
|
|
|
|
formData.id = [data.id]
|
2025-12-10 01:13:06 +00:00
|
|
|
|
formData.operation = 1
|
|
|
|
|
|
const editData: any = { ...formData }
|
|
|
|
|
|
await stuRegistrationRegistration(editData)
|
2025-12-08 07:17:59 +00:00
|
|
|
|
getLists()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-12-10 01:13:06 +00:00
|
|
|
|
const handleNoEdit = async (data: any) => {
|
|
|
|
|
|
showEdit.value = true
|
|
|
|
|
|
await nextTick()
|
|
|
|
|
|
editRef.value?.open()
|
|
|
|
|
|
editRef.value?.getDetail(data)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-12-08 07:17:59 +00:00
|
|
|
|
getLists()
|
|
|
|
|
|
</script>
|