优化界面
This commit is contained in:
parent
eb72b0467d
commit
5a0246abfb
|
|
@ -9,3 +9,8 @@ export function authclass(params?: Record<string, any>) {
|
||||||
export function confirm(params?: Record<string, any>) {
|
export function confirm(params?: Record<string, any>) {
|
||||||
return request.post({ url: '/class/assign/confirm', params })
|
return request.post({ url: '/class/assign/confirm', params })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 分班列表
|
||||||
|
export function assignlist(params?: Record<string, any>) {
|
||||||
|
return request.get({ url: '/class/assign/list', params })
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,3 +24,13 @@ export function classEdit(params: Record<string, any>) {
|
||||||
export function classDelete(params: Record<string, any>) {
|
export function classDelete(params: Record<string, any>) {
|
||||||
return request.post({ url: '/class/del', params })
|
return request.post({ url: '/class/del', params })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 矫正班级人数
|
||||||
|
export function classCheck(params: Record<string, any>) {
|
||||||
|
return request.post({ url: '/class/check', params })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 矫正全部班级人数
|
||||||
|
export function classCheckAll() {
|
||||||
|
return request.post({ url: '/class/check.all' })
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,11 +68,14 @@
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-table class="mt-4" size="large" v-loading="loading" :data="resultList">
|
<el-table class="mt-4" size="large" v-loading="pager.loading" :data="pager.lists">
|
||||||
|
<el-table-column label="班级代码" prop="classCode" min-width="150" />
|
||||||
<el-table-column label="班级名称" prop="className" min-width="150" />
|
<el-table-column label="班级名称" prop="className" min-width="150" />
|
||||||
|
<el-table-column label="报名编号" prop="applicationNumberCode" min-width="150" />
|
||||||
<el-table-column label="学生姓名" prop="studentName" min-width="150" />
|
<el-table-column label="学生姓名" prop="studentName" min-width="150" />
|
||||||
<el-table-column label="分配方式" prop="modelName" min-width="150" />
|
<el-table-column label="分班操作人姓名" prop="assignName" min-width="150" />
|
||||||
<el-table-column label="分配时间" prop="assignTime" min-width="180" />
|
<el-table-column label="分配时间" prop="createTime" min-width="180" />
|
||||||
|
<el-table-column label="是否锁定" prop="locked" min-width="180" />
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<div class="flex justify-end mt-4" v-if="resultList.length > 0">
|
<div class="flex justify-end mt-4" v-if="resultList.length > 0">
|
||||||
|
|
@ -99,8 +102,7 @@
|
||||||
<script lang="ts" setup name="classDivide">
|
<script lang="ts" setup name="classDivide">
|
||||||
import { reactive, ref, shallowRef } from 'vue'
|
import { reactive, ref, shallowRef } from 'vue'
|
||||||
|
|
||||||
import { authclass } from '@/api/assign'
|
import { assignlist, authclass } from '@/api/assign'
|
||||||
import { classLists } from '@/api/class'
|
|
||||||
import { usePaging } from '@/hooks/usePaging'
|
import { usePaging } from '@/hooks/usePaging'
|
||||||
import feedback from '@/utils/feedback'
|
import feedback from '@/utils/feedback'
|
||||||
|
|
||||||
|
|
@ -152,7 +154,7 @@ const handleStudentSelect = (selectedIds: number[]) => {
|
||||||
|
|
||||||
// 分页配置
|
// 分页配置
|
||||||
const { pager, getLists: getResultList } = usePaging({
|
const { pager, getLists: getResultList } = usePaging({
|
||||||
fetchFun: classLists, // 替换为实际的分班结果接口
|
fetchFun: assignlist,
|
||||||
params: reactive({ page: 1, limit: 10 })
|
params: reactive({ page: 1, limit: 10 })
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="resetPage">查询</el-button>
|
<el-button type="primary" @click="resetPage">查询</el-button>
|
||||||
<el-button @click="resetParams">重置</el-button>
|
<el-button @click="resetParams">重置</el-button>
|
||||||
|
<el-button type="primary" @click="classCheckAll()">矫正全部班级人数</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
@ -89,6 +90,14 @@
|
||||||
学生信息
|
学生信息
|
||||||
</router-link>
|
</router-link>
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-perms="['class:check']"
|
||||||
|
type="primary"
|
||||||
|
link
|
||||||
|
@click="handleCheck(row)"
|
||||||
|
>
|
||||||
|
矫正班级人数
|
||||||
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-perms="['class:edit']"
|
v-perms="['class:edit']"
|
||||||
type="primary"
|
type="primary"
|
||||||
|
|
@ -116,7 +125,7 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup name="class">
|
<script lang="ts" setup name="class">
|
||||||
import { classDelete, classLists } from '@/api/class'
|
import { classCheck, classCheckAll, classDelete, classLists } from '@/api/class'
|
||||||
import { collegeLists } from '@/api/college'
|
import { collegeLists } from '@/api/college'
|
||||||
import { majorLists } from '@/api/major'
|
import { majorLists } from '@/api/major'
|
||||||
import { usePaging } from '@/hooks/usePaging'
|
import { usePaging } from '@/hooks/usePaging'
|
||||||
|
|
@ -179,6 +188,11 @@ const handleAdd = async () => {
|
||||||
editRef.value?.open('add')
|
editRef.value?.open('add')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleCheck = async (id: any) => {
|
||||||
|
await classCheck(id)
|
||||||
|
await getLists()
|
||||||
|
}
|
||||||
|
|
||||||
const handleEdit = async (data: any) => {
|
const handleEdit = async (data: any) => {
|
||||||
showEdit.value = true
|
showEdit.value = true
|
||||||
await nextTick()
|
await nextTick()
|
||||||
|
|
|
||||||
|
|
@ -38,11 +38,9 @@ const formRef = shallowRef<FormInstance>()
|
||||||
const popupRef = shallowRef<InstanceType<typeof Popup>>()
|
const popupRef = shallowRef<InstanceType<typeof Popup>>()
|
||||||
|
|
||||||
const formData = reactive({
|
const formData = reactive({
|
||||||
id: '',
|
id: [] as number[],
|
||||||
operation: 2,
|
operation: 2,
|
||||||
reason: '',
|
reason: ''
|
||||||
applicationNumber: '',
|
|
||||||
baseInfoId: 0
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const formRules = {
|
const formRules = {
|
||||||
|
|
@ -71,8 +69,8 @@ const setFormData = async (data: Record<string, any>) => {
|
||||||
for (const key in formData) {
|
for (const key in formData) {
|
||||||
if (data[key] != null && data[key] != undefined) {
|
if (data[key] != null && data[key] != undefined) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
formData[key] = data[key]
|
formData.id = [data.id]
|
||||||
formData['reason'] = data['rejectionReason']
|
formData['reason'] = data['reason']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,13 +33,42 @@
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card class="!border-none mt-4" shadow="never">
|
<el-card class="!border-none mt-4" shadow="never">
|
||||||
|
<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>
|
||||||
<el-table
|
<el-table
|
||||||
|
ref="tableRef"
|
||||||
class="mt-4"
|
class="mt-4"
|
||||||
size="large"
|
size="large"
|
||||||
v-loading="pager.loading"
|
v-loading="pager.loading"
|
||||||
:data="pager.lists"
|
:data="pager.lists"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
border
|
border
|
||||||
>
|
>
|
||||||
|
<el-table-column type="selection" width="55" />
|
||||||
<el-table-column label="报名编号" min-width="100">
|
<el-table-column label="报名编号" min-width="100">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-button
|
<el-button
|
||||||
|
|
@ -109,9 +138,11 @@ import {
|
||||||
stuRegistrationRegistrationLists
|
stuRegistrationRegistrationLists
|
||||||
} from '@/api/stuRegistration'
|
} from '@/api/stuRegistration'
|
||||||
import { usePaging } from '@/hooks/usePaging'
|
import { usePaging } from '@/hooks/usePaging'
|
||||||
|
import feedback from '@/utils/feedback'
|
||||||
|
|
||||||
import BasePopup from '../Base.vue'
|
import BasePopup from '../Base.vue'
|
||||||
import EditPopup from './edit.vue'
|
import EditPopup from './edit.vue'
|
||||||
|
|
||||||
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
||||||
const detailRef = shallowRef<InstanceType<typeof BasePopup>>()
|
const detailRef = shallowRef<InstanceType<typeof BasePopup>>()
|
||||||
const showEdit = ref(false)
|
const showEdit = ref(false)
|
||||||
|
|
@ -129,7 +160,7 @@ const queryParams = reactive({
|
||||||
})
|
})
|
||||||
|
|
||||||
const formData = reactive({
|
const formData = reactive({
|
||||||
id: '',
|
id: [] as number[],
|
||||||
operation: 0,
|
operation: 0,
|
||||||
reason: ''
|
reason: ''
|
||||||
})
|
})
|
||||||
|
|
@ -162,13 +193,113 @@ const { pager, getLists, resetPage, resetParams } = usePaging({
|
||||||
params: queryParams
|
params: queryParams
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 存储所有选中的学生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 || '服务器异常'}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const handleShowDetail = async (id: number) => {
|
const handleShowDetail = async (id: number) => {
|
||||||
await nextTick()
|
await nextTick()
|
||||||
detailRef.value?.open(id)
|
detailRef.value?.open(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleRoEdit = async (data: any) => {
|
const handleRoEdit = async (data: any) => {
|
||||||
formData.id = data.id
|
formData.id[0] = data.id
|
||||||
formData.operation = 0
|
formData.operation = 0
|
||||||
const editData: any = { ...formData }
|
const editData: any = { ...formData }
|
||||||
await stuRegistrationRegistration(editData)
|
await stuRegistrationRegistration(editData)
|
||||||
|
|
@ -176,7 +307,7 @@ const handleRoEdit = async (data: any) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleYesEdit = async (data: any) => {
|
const handleYesEdit = async (data: any) => {
|
||||||
formData.id = data.id
|
formData.id = [data.id]
|
||||||
formData.operation = 1
|
formData.operation = 1
|
||||||
const editData: any = { ...formData }
|
const editData: any = { ...formData }
|
||||||
await stuRegistrationRegistration(editData)
|
await stuRegistrationRegistration(editData)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue