This commit is contained in:
2026-08-26 18:01:24 +08:00
2 changed files with 258 additions and 23 deletions
+247 -10
View File
@@ -69,7 +69,13 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" width="230" align="center" fixed="right"> <el-table-column label="操作" width="230" align="center" fixed="right">
<template slot-scope="{ row }"> <template slot-scope="{ row }">
<el-button v-if="!row.tjsj" type="text" size="small" icon="el-icon-upload2" @click="handleSubmit(row)">提交</el-button> <el-button
v-if="!row.tjsj"
type="text"
size="small"
icon="el-icon-upload2"
@click="handleSubmit(row)"
>提交</el-button>
<el-button v-else type="text" size="small" icon="el-icon-check" disabled>已提交</el-button> <el-button v-else type="text" size="small" icon="el-icon-check" disabled>已提交</el-button>
<el-button type="text" size="small" icon="el-icon-view" @click="handleDetail(row)">详情</el-button> <el-button type="text" size="small" icon="el-icon-view" @click="handleDetail(row)">详情</el-button>
<el-button type="text" size="small" icon="el-icon-edit" @click="handleEdit(row)">编辑</el-button> <el-button type="text" size="small" icon="el-icon-edit" @click="handleEdit(row)">编辑</el-button>
@@ -103,8 +109,19 @@
<el-form-item label="编号" prop="bh"> <el-form-item label="编号" prop="bh">
<el-input v-model="form.bh" placeholder="请输入编号" :disabled="!isAdd" /> <el-input v-model="form.bh" placeholder="请输入编号" :disabled="!isAdd" />
</el-form-item> </el-form-item>
<el-form-item label="学员编号" prop="xybh"> <el-form-item label="学号" prop="xh">
<el-input v-model="form.xybh" placeholder="请输入学员编号" /> <el-input
ref="studentNoInput"
v-model.trim="form.xh"
placeholder="请输入学号"
:disabled="studentVerifying"
@input="handleStudentNoInput"
@change="handleStudentNoComplete"
/>
<div v-if="isStudentVerified" class="student-verified-tip">
<i class="el-icon-circle-check" />
已核验{{ verifiedStudent.xm || verifiedStudent.xh || form.xh }}
</div>
</el-form-item> </el-form-item>
<el-form-item label="申请类型" prop="sqlx"> <el-form-item label="申请类型" prop="sqlx">
<el-select v-model="form.sqlx" placeholder="请选择申请类型" class="w-full"> <el-select v-model="form.sqlx" placeholder="请选择申请类型" class="w-full">
@@ -129,7 +146,39 @@
</div> </div>
</el-dialog> </el-dialog>
<!-- ==================== 4. 详情对话框 ==================== --> <!-- ==================== 4. 学员信息核验对话框 ==================== -->
<el-dialog
title="请确认学员信息"
:visible="studentConfirmVisible"
width="560px"
append-to-body
:close-on-click-modal="false"
@update:visible="val => studentConfirmVisible = val"
>
<el-alert
title="请核对以下信息,确认无误后再提交申请。"
type="info"
:closable="false"
show-icon
class="student-confirm-alert"
/>
<el-descriptions :column="2" border>
<el-descriptions-item label="学号">{{ pendingStudent.xh || '-' }}</el-descriptions-item>
<el-descriptions-item label="学员编号">{{ pendingStudent.bh || '-' }}</el-descriptions-item>
<el-descriptions-item label="姓名">{{ pendingStudent.xm || '-' }}</el-descriptions-item>
<el-descriptions-item label="性别">{{ studentSexLabel(pendingStudent.xb) }}</el-descriptions-item>
<el-descriptions-item label="学员队期编号">{{ pendingStudent.xydqbh || '-' }}</el-descriptions-item>
<el-descriptions-item label="当前班次编号">{{ pendingStudent.dqbzbh || '-' }}</el-descriptions-item>
<el-descriptions-item label="学员类别">{{ pendingStudent.xylb || '-' }}</el-descriptions-item>
<el-descriptions-item label="政治面貌">{{ pendingStudent.zzmm || '-' }}</el-descriptions-item>
</el-descriptions>
<div slot="footer">
<el-button @click="handleStudentReenter">重新输入</el-button>
<el-button type="primary" @click="handleStudentConfirm">确认无误</el-button>
</div>
</el-dialog>
<!-- ==================== 5. 详情对话框 ==================== -->
<el-dialog title="学籍异动申请详情" :visible="detailDialogVisible" width="760px" :close-on-click-modal="false" <el-dialog title="学籍异动申请详情" :visible="detailDialogVisible" width="760px" :close-on-click-modal="false"
@update:visible="val => detailDialogVisible = val"> @update:visible="val => detailDialogVisible = val">
<div v-loading="detailLoading" class="detail-body"> <div v-loading="detailLoading" class="detail-body">
@@ -168,9 +217,20 @@ import {
updateApplication, updateApplication,
delApplication delApplication
} from '@/api/studentRecords/application' } from '@/api/studentRecords/application'
import { getStudentRecord, listStudentRecord } from '@/api/studentRecords/studentRecords'
export default { export default {
name: 'StatusChangeIndex', name: 'StatusChangeIndex',
computed: {
isStudentVerified() {
const studentNo = this.normalizeStudentNo(this.form.xh)
return Boolean(
studentNo &&
studentNo === this.verifiedStudentNo &&
this.form.xybh === this.verifiedStudent.bh
)
}
},
data() { data() {
return { return {
// ==================== 申请类型选项(学籍异动) ==================== // ==================== 申请类型选项(学籍异动) ====================
@@ -203,10 +263,15 @@ export default {
dialogTitle: '新增学籍异动申请', dialogTitle: '新增学籍异动申请',
isAdd: true, isAdd: true,
formSaving: false, formSaving: false,
studentVerifying: false,
studentConfirmVisible: false,
pendingStudent: {},
verifiedStudent: {},
verifiedStudentNo: '',
form: this.createEmptyForm(), form: this.createEmptyForm(),
formRules: { formRules: {
bh: [{ required: true, message: '请输入编号', trigger: 'blur' }], bh: [{ required: true, message: '请输入编号', trigger: 'blur' }],
xybh: [{ required: true, message: '请输入学员编号', trigger: 'blur' }], xh: [{ required: true, message: '请输入学号', trigger: 'blur' }],
sqlx: [{ required: true, message: '请选择申请类型', trigger: 'change' }], sqlx: [{ required: true, message: '请选择申请类型', trigger: 'change' }],
sy: [{ required: true, message: '请输入事由', trigger: 'blur' }], sy: [{ required: true, message: '请输入事由', trigger: 'blur' }],
zt: [{ required: true, message: '请选择状态', trigger: 'change' }] zt: [{ required: true, message: '请选择状态', trigger: 'change' }]
@@ -225,6 +290,7 @@ export default {
createEmptyForm() { createEmptyForm() {
return { return {
bh: '', bh: '',
xh: '',
xybh: '', xybh: '',
sqlx: '', sqlx: '',
sy: '', sy: '',
@@ -248,6 +314,19 @@ export default {
return item ? item.type : 'info' return item ? item.type : 'info'
}, },
studentSexLabel(value) {
if (value === '' || value === null || value === undefined) {
return '-'
}
if (String(value) === '1') {
return '男'
}
if (String(value) === '0') {
return '女'
}
return String(value)
},
// ==================== 查询列表 ==================== // ==================== 查询列表 ====================
fetchList() { fetchList() {
this.loading = true this.loading = true
@@ -304,6 +383,7 @@ export default {
this.isAdd = true this.isAdd = true
this.dialogTitle = '新增学籍异动申请' this.dialogTitle = '新增学籍异动申请'
this.form = this.createEmptyForm() this.form = this.createEmptyForm()
this.resetStudentVerification()
this.formDialogVisible = true this.formDialogVisible = true
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.formRef && this.$refs.formRef.clearValidate() this.$refs.formRef && this.$refs.formRef.clearValidate()
@@ -314,6 +394,7 @@ export default {
this.isAdd = false this.isAdd = false
this.dialogTitle = '编辑学籍异动申请' this.dialogTitle = '编辑学籍异动申请'
this.form = this.createEmptyForm() this.form = this.createEmptyForm()
this.resetStudentVerification()
this.formDialogVisible = true this.formDialogVisible = true
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.formRef && this.$refs.formRef.clearValidate() this.$refs.formRef && this.$refs.formRef.clearValidate()
@@ -322,15 +403,143 @@ export default {
const data = response.data || {} const data = response.data || {}
this.form = { this.form = {
bh: data.bh || '', bh: data.bh || '',
xh: '',
xybh: data.xybh || '', xybh: data.xybh || '',
sqlx: data.sqlx || '', sqlx: data.sqlx || '',
sy: data.sy || '', sy: data.sy || '',
bz: data.bz || '', bz: data.bz || '',
zt: data.zt !== null && data.zt !== undefined ? Number(data.zt) : 0 zt: data.zt !== null && data.zt !== undefined ? Number(data.zt) : 0
} }
this.loadExistingStudent(data.xybh)
}).catch(() => {}) }).catch(() => {})
}, },
normalizeStudentNo(value) {
return value === null || value === undefined ? '' : String(value).trim()
},
resetStudentVerification() {
this.studentVerifying = false
this.studentConfirmVisible = false
this.pendingStudent = {}
this.verifiedStudent = {}
this.verifiedStudentNo = ''
},
handleStudentNoInput() {
const studentNo = this.normalizeStudentNo(this.form.xh)
if (studentNo !== this.verifiedStudentNo) {
this.verifiedStudent = {}
this.verifiedStudentNo = ''
this.form.xybh = ''
}
this.pendingStudent = {}
},
handleStudentNoComplete() {
if (this.normalizeStudentNo(this.form.xh)) {
this.loadStudentForConfirmation()
}
},
async loadStudentForConfirmation() {
if (this.studentVerifying) {
return false
}
const studentNo = this.normalizeStudentNo(this.form.xh)
if (!studentNo) {
this.$refs.formRef && this.$refs.formRef.validateField('xh')
return false
}
if (studentNo === this.verifiedStudentNo && this.verifiedStudent.bh) {
this.pendingStudent = { ...this.verifiedStudent }
this.studentConfirmVisible = true
return true
}
this.studentVerifying = true
try {
const response = await listStudentRecord({ pageNum: 1, pageSize: 2, xh: studentNo })
const records = response.data && Array.isArray(response.data.records) ? response.data.records : []
// 请求返回前用户可能已经修改了学号,旧结果不能覆盖当前输入。
if (studentNo !== this.normalizeStudentNo(this.form.xh)) {
return false
}
if (records.length === 0) {
this.$message.warning('未查询到该学号对应的学员,请核对学号')
this.resetStudentVerification()
return false
}
if (records.length > 1) {
this.$message.warning('该学号匹配到多名学员,请联系管理员检查学员数据')
this.resetStudentVerification()
return false
}
this.pendingStudent = records[0]
this.studentConfirmVisible = true
return true
} catch (error) {
if (studentNo === this.normalizeStudentNo(this.form.xh)) {
this.resetStudentVerification()
}
return false
} finally {
this.studentVerifying = false
}
},
handleStudentConfirm() {
const studentNo = this.normalizeStudentNo(this.form.xh)
if (!this.pendingStudent.bh || this.normalizeStudentNo(this.pendingStudent.xh) !== studentNo) {
this.$message.warning('学号已变化,请重新核验')
this.studentConfirmVisible = false
return
}
this.verifiedStudent = { ...this.pendingStudent }
this.verifiedStudentNo = studentNo
this.form.xybh = this.pendingStudent.bh
this.studentConfirmVisible = false
this.$refs.formRef && this.$refs.formRef.clearValidate('xh')
this.$message.success('学员信息核验成功')
},
handleStudentReenter() {
this.studentConfirmVisible = false
this.pendingStudent = {}
this.verifiedStudent = {}
this.verifiedStudentNo = ''
this.form.xybh = ''
this.$nextTick(() => {
const input = this.$refs.studentNoInput
input && input.focus()
})
},
async loadExistingStudent(studentId) {
const normalizedStudentId = this.normalizeStudentNo(studentId)
if (!normalizedStudentId) {
return
}
this.studentVerifying = true
try {
const response = await getStudentRecord(normalizedStudentId)
const student = response.data || {}
if (this.form.xybh !== normalizedStudentId || !student.bh) {
return
}
this.form.xh = student.xh || ''
this.verifiedStudentNo = this.normalizeStudentNo(student.xh)
this.verifiedStudent = student
} catch (error) {
this.$message.warning('未能加载原申请的学员信息,请重新输入学号核验')
} finally {
this.studentVerifying = false
}
},
buildPayload() { buildPayload() {
const f = this.form const f = this.form
const payload = { const payload = {
@@ -347,9 +556,21 @@ export default {
return payload return payload
}, },
handleFormSubmit() { async handleFormSubmit() {
this.$refs.formRef.validate(valid => { const isValid = await new Promise(resolve => {
if (!valid) return this.$refs.formRef.validate(valid => resolve(valid))
})
if (!isValid) {
return
}
if (!this.isStudentVerified) {
const isFound = await this.loadStudentForConfirmation()
if (isFound) {
this.$message.warning('请先确认学员信息,再提交申请')
}
return
}
this.formSaving = true this.formSaving = true
const payload = this.buildPayload() const payload = this.buildPayload()
const request = this.isAdd ? addApplication(payload) : updateApplication(payload) const request = this.isAdd ? addApplication(payload) : updateApplication(payload)
@@ -361,7 +582,6 @@ export default {
}).finally(() => { }).finally(() => {
this.formSaving = false this.formSaving = false
}) })
})
}, },
// ==================== 提交 ==================== // ==================== 提交 ====================
@@ -369,7 +589,9 @@ export default {
formatNow() { formatNow() {
const d = new Date() const d = new Date()
const pad = n => String(n).padStart(2, '0') const pad = n => String(n).padStart(2, '0')
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}` const date = `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`
const time = `${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`
return `${date} ${time}`
}, },
handleSubmit(row) { handleSubmit(row) {
@@ -486,9 +708,24 @@ export default {
padding-right: 4px; padding-right: 4px;
} }
.student-verified-tip {
margin-top: 4px;
color: #078267;
font-size: 12px;
line-height: 20px;
i {
margin-right: 4px;
}
}
.text-danger { .text-danger {
color: #f56c6c; color: #f56c6c;
padding: 0; padding: 0;
} }
} }
.student-confirm-alert {
margin-bottom: 16px;
}
</style> </style>
@@ -108,10 +108,8 @@
<el-table-column prop="xb" label="性别" width="55" align="center" /> <el-table-column prop="xb" label="性别" width="55" align="center" />
<el-table-column prop="nj" label="年级" width="55" align="center" /> <el-table-column prop="nj" label="年级" width="55" align="center" />
<el-table-column prop="zy" label="专业" width="55" show-overflow-tooltip /> <el-table-column prop="zy" label="专业" width="55" show-overflow-tooltip />
<el-table-column prop="db" label="别" width="55" align="center" /> <el-table-column prop="xylb" label="学员类别" width="90" align="center" show-overflow-tooltip />
<el-table-column prop="bc" label="班次" width="55" align="center" /> <el-table-column prop="bc" label="班次" width="55" align="center" />
<el-table-column prop="pxlx" label="培训类型" width="85" show-overflow-tooltip />
<el-table-column prop="pxcc" label="培训层次" width="85" align="center" />
<el-table-column prop="zzmm" label="政治面貌" width="85" align="center" /> <el-table-column prop="zzmm" label="政治面貌" width="85" align="center" />
<el-table-column prop="mz" label="民族" width="55" align="center" /> <el-table-column prop="mz" label="民族" width="55" align="center" />
<el-table-column prop="jg" label="籍贯" width="90" align="center" show-overflow-tooltip /> <el-table-column prop="jg" label="籍贯" width="90" align="center" show-overflow-tooltip />