wuzhen 提交代码

This commit is contained in:
wuzhen committed 2025-07-16 18:11:31 +08:00
1 parent 913e542e7c
commit 6820ebc45f
97 files changed
+27269 -1

No files matched your search

+447
View File
@@ -0,0 +1,447 @@
import request from '@/utils/request'
import { AxiosPromise } from 'axios'
// 学生信息数据类型
export interface StudentInfo {
id?: number
studentNo?: string
name?: string
nameEnglish?: string
formerName?: string
namePinyin?: string
gender?: string
birthDate?: string
idCard?: string
phone?: string
email?: string
nation?: string
politicalStatus?: string
maritalStatus?: string
religion?: string
photoUrl?: string
photoPath?: string
majorCode?: string
majorName?: string
classCode?: string
className?: string
collegeCode?: string
collegeName?: string
grade?: string
enrollmentYear?: number
enrollmentDate?: string
schoolSystem?: number
educationLevel?: string
trainingType?: string
admissionCategory?: string
sourceRegion?: string
middleSchool?: string
studentStatus?: string
infoStatus?: string
counselorName?: string
classTeacherName?: string
qq?: string
wechat?: string
dormitoryBuilding?: string
dormitoryRoom?: string
homeAddress?: string
currentAddress?: string
postalCode?: string
householdRegisterType?: string
hukouLocation?: string
height?: number
weight?: number
bloodType?: string
healthStatus?: string
specialCondition?: string
medicalHistory?: string
allergies?: string
disabilityType?: string
disabilityLevel?: string
emergencyContactName?: string
emergencyContactPhone?: string
emergencyContactRelation?: string
fatherName?: string
fatherPhone?: string
fatherWorkUnit?: string
motherName?: string
motherPhone?: string
motherWorkUnit?: string
guardianName?: string
guardianPhone?: string
guardianRelation?: string
familyIncome?: string
familyEconomicStatus?: string
familyMembers?: number
bankCardNo?: string
bankName?: string
bankBranch?: string
cardHolderName?: string
isPoorStudent?: number
isMinority?: number
isDisabled?: number
isOrphan?: number
isLeftBehindChild?: number
isSingleChild?: number
hasLoan?: number
loanAmount?: number
specialties?: string
awards?: string
violations?: string
socialActivities?: string
dataSource?: string
lastAuditTime?: string
isComplete?: number
completionRate?: number
extField1?: string
extField2?: string
extField3?: string
extField4?: string
extField5?: string
remark?: string
createTime?: string
updateTime?: string
}
// 查询参数类型
export interface StudentQuery {
pageNum?: number
pageSize?: number
studentNo?: string
name?: string
gender?: string
idCard?: string
majorCode?: string
majorName?: string
classCode?: string
className?: string
collegeCode?: string
collegeName?: string
grade?: string
enrollmentYear?: number
studentStatus?: string
infoStatus?: string
counselorId?: number
classTeacherId?: number
}
// 统计数据类型
export interface StatisticsData {
totalCount?: number
activeCount?: number
completeCount?: number
pendingCount?: number
maleCount?: number
femaleCount?: number
}
// 选项数据类型
export interface OptionData {
value: string | number
label: string
code?: string
[key: string]: any
}
// 查询学生信息列表
export function listStudents(query: StudentQuery): AxiosPromise<any> {
return request({
url: '/xg/studentInfo/list',
method: 'get',
params: query
})
}
// 获取学生信息详情
export function getStudent(id: number): AxiosPromise<StudentInfo> {
return request({
url: `/xg/studentInfo/${id}`,
method: 'get'
})
}
// 根据学号查询学生信息
export function getStudentByNo(studentNo: string): AxiosPromise<StudentInfo> {
return request({
url: `/xg/studentInfo/studentNo/${studentNo}`,
method: 'get'
})
}
// 根据身份证号查询学生信息
export function getStudentByIdCard(idCard: string): AxiosPromise<StudentInfo> {
return request({
url: `/xg/studentInfo/idCard/${idCard}`,
method: 'get'
})
}
// 根据班级代码查询学生列表
export function getStudentsByClass(classCode: string): AxiosPromise<StudentInfo[]> {
return request({
url: `/xg/studentInfo/class/${classCode}`,
method: 'get'
})
}
// 根据学院代码查询学生列表
export function getStudentsByCollege(collegeCode: string): AxiosPromise<StudentInfo[]> {
return request({
url: `/xg/studentInfo/college/${collegeCode}`,
method: 'get'
})
}
// 新增学生信息
export function addStudent(data: StudentInfo): AxiosPromise<any> {
return request({
url: '/xg/studentInfo',
method: 'post',
data: data
})
}
// 修改学生信息
export function updateStudent(data: StudentInfo): AxiosPromise<any> {
return request({
url: '/xg/studentInfo',
method: 'put',
data: data
})
}
// 删除学生信息
export function delStudent(ids: number[]): AxiosPromise<any> {
return request({
url: `/xg/studentInfo/${ids.join(',')}`,
method: 'delete'
})
}
// 导出学生信息
export function exportStudents(query: StudentQuery): AxiosPromise<any> {
return request({
url: '/xg/studentInfo/export',
method: 'post',
data: query,
responseType: 'blob'
})
}
// 批量导入学生信息
export function importStudents(data: any): AxiosPromise<any> {
return request({
url: '/xg/studentInfo/import',
method: 'post',
data: data
})
}
// 获取导入模板
export function getImportTemplate(): AxiosPromise<any> {
return request({
url: '/xg/studentInfo/importTemplate',
method: 'post',
responseType: 'blob'
})
}
// 批量更新学生信息状态
export function batchUpdateInfoStatus(studentIds: number[], infoStatus: string): AxiosPromise<any> {
return request({
url: '/xg/studentInfo/batchUpdateInfoStatus',
method: 'put',
data: { studentIds, infoStatus }
})
}
// 批量更新学生学籍状态
export function batchUpdateStudentStatus(studentIds: number[], studentStatus: string): AxiosPromise<any> {
return request({
url: '/xg/studentInfo/batchUpdateStudentStatus',
method: 'put',
data: { studentIds, studentStatus }
})
}
// 审核学生信息
export function auditStudent(studentId: number, auditStatus: string, auditRemark?: string): AxiosPromise<any> {
return request({
url: `/xg/studentInfo/${studentId}/audit`,
method: 'put',
params: { auditStatus, auditRemark }
})
}
// 批量审核学生信息
export function batchAuditStudents(studentIds: number[], auditStatus: string, auditRemark?: string): AxiosPromise<any> {
return request({
url: '/xg/studentInfo/batchAudit',
method: 'put',
data: { studentIds, auditStatus, auditRemark }
})
}
// ================================
// 统计相关接口
// ================================
// 获取统计概览
export function getStatisticsOverview(): AxiosPromise<StatisticsData> {
return request({
url: '/xg/studentInfo/statistics/overview',
method: 'get'
})
}
// 统计各学院学生数量
export function getCollegeStatistics(): AxiosPromise<any[]> {
return request({
url: '/xg/studentInfo/statistics/college',
method: 'get'
})
}
// 统计各年级学生数量
export function getGradeStatistics(): AxiosPromise<any[]> {
return request({
url: '/xg/studentInfo/statistics/grade',
method: 'get'
})
}
// 统计各专业学生数量
export function getMajorStatistics(): AxiosPromise<any[]> {
return request({
url: '/xg/studentInfo/statistics/major',
method: 'get'
})
}
// 统计学籍状态分布
export function getStudentStatusStatistics(): AxiosPromise<any[]> {
return request({
url: '/xg/studentInfo/statistics/studentStatus',
method: 'get'
})
}
// 统计信息完整度分布
export function getCompletionRateStatistics(): AxiosPromise<any[]> {
return request({
url: '/xg/studentInfo/statistics/completionRate',
method: 'get'
})
}
// 查询信息不完整的学生列表
export function getIncompleteStudents(): AxiosPromise<StudentInfo[]> {
return request({
url: '/xg/studentInfo/incomplete',
method: 'get'
})
}
// 查询待审核的学生列表
export function getPendingAuditStudents(): AxiosPromise<StudentInfo[]> {
return request({
url: '/xg/studentInfo/pendingAudit',
method: 'get'
})
}
// 生成学生信息报表
export function generateReport(reportType: string, params?: any): AxiosPromise<any> {
return request({
url: `/xg/studentInfo/report/${reportType}`,
method: 'get',
params: params
})
}
// ================================
// 选项数据接口
// ================================
// 获取学院选项
export function getCollegeOptions(): AxiosPromise<OptionData[]> {
return request({
url: '/xg/studentInfo/options/colleges',
method: 'get'
})
}
// 获取专业选项
export function getMajorOptions(collegeCode?: string): AxiosPromise<OptionData[]> {
return request({
url: '/xg/studentInfo/options/majors',
method: 'get',
params: { collegeCode }
})
}
// 获取班级选项
export function getClassOptions(majorCode?: string): AxiosPromise<OptionData[]> {
return request({
url: '/xg/studentInfo/options/classes',
method: 'get',
params: { majorCode }
})
}
// 获取辅导员选项
export function getCounselorOptions(): AxiosPromise<OptionData[]> {
return request({
url: '/xg/studentInfo/options/counselors',
method: 'get'
})
}
// 获取班主任选项
export function getClassTeacherOptions(): AxiosPromise<OptionData[]> {
return request({
url: '/xg/studentInfo/options/classTeachers',
method: 'get'
})
}
// 检查学号是否存在
export function checkStudentNo(studentNo: string, studentId?: number): AxiosPromise<boolean> {
return request({
url: '/xg/studentInfo/checkStudentNo',
method: 'get',
params: { studentNo, studentId }
})
}
// 检查身份证号是否存在
export function checkIdCard(idCard: string, studentId?: number): AxiosPromise<boolean> {
return request({
url: '/xg/studentInfo/checkIdCard',
method: 'get',
params: { idCard, studentId }
})
}
// 查询重复学号的学生列表
export function getDuplicateStudentNo(): AxiosPromise<any[]> {
return request({
url: '/xg/studentInfo/duplicateStudentNo',
method: 'get'
})
}
// 查询重复身份证号的学生列表
export function getDuplicateIdCard(): AxiosPromise<any[]> {
return request({
url: '/xg/studentInfo/duplicateIdCard',
method: 'get'
})
}
// 更新学生信息完整度
export function updateCompletionRate(studentId: number): AxiosPromise<any> {
return request({
url: `/xg/studentInfo/${studentId}/updateCompletionRate`,
method: 'put'
})
}
+523
View File
@@ -0,0 +1,523 @@
// 学生信息管理模块类型定义
// 学生信息完整数据结构
export interface StudentInfoVo {
id?: number
studentNo?: string
idCard?: string
name?: string
nameEnglish?: string
formerName?: string
namePinyin?: string
gender?: string
birthDate?: string
nation?: string
politicalStatus?: string
maritalStatus?: string
religion?: string
photoUrl?: string
photoPath?: string
studentStatus?: string
enrollmentYear?: number
enrollmentDate?: string
schoolSystem?: number
educationLevel?: string
trainingType?: string
majorCode?: string
majorName?: string
classCode?: string
className?: string
collegeCode?: string
collegeName?: string
grade?: string
counselorId?: number
counselorName?: string
classTeacherId?: number
classTeacherName?: string
phone?: string
email?: string
qq?: string
wechat?: string
dormBuilding?: string
dormRoom?: string
homeAddress?: string
emergencyContact?: string
emergencyPhone?: string
emergencyRelation?: string
fatherName?: string
fatherPhone?: string
fatherJob?: string
motherName?: string
motherPhone?: string
motherJob?: string
familyIncome?: string
familyMembers?: number
height?: number
weight?: number
bloodType?: string
healthStatus?: string
allergies?: string
medicalHistory?: string
bankCardNo?: string
bankName?: string
bankBranch?: string
cardholderName?: string
isFromPoorFamily?: boolean
isMinority?: boolean
isDisabled?: boolean
isOrphan?: boolean
isLeftBehind?: boolean
isOnlyChild?: boolean
specialTalents?: string
awards?: string
violations?: string
socialActivities?: string
infoStatus?: string
dataSource?: string
lastBatchId?: number
lastAuditTime?: string
isComplete?: boolean
completionRate?: number
remark?: string
createBy?: number
createTime?: string
updateBy?: number
updateTime?: string
createDept?: number
tenantId?: string
deleted?: boolean
}
// 学生信息查询参数
export interface StudentQueryBo {
pageNum?: number
pageSize?: number
studentNo?: string
name?: string
gender?: string
idCard?: string
nation?: string
politicalStatus?: string
majorCode?: string
majorName?: string
classCode?: string
className?: string
collegeCode?: string
collegeName?: string
grade?: string
enrollmentYear?: number
studentStatus?: string
infoStatus?: string
counselorId?: number
classTeacherId?: number
phone?: string
email?: string
dormBuilding?: string
dormRoom?: string
isFromPoorFamily?: boolean
isMinority?: boolean
isDisabled?: boolean
isOrphan?: boolean
isComplete?: boolean
completionRateMin?: number
completionRateMax?: number
createTimeBegin?: string
createTimeEnd?: string
updateTimeBegin?: string
updateTimeEnd?: string
}
// 学生信息新增/编辑参数
export interface StudentInfoBo {
id?: number
studentNo?: string
idCard?: string
name?: string
nameEnglish?: string
formerName?: string
namePinyin?: string
gender?: string
birthDate?: string
nation?: string
politicalStatus?: string
maritalStatus?: string
religion?: string
photoUrl?: string
photoPath?: string
studentStatus?: string
enrollmentYear?: number
enrollmentDate?: string
schoolSystem?: number
educationLevel?: string
trainingType?: string
majorCode?: string
majorName?: string
classCode?: string
className?: string
collegeCode?: string
collegeName?: string
grade?: string
counselorId?: number
counselorName?: string
classTeacherId?: number
classTeacherName?: string
phone?: string
email?: string
qq?: string
wechat?: string
dormBuilding?: string
dormRoom?: string
homeAddress?: string
emergencyContact?: string
emergencyPhone?: string
emergencyRelation?: string
fatherName?: string
fatherPhone?: string
fatherJob?: string
motherName?: string
motherPhone?: string
motherJob?: string
familyIncome?: string
familyMembers?: number
height?: number
weight?: number
bloodType?: string
healthStatus?: string
allergies?: string
medicalHistory?: string
bankCardNo?: string
bankName?: string
bankBranch?: string
cardholderName?: string
isFromPoorFamily?: boolean
isMinority?: boolean
isDisabled?: boolean
isOrphan?: boolean
isLeftBehind?: boolean
isOnlyChild?: boolean
specialTalents?: string
awards?: string
violations?: string
socialActivities?: string
infoStatus?: string
dataSource?: string
remark?: string
}
// 统计数据结构
export interface StatisticsOverview {
totalCount?: number
activeCount?: number
completeCount?: number
pendingCount?: number
maleCount?: number
femaleCount?: number
graduatedCount?: number
suspendedCount?: number
poorFamilyCount?: number
minorityCount?: number
disabledCount?: number
orphanCount?: number
}
// 学院统计数据
export interface CollegeStatistics {
collegeCode?: string
collegeName?: string
totalCount?: number
maleCount?: number
femaleCount?: number
activeCount?: number
suspendedCount?: number
graduatedCount?: number
poorFamilyCount?: number
minorityCount?: number
disabledCount?: number
orphanCount?: number
}
// 年级统计数据
export interface GradeStatistics {
grade?: string
count?: number
maleCount?: number
femaleCount?: number
activeCount?: number
}
// 专业统计数据
export interface MajorStatistics {
majorCode?: string
majorName?: string
count?: number
collegeCode?: string
collegeName?: string
}
// 学籍状态统计数据
export interface StudentStatusStatistics {
studentStatus?: string
count?: number
statusName?: string
}
// 信息完整度统计数据
export interface CompletionRateStatistics {
rateRange?: string
count?: number
percentage?: number
}
// 选项数据结构
export interface OptionItem {
value: string | number
label: string
code?: string
disabled?: boolean
children?: OptionItem[]
[key: string]: any
}
// 学院选项
export interface CollegeOption extends OptionItem {
collegeCode?: string
collegeName?: string
}
// 专业选项
export interface MajorOption extends OptionItem {
majorCode?: string
majorName?: string
collegeCode?: string
collegeName?: string
}
// 班级选项
export interface ClassOption extends OptionItem {
classCode?: string
className?: string
majorCode?: string
majorName?: string
collegeCode?: string
collegeName?: string
grade?: string
}
// 教师选项
export interface TeacherOption extends OptionItem {
teacherId?: number
teacherName?: string
phone?: string
email?: string
department?: string
}
// 表格列配置
export interface TableColumn {
prop: string
label: string
width?: number | string
minWidth?: number | string
fixed?: boolean | string
align?: 'left' | 'center' | 'right'
sortable?: boolean | string
showOverflowTooltip?: boolean
formatter?: (row: any, column: any, cellValue: any, index: number) => string
render?: (row: any, column: any, cellValue: any, index: number) => any
}
// 搜索表单配置
export interface SearchFormItem {
prop: string
label: string
type: 'input' | 'select' | 'date' | 'daterange' | 'number' | 'switch' | 'cascader'
placeholder?: string
options?: OptionItem[]
width?: number | string
span?: number
rules?: any[]
clearable?: boolean
multiple?: boolean
filterable?: boolean
remote?: boolean
remoteMethod?: (query: string) => void
props?: any
format?: string
valueFormat?: string
rangeSeparator?: string
startPlaceholder?: string
endPlaceholder?: string
}
// 表单配置
export interface FormItem {
prop: string
label: string
type: 'input' | 'select' | 'date' | 'number' | 'switch' | 'textarea' | 'upload' | 'cascader' | 'radio' | 'checkbox'
placeholder?: string
options?: OptionItem[]
width?: number | string
span?: number
rules?: any[]
required?: boolean
clearable?: boolean
multiple?: boolean
filterable?: boolean
remote?: boolean
remoteMethod?: (query: string) => void
props?: any
format?: string
valueFormat?: string
maxlength?: number
showWordLimit?: boolean
rows?: number
autosize?: boolean | { minRows: number; maxRows: number }
accept?: string
listType?: 'text' | 'picture' | 'picture-card'
limit?: number
action?: string
headers?: any
data?: any
beforeUpload?: (file: File) => boolean | Promise<boolean>
onSuccess?: (response: any, file: File, fileList: any[]) => void
onError?: (error: any, file: File, fileList: any[]) => void
onRemove?: (file: File, fileList: any[]) => void
disabled?: boolean
readonly?: boolean
size?: 'large' | 'default' | 'small'
}
// 批量操作配置
export interface BatchOperation {
key: string
label: string
type: 'primary' | 'success' | 'warning' | 'danger' | 'info'
icon?: string
permission?: string
confirm?: boolean
confirmMessage?: string
handler: (selectedRows: any[], selectedIds: any[]) => void
}
// 操作按钮配置
export interface ActionButton {
key: string
label: string
type: 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'text'
icon?: string
permission?: string
show?: (row: any) => boolean
disabled?: (row: any) => boolean
confirm?: boolean
confirmMessage?: string | ((row: any) => string)
handler: (row: any, index: number) => void
}
// 统计卡片配置
export interface StatisticsCard {
title: string
value: number | string
icon: string
color: string
trend?: {
type: 'up' | 'down'
value: number | string
label: string
}
action?: {
label: string
handler: () => void
}
}
// 图表配置
export interface ChartConfig {
type: 'bar' | 'line' | 'pie' | 'doughnut' | 'radar'
title?: string
data: any[]
xField?: string
yField?: string
seriesField?: string
colorField?: string
colors?: string[]
legend?: boolean
tooltip?: boolean
label?: boolean
height?: number
width?: number
padding?: number | number[]
meta?: any
interactions?: any[]
annotations?: any[]
}
// 导入配置
export interface ImportConfig {
templateUrl: string
uploadUrl: string
maxSize: number
allowedTypes: string[]
requiredFields: string[]
fieldMapping: { [key: string]: string }
validateRules: { [key: string]: any[] }
beforeUpload?: (file: File) => boolean | Promise<boolean>
onProgress?: (percent: number) => void
onSuccess?: (response: any) => void
onError?: (error: any) => void
}
// 导出配置
export interface ExportConfig {
filename: string
sheetName: string
columns: {
prop: string
label: string
width?: number
formatter?: (value: any, row: any) => string
}[]
beforeExport?: (data: any[]) => any[]
onSuccess?: () => void
onError?: (error: any) => void
}
// 审核配置
export interface AuditConfig {
statusOptions: OptionItem[]
remarkRequired: boolean
maxRemarkLength: number
batchAuditEnabled: boolean
autoNotify: boolean
notifyTemplate: string
}
// 权限配置
export interface PermissionConfig {
list: string
query: string
add: string
edit: string
remove: string
export: string
import: string
audit: string
statistics: string
batchUpdate: string
}
// 页面配置
export interface PageConfig {
title: string
breadcrumb: string[]
permissions: PermissionConfig
searchForm: SearchFormItem[]
tableColumns: TableColumn[]
formItems: FormItem[]
batchOperations: BatchOperation[]
actionButtons: ActionButton[]
statisticsCards: StatisticsCard[]
chartConfigs: ChartConfig[]
importConfig: ImportConfig
exportConfig: ExportConfig
auditConfig: AuditConfig
}
+17
View File
@@ -56,6 +56,23 @@ export default {
downloadLoadingInstance.close();
}
},
async excel(data: any, filename: string) {
downloadLoadingInstance = ElLoading.service({ text: '正在下载数据,请稍候', background: 'rgba(0, 0, 0, 0.7)' });
try {
const isBlob = blobValidate(data);
if (isBlob) {
const blob = new Blob([data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
FileSaver.saveAs(blob, filename);
} else {
this.printErrMsg(data);
}
downloadLoadingInstance.close();
} catch (r) {
console.error(r);
ElMessage.error('下载文件出现错误,请联系管理员!');
downloadLoadingInstance.close();
}
},
async printErrMsg(data: any) {
const resText = await data.text();
const rspObj = JSON.parse(resText);
@@ -0,0 +1,489 @@
<template>
<el-dialog
:title="dialogTitle"
v-model="dialogVisible"
width="60%"
:before-close="handleClose"
append-to-body
>
<div class="audit-container">
<!-- 审核信息 -->
<div v-if="!batchMode" class="student-info">
<h4>学生信息</h4>
<el-descriptions :column="2" border>
<el-descriptions-item label="学号">{{ studentData.studentNo }}</el-descriptions-item>
<el-descriptions-item label="姓名">{{ studentData.name }}</el-descriptions-item>
<el-descriptions-item label="性别">{{ studentData.gender === 'M' ? '男' : '女' }}</el-descriptions-item>
<el-descriptions-item label="班级">{{ studentData.className }}</el-descriptions-item>
<el-descriptions-item label="当前状态">
<el-tag :type="getInfoStatusType(studentData.infoStatus)">
{{ getInfoStatusText(studentData.infoStatus) }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item label="信息完整度">
<el-progress
:percentage="studentData.completionRate || 0"
:color="getCompletionColor(studentData.completionRate)"
:stroke-width="6"
/>
</el-descriptions-item>
</el-descriptions>
</div>
<!-- 批量审核信息 -->
<div v-else class="batch-info">
<h4>批量审核</h4>
<el-alert
title="批量审核提示"
type="warning"
:closable="false"
show-icon
>
<div slot="title">
<p>即将审核 {{ selectedIds.length }} 条学生信息</p>
<p>请选择审核结果并填写审核意见</p>
</div>
</el-alert>
</div>
<!-- 审核表单 -->
<el-form
ref="auditForm"
:model="auditForm"
:rules="auditRules"
label-width="120px"
style="margin-top: 20px"
>
<el-form-item label="审核结果" prop="auditStatus">
<el-radio-group v-model="auditForm.auditStatus">
<el-radio label="1">审核通过</el-radio>
<el-radio label="4">审核驳回</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="审核意见" prop="auditRemark">
<el-input
v-model="auditForm.auditRemark"
type="textarea"
:rows="4"
placeholder="请输入审核意见"
maxlength="500"
show-word-limit
/>
</el-form-item>
</el-form>
<!-- 审核历史 -->
<div v-if="!batchMode && auditHistory.length > 0" class="audit-history">
<h4>审核历史</h4>
<el-timeline>
<el-timeline-item
v-for="(item, index) in auditHistory"
:key="index"
:timestamp="item.auditTime"
:type="item.auditStatus === '1' ? 'success' : 'danger'"
>
<div class="history-item">
<div class="history-status">
<el-tag :type="item.auditStatus === '1' ? 'success' : 'danger'">
{{ item.auditStatus === '1' ? '审核通过' : '审核驳回' }}
</el-tag>
</div>
<div class="history-auditor">审核人:{{ item.auditorName }}</div>
<div class="history-remark" v-if="item.auditRemark">
审核意见:{{ item.auditRemark }}
</div>
</div>
</el-timeline-item>
</el-timeline>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitAudit" :loading="loading">
确认审核
</el-button>
<el-button @click="handleClose">取消</el-button>
</div>
</el-dialog>
</template>
<script>
import { auditStudent, batchAuditStudents } from '@/api/xg-xx/student'
export default {
name: 'AuditDialog',
props: {
visible: {
type: Boolean,
default: false
},
studentData: {
type: Object,
default: () => ({})
},
batchMode: {
type: Boolean,
default: false
},
selectedIds: {
type: Array,
default: () => []
}
},
data() {
return {
loading: false,
auditForm: {
auditStatus: '1',
auditRemark: ''
},
auditRules: {
auditStatus: [
{ required: true, message: '请选择审核结果', trigger: 'change' }
],
auditRemark: [
{ required: true, message: '请输入审核意见', trigger: 'blur' },
{ min: 5, max: 500, message: '审核意见长度在5到500个字符', trigger: 'blur' }
]
},
auditHistory: []
}
},
computed: {
dialogVisible: {
get() {
return this.visible
},
set(val) {
this.$emit('update:visible', val)
}
},
dialogTitle() {
return this.batchMode ? '批量审核学生信息' : '审核学生信息'
}
},
watch: {
visible(val) {
if (val) {
this.initForm()
if (!this.batchMode) {
this.loadAuditHistory()
}
}
}
},
methods: {
/** 初始化表单 */
initForm() {
this.auditForm = {
auditStatus: '1',
auditRemark: ''
}
},
/** 加载审核历史 */
loadAuditHistory() {
// 这里可以调用API获取审核历史
// 暂时使用模拟数据
this.auditHistory = [
{
auditTime: '2025-01-10 14:30:00',
auditStatus: '4',
auditorName: '张老师',
auditRemark: '身份证号格式不正确,请核实后重新提交'
},
{
auditTime: '2025-01-08 09:15:00',
auditStatus: '1',
auditorName: '李老师',
auditRemark: '信息完整,审核通过'
}
]
},
/** 提交审核 */
submitAudit() {
this.$refs.auditForm.validate(valid => {
if (valid) {
this.loading = true
const auditData = {
auditStatus: this.auditForm.auditStatus,
auditRemark: this.auditForm.auditRemark
}
let apiCall
if (this.batchMode) {
apiCall = batchAuditStudents(
this.selectedIds,
auditData.auditStatus,
auditData.auditRemark
)
} else {
apiCall = auditStudent(
this.studentData.id,
auditData.auditStatus,
auditData.auditRemark
)
}
apiCall.then(response => {
this.$modal.msgSuccess('审核成功')
this.handleClose()
this.$emit('refresh')
this.loading = false
}).catch(() => {
this.loading = false
})
}
})
},
/** 获取信息状态类型 */
getInfoStatusType(status) {
const statusMap = {
'1': 'success',
'2': 'warning',
'3': 'info',
'4': 'danger',
'5': 'info'
}
return statusMap[status] || 'info'
},
/** 获取信息状态文本 */
getInfoStatusText(status) {
const statusMap = {
'1': '正常',
'2': '待审核',
'3': '审核中',
'4': '已驳回',
'5': '已锁定'
}
return statusMap[status] || '未知'
},
/** 获取完整度颜色 */
getCompletionColor(rate) {
if (rate >= 90) return '#67C23A'
if (rate >= 70) return '#E6A23C'
if (rate >= 50) return '#F56C6C'
return '#909399'
},
/** 关闭弹窗 */
handleClose() {
this.dialogVisible = false
this.initForm()
this.auditHistory = []
}
}
}
</script>
<style scoped>
.audit-container {
padding: 20px;
}
.audit-info {
margin-bottom: 20px;
padding: 16px 20px;
background: #f8f9fa;
border-radius: 8px;
border: 1px solid #e4e7ed;
}
.audit-title {
font-size: 16px;
font-weight: 600;
color: #303133;
margin-bottom: 12px;
}
.audit-details {
color: #606266;
font-size: 14px;
line-height: 1.6;
}
.student-list {
margin-bottom: 20px;
}
.student-item {
display: flex;
align-items: center;
padding: 12px 16px;
margin-bottom: 8px;
background: white;
border: 1px solid #e4e7ed;
border-radius: 8px;
transition: all 0.3s ease;
}
.student-item:hover {
border-color: #409eff;
box-shadow: 0 4px 12px rgba(64, 158, 255, 0.15);
}
.student-avatar {
width: 40px;
height: 40px;
border-radius: 50%;
margin-right: 12px;
background: #f0f2f5;
display: flex;
align-items: center;
justify-content: center;
color: #909399;
font-weight: 600;
}
.student-info {
flex: 1;
}
.student-name {
font-size: 16px;
font-weight: 600;
color: #303133;
margin-bottom: 4px;
}
.student-details {
font-size: 14px;
color: #909399;
}
.audit-form {
padding: 20px;
background: #fafbfc;
border-radius: 8px;
border: 1px solid #e4e7ed;
}
.audit-form :deep(.el-form-item__label) {
font-weight: 600;
color: #303133;
}
.audit-form :deep(.el-radio-group) {
display: flex;
gap: 20px;
}
.audit-form :deep(.el-radio) {
margin-right: 0;
padding: 8px 16px;
border: 1px solid #e4e7ed;
border-radius: 6px;
background: #fff;
transition: all 0.3s ease;
}
.audit-form :deep(.el-radio:hover) {
border-color: #409eff;
background: #f0f9ff;
}
.audit-form :deep(.el-radio.is-checked) {
border-color: #409eff;
background: #f0f9ff;
}
.audit-form :deep(.el-textarea__inner) {
min-height: 100px;
resize: vertical;
}
.audit-history {
margin-top: 20px;
}
.history-title {
font-size: 16px;
font-weight: 600;
color: #303133;
margin-bottom: 12px;
display: flex;
align-items: center;
}
.history-icon {
color: #409eff;
margin-right: 8px;
}
.history-list {
max-height: 200px;
overflow-y: auto;
border: 1px solid #e4e7ed;
border-radius: 8px;
}
.history-item {
padding: 12px 16px;
border-bottom: 1px solid #f0f2f5;
display: flex;
align-items: flex-start;
}
.history-item:last-child {
border-bottom: none;
}
.history-status {
margin-right: 12px;
flex-shrink: 0;
}
.history-content {
flex: 1;
}
.history-info {
font-size: 14px;
color: #303133;
margin-bottom: 4px;
}
.history-time {
font-size: 12px;
color: #909399;
}
.history-remark {
font-size: 13px;
color: #606266;
margin-top: 8px;
line-height: 1.5;
}
.no-history {
text-align: center;
padding: 40px 20px;
color: #909399;
font-size: 14px;
}
.dialog-footer {
display: flex;
justify-content: space-between;
align-items: center;
gap: 12px;
width: 100%;
}
.footer-left {
display: flex;
align-items: center;
gap: 12px;
}
.footer-right {
display: flex;
align-items: center;
gap: 12px;
}
.selected-count {
color: #909399;
font-size: 14px;
}
</style>
@@ -0,0 +1,749 @@
<template>
<el-dialog
:title="dialogTitle"
v-model="dialogVisible"
width="60%"
:before-close="handleClose"
append-to-body
>
<div class="batch-operation-container">
<!-- 操作信息 -->
<div class="operation-info">
<el-alert
:title="alertTitle"
type="warning"
:closable="false"
show-icon
>
<div slot="title">
<p>{{ alertTitle }}</p>
<p>选中了 {{ selectedIds.length }} 条学生信息</p>
</div>
</el-alert>
</div>
<!-- 批量更新状态 -->
<div v-if="operationType === 'updateStatus'" class="operation-form">
<el-form
ref="statusForm"
:model="statusForm"
:rules="statusRules"
label-width="120px"
>
<el-form-item label="状态类型" prop="statusType">
<el-radio-group v-model="statusForm.statusType">
<el-radio label="info">信息状态</el-radio>
<el-radio label="student">学籍状态</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="目标状态" prop="targetStatus">
<el-select
v-model="statusForm.targetStatus"
placeholder="请选择目标状态"
style="width: 100%"
>
<el-option
v-for="option in statusOptions"
:key="option.value"
:label="option.label"
:value="option.value"
/>
</el-select>
</el-form-item>
<el-form-item label="操作说明" prop="remark">
<el-input
v-model="statusForm.remark"
type="textarea"
:rows="3"
placeholder="请输入操作说明"
maxlength="200"
show-word-limit
/>
</el-form-item>
</el-form>
</div>
<!-- 更新完整度 -->
<div v-if="operationType === 'updateCompletion'" class="operation-form">
<el-alert
title="更新完整度说明"
type="info"
:closable="false"
show-icon
>
<div slot="title">
<p>将重新计算选中学生的信息完整度</p>
<p>系统会根据必填字段的填写情况自动计算完整度百分比</p>
</div>
</el-alert>
</div>
<!-- 数据清理 -->
<div v-if="operationType === 'dataClean'" class="operation-form">
<el-form
ref="cleanForm"
:model="cleanForm"
:rules="cleanRules"
label-width="120px"
>
<el-form-item label="清理类型" prop="cleanType">
<el-checkbox-group v-model="cleanForm.cleanType">
<el-checkbox label="duplicateStudentNo">重复学号</el-checkbox>
<el-checkbox label="duplicateIdCard">重复身份证</el-checkbox>
<el-checkbox label="incompleteInfo">信息不完整</el-checkbox>
<el-checkbox label="invalidPhone">无效手机号</el-checkbox>
<el-checkbox label="invalidEmail">无效邮箱</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="处理方式" prop="cleanAction">
<el-radio-group v-model="cleanForm.cleanAction">
<el-radio label="mark">标记问题</el-radio>
<el-radio label="fix">自动修复</el-radio>
<el-radio label="delete">删除记录</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
</div>
<!-- 数据导出 -->
<div v-if="operationType === 'export'" class="operation-form">
<el-form
ref="exportForm"
:model="exportForm"
:rules="exportRules"
label-width="120px"
>
<el-form-item label="导出格式" prop="exportFormat">
<el-radio-group v-model="exportForm.exportFormat">
<el-radio label="excel">Excel格式</el-radio>
<el-radio label="csv">CSV格式</el-radio>
<el-radio label="pdf">PDF格式</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="导出字段" prop="exportFields">
<el-checkbox-group v-model="exportForm.exportFields">
<el-checkbox label="basic">基本信息</el-checkbox>
<el-checkbox label="academic">学籍信息</el-checkbox>
<el-checkbox label="contact">联系信息</el-checkbox>
<el-checkbox label="family">家庭信息</el-checkbox>
<el-checkbox label="health">健康信息</el-checkbox>
<el-checkbox label="extended">扩展信息</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="文件名称" prop="fileName">
<el-input
v-model="exportForm.fileName"
placeholder="请输入文件名称"
style="width: 300px"
>
<template slot="append">.{{ exportForm.exportFormat }}</template>
</el-input>
</el-form-item>
</el-form>
</div>
<!-- 选中数据预览 -->
<div class="selected-data-preview">
<h4>选中数据预览(前5条)</h4>
<el-table
:data="previewData"
size="small"
max-height="200"
style="width: 100%"
>
<el-table-column prop="studentNo" label="学号" width="120" />
<el-table-column prop="name" label="姓名" width="100" />
<el-table-column prop="gender" label="性别" width="60">
<template slot-scope="scope">
{{ scope.row.gender === 'M' ? '男' : '女' }}
</template>
</el-table-column>
<el-table-column prop="className" label="班级" width="140" />
<el-table-column prop="studentStatus" label="学籍状态" width="100">
<template slot-scope="scope">
<el-tag :type="getStatusType(scope.row.studentStatus)" size="mini">
{{ getStatusText(scope.row.studentStatus) }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="infoStatus" label="信息状态" width="100">
<template slot-scope="scope">
<el-tag :type="getInfoStatusType(scope.row.infoStatus)" size="mini">
{{ getInfoStatusText(scope.row.infoStatus) }}
</el-tag>
</template>
</el-table-column>
</el-table>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitOperation" :loading="loading">
确认执行
</el-button>
<el-button @click="handleClose">取消</el-button>
</div>
</el-dialog>
</template>
<script>
import {
batchUpdateInfoStatus,
batchUpdateStudentStatus,
updateCompletionRate,
exportStudents
} from '@/api/xg-xx/student'
export default {
name: 'BatchOperationDialog',
props: {
visible: {
type: Boolean,
default: false
},
operationType: {
type: String,
default: 'updateStatus'
},
selectedIds: {
type: Array,
default: () => []
},
selectedRows: {
type: Array,
default: () => []
}
},
data() {
return {
loading: false,
statusForm: {
statusType: 'info',
targetStatus: '',
remark: ''
},
statusRules: {
statusType: [
{ required: true, message: '请选择状态类型', trigger: 'change' }
],
targetStatus: [
{ required: true, message: '请选择目标状态', trigger: 'change' }
]
},
cleanForm: {
cleanType: [],
cleanAction: 'mark'
},
cleanRules: {
cleanType: [
{ required: true, message: '请选择清理类型', trigger: 'change' }
],
cleanAction: [
{ required: true, message: '请选择处理方式', trigger: 'change' }
]
},
exportForm: {
exportFormat: 'excel',
exportFields: ['basic', 'academic', 'contact'],
fileName: '学生信息导出'
},
exportRules: {
exportFormat: [
{ required: true, message: '请选择导出格式', trigger: 'change' }
],
exportFields: [
{ required: true, message: '请选择导出字段', trigger: 'change' }
],
fileName: [
{ required: true, message: '请输入文件名称', trigger: 'blur' }
]
}
}
},
computed: {
dialogVisible: {
get() {
return this.visible
},
set(val) {
this.$emit('update:visible', val)
}
},
dialogTitle() {
const titleMap = {
updateStatus: '批量更新状态',
updateCompletion: '批量更新完整度',
dataClean: '数据清理',
export: '批量导出'
}
return titleMap[this.operationType] || '批量操作'
},
alertTitle() {
const titleMap = {
updateStatus: '即将批量更新学生状态',
updateCompletion: '即将批量更新信息完整度',
dataClean: '即将进行数据清理',
export: '即将导出学生数据'
}
return titleMap[this.operationType] || '批量操作'
},
statusOptions() {
if (this.statusForm.statusType === 'info') {
return [
{ label: '正常', value: '1' },
{ label: '待审核', value: '2' },
{ label: '审核中', value: '3' },
{ label: '已驳回', value: '4' },
{ label: '已锁定', value: '5' }
]
} else {
return [
{ label: '在籍', value: '1' },
{ label: '休学', value: '2' },
{ label: '复学', value: '3' },
{ label: '退学', value: '4' },
{ label: '毕业', value: '5' }
]
}
},
previewData() {
return this.selectedRows.slice(0, 5)
}
},
methods: {
/** 提交操作 */
submitOperation() {
switch (this.operationType) {
case 'updateStatus':
this.handleUpdateStatus()
break
case 'updateCompletion':
this.handleUpdateCompletion()
break
case 'dataClean':
this.handleDataClean()
break
case 'export':
this.handleExport()
break
}
},
/** 处理状态更新 */
handleUpdateStatus() {
this.$refs.statusForm.validate(valid => {
if (valid) {
this.loading = true
let apiCall
if (this.statusForm.statusType === 'info') {
apiCall = batchUpdateInfoStatus(this.selectedIds, this.statusForm.targetStatus)
} else {
apiCall = batchUpdateStudentStatus(this.selectedIds, this.statusForm.targetStatus)
}
apiCall.then(response => {
this.$modal.msgSuccess('批量更新成功')
this.handleClose()
this.$emit('refresh')
this.loading = false
}).catch(() => {
this.loading = false
})
}
})
},
/** 处理完整度更新 */
handleUpdateCompletion() {
this.loading = true
const promises = this.selectedIds.map(id => updateCompletionRate(id))
Promise.all(promises).then(() => {
this.$modal.msgSuccess('批量更新完整度成功')
this.handleClose()
this.$emit('refresh')
this.loading = false
}).catch(() => {
this.loading = false
})
},
/** 处理数据清理 */
handleDataClean() {
this.$refs.cleanForm.validate(valid => {
if (valid) {
this.loading = true
// 这里可以调用数据清理API
// 暂时使用模拟处理
setTimeout(() => {
this.$modal.msgSuccess('数据清理完成')
this.handleClose()
this.$emit('refresh')
this.loading = false
}, 2000)
}
})
},
/** 处理导出 */
handleExport() {
this.$refs.exportForm.validate(valid => {
if (valid) {
this.loading = true
const exportQuery = {
ids: this.selectedIds,
format: this.exportForm.exportFormat,
fields: this.exportForm.exportFields
}
exportStudents(exportQuery).then(response => {
const fileName = `${this.exportForm.fileName}.${this.exportForm.exportFormat}`
this.$download.excel(response, fileName)
this.$modal.msgSuccess('导出成功')
this.handleClose()
this.loading = false
}).catch(() => {
this.loading = false
})
}
})
},
/** 获取学籍状态类型 */
getStatusType(status) {
const statusMap = {
'1': 'success',
'2': 'warning',
'3': 'info',
'4': 'danger',
'5': 'primary'
}
return statusMap[status] || 'info'
},
/** 获取学籍状态文本 */
getStatusText(status) {
const statusMap = {
'1': '在籍',
'2': '休学',
'3': '复学',
'4': '退学',
'5': '毕业'
}
return statusMap[status] || '未知'
},
/** 获取信息状态类型 */
getInfoStatusType(status) {
const statusMap = {
'1': 'success',
'2': 'warning',
'3': 'info',
'4': 'danger',
'5': 'info'
}
return statusMap[status] || 'info'
},
/** 获取信息状态文本 */
getInfoStatusText(status) {
const statusMap = {
'1': '正常',
'2': '待审核',
'3': '审核中',
'4': '已驳回',
'5': '已锁定'
}
return statusMap[status] || '未知'
},
/** 重置表单 */
resetForms() {
this.statusForm = {
statusType: 'info',
targetStatus: '',
remark: ''
}
this.cleanForm = {
cleanType: [],
cleanAction: 'mark'
}
this.exportForm = {
exportFormat: 'excel',
exportFields: ['basic', 'academic', 'contact'],
fileName: '学生信息导出'
}
},
/** 关闭弹窗 */
handleClose() {
this.dialogVisible = false
this.resetForms()
}
}
}
</script>
<style scoped>
.batch-operation-container {
padding: 20px;
}
.operation-selector {
margin-bottom: 20px;
padding: 16px 20px;
background: #f8f9fa;
border-radius: 8px;
border: 1px solid #e4e7ed;
}
.selector-title {
font-size: 16px;
font-weight: 600;
color: #303133;
margin-bottom: 12px;
}
.operation-options {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 12px;
}
.operation-option {
padding: 12px 16px;
border: 1px solid #e4e7ed;
border-radius: 8px;
background: white;
cursor: pointer;
transition: all 0.3s ease;
display: flex;
align-items: center;
}
.operation-option:hover {
border-color: #409eff;
background: #f0f9ff;
}
.operation-option.selected {
border-color: #409eff;
background: #f0f9ff;
color: #409eff;
}
.option-icon {
margin-right: 8px;
font-size: 16px;
}
.option-text {
flex: 1;
font-size: 14px;
font-weight: 500;
}
.selected-students {
margin-bottom: 20px;
}
.students-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
}
.students-title {
font-size: 16px;
font-weight: 600;
color: #303133;
}
.students-count {
font-size: 14px;
color: #909399;
}
.students-list {
max-height: 200px;
overflow-y: auto;
border: 1px solid #e4e7ed;
border-radius: 8px;
}
.student-item {
display: flex;
align-items: center;
padding: 12px 16px;
border-bottom: 1px solid #f0f2f5;
}
.student-item:last-child {
border-bottom: none;
}
.student-avatar {
width: 32px;
height: 32px;
border-radius: 50%;
margin-right: 12px;
background: #f0f2f5;
display: flex;
align-items: center;
justify-content: center;
color: #909399;
font-weight: 600;
font-size: 12px;
}
.student-info {
flex: 1;
}
.student-name {
font-size: 14px;
font-weight: 600;
color: #303133;
margin-bottom: 2px;
}
.student-details {
font-size: 12px;
color: #909399;
}
.operation-form {
padding: 20px;
background: #fafbfc;
border-radius: 8px;
border: 1px solid #e4e7ed;
}
.operation-form :deep(.el-form-item__label) {
font-weight: 600;
color: #303133;
}
.operation-form :deep(.el-select) {
width: 100%;
}
.operation-form :deep(.el-textarea__inner) {
min-height: 80px;
resize: vertical;
}
.operation-preview {
margin-top: 20px;
padding: 16px 20px;
background: #f0f9ff;
border: 1px solid #d9ecff;
border-radius: 8px;
}
.preview-title {
font-size: 14px;
font-weight: 600;
color: #303133;
margin-bottom: 8px;
}
.preview-content {
font-size: 14px;
color: #606266;
line-height: 1.6;
}
.operation-result {
margin-top: 20px;
}
.result-summary {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16px 20px;
background: #f8f9fa;
border-radius: 8px;
border: 1px solid #e4e7ed;
margin-bottom: 16px;
}
.summary-item {
text-align: center;
}
.summary-label {
font-size: 14px;
color: #909399;
margin-bottom: 4px;
}
.summary-value {
font-size: 18px;
font-weight: bold;
color: #303133;
}
.summary-value.success {
color: #67c23a;
}
.summary-value.error {
color: #f56c6c;
}
.result-details {
max-height: 200px;
overflow-y: auto;
border: 1px solid #e4e7ed;
border-radius: 8px;
}
.result-item {
display: flex;
align-items: center;
padding: 12px 16px;
border-bottom: 1px solid #f0f2f5;
}
.result-item:last-child {
border-bottom: none;
}
.result-status {
margin-right: 12px;
flex-shrink: 0;
}
.result-message {
flex: 1;
font-size: 14px;
color: #606266;
}
.dialog-footer {
display: flex;
justify-content: space-between;
align-items: center;
gap: 12px;
width: 100%;
}
.footer-left {
display: flex;
align-items: center;
gap: 12px;
}
.footer-right {
display: flex;
align-items: center;
gap: 12px;
}
.progress-info {
color: #909399;
font-size: 14px;
}
</style>
@@ -0,0 +1,575 @@
<template>
<el-dialog
title="批量导入学生信息"
v-model="dialogVisible"
width="70%"
:before-close="handleClose"
append-to-body
>
<div class="import-container">
<!-- 步骤条 -->
<el-steps :active="currentStep" finish-status="success" align-center>
<el-step title="下载模板" description="下载Excel导入模板"></el-step>
<el-step title="上传文件" description="上传填写好的Excel文件"></el-step>
<el-step title="数据验证" description="验证数据格式和内容"></el-step>
<el-step title="确认导入" description="确认导入数据到系统"></el-step>
</el-steps>
<!-- 步骤内容 -->
<div class="step-content">
<!-- 步骤1: 下载模板 -->
<div v-if="currentStep === 0" class="step-panel">
<div class="template-info">
<el-alert
title="导入说明"
type="info"
:closable="false"
show-icon
>
<div slot="title">
<h4>导入说明</h4>
<ul>
<li>请先下载Excel模板文件,按照模板格式填写学生信息</li>
<li>必填字段:学号、姓名、性别、身份证号、学院、专业、班级</li>
<li>学号不能重复,身份证号不能重复</li>
<li>性别填写:男 或 女</li>
<li>日期格式:yyyy-MM-dd,如:2000-01-01</li>
<li>支持最大导入数量:1000条</li>
</ul>
</div>
</el-alert>
</div>
<div class="template-download">
<el-button
type="primary"
icon="el-icon-download"
size="large"
@click="downloadTemplate"
:loading="downloadLoading"
>
下载导入模板
</el-button>
</div>
</div>
<!-- 步骤2: 上传文件 -->
<div v-if="currentStep === 1" class="step-panel">
<div class="upload-area">
<el-upload
ref="upload"
class="upload-demo"
drag
:action="uploadUrl"
:headers="uploadHeaders"
:data="uploadData"
:file-list="fileList"
:before-upload="beforeUpload"
:on-success="handleUploadSuccess"
:on-error="handleUploadError"
:on-remove="handleRemove"
:auto-upload="false"
accept=".xlsx,.xls"
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<div class="el-upload__tip" slot="tip">
只能上传Excel文件,且不超过10MB
</div>
</el-upload>
</div>
<div class="upload-options">
<el-checkbox v-model="updateSupport">
允许更新已存在的学生信息
</el-checkbox>
</div>
</div>
<!-- 步骤3: 数据验证 -->
<div v-if="currentStep === 2" class="step-panel">
<div v-if="validationResult" class="validation-result">
<el-alert
:title="validationResult.success ? '验证通过' : '验证失败'"
:type="validationResult.success ? 'success' : 'error'"
:closable="false"
show-icon
>
<div slot="title">
<h4>验证结果</h4>
<p>总计:{{ validationResult.total }}条,成功:{{ validationResult.successCount }}条,失败:{{ validationResult.errorCount }}条</p>
</div>
</el-alert>
<!-- 错误信息 -->
<div v-if="validationResult.errors && validationResult.errors.length > 0" class="error-list">
<h4>错误详情</h4>
<el-table
:data="validationResult.errors"
size="small"
max-height="300"
style="width: 100%"
>
<el-table-column prop="row" label="行号" width="80" />
<el-table-column prop="field" label="字段" width="120" />
<el-table-column prop="value" label="值" width="150" show-overflow-tooltip />
<el-table-column prop="message" label="错误信息" show-overflow-tooltip />
</el-table>
</div>
<!-- 预览数据 -->
<div v-if="validationResult.preview && validationResult.preview.length > 0" class="preview-data">
<h4>数据预览(前10条)</h4>
<el-table
:data="validationResult.preview"
size="small"
max-height="300"
style="width: 100%"
>
<el-table-column prop="studentNo" label="学号" width="120" />
<el-table-column prop="name" label="姓名" width="100" />
<el-table-column prop="gender" label="性别" width="60" />
<el-table-column prop="idCard" label="身份证号" width="160" />
<el-table-column prop="collegeName" label="学院" width="120" />
<el-table-column prop="majorName" label="专业" width="140" />
<el-table-column prop="className" label="班级" width="140" />
<el-table-column prop="phone" label="手机号" width="120" />
</el-table>
</div>
</div>
</div>
<!-- 步骤4: 确认导入 -->
<div v-if="currentStep === 3" class="step-panel">
<div class="import-confirm">
<el-alert
title="确认导入"
type="warning"
:closable="false"
show-icon
>
<div slot="title">
<h4>确认导入</h4>
<p>即将导入 {{ validationResult.successCount }} 条学生信息,请确认是否继续?</p>
<p v-if="updateSupport" style="color: #E6A23C;">
<i class="el-icon-warning"></i>
注意:已开启更新模式,重复的学生信息将被更新
</p>
</div>
</el-alert>
</div>
<div v-if="importResult" class="import-result">
<el-alert
:title="importResult.success ? '导入成功' : '导入失败'"
:type="importResult.success ? 'success' : 'error'"
:closable="false"
show-icon
>
<div slot="title">
<h4>导入结果</h4>
<div v-html="importResult.message"></div>
</div>
</el-alert>
</div>
</div>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button v-if="currentStep > 0" @click="prevStep">上一步</el-button>
<el-button
v-if="currentStep < 3"
type="primary"
@click="nextStep"
:disabled="!canNext"
>
下一步
</el-button>
<el-button
v-if="currentStep === 2"
type="success"
@click="startImport"
:disabled="!validationResult || !validationResult.success"
:loading="importLoading"
>
开始导入
</el-button>
<el-button
v-if="currentStep === 3"
type="primary"
@click="handleClose"
>
完成
</el-button>
<el-button @click="handleClose">取消</el-button>
</div>
</el-dialog>
</template>
<script>
import { getImportTemplate, importStudents } from '@/api/xg-xx/student'
import { getToken } from '@/utils/auth'
export default {
name: 'ImportDialog',
props: {
visible: {
type: Boolean,
default: false
}
},
data() {
return {
currentStep: 0,
downloadLoading: false,
importLoading: false,
fileList: [],
updateSupport: false,
validationResult: null,
importResult: null,
uploadUrl: process.env.VUE_APP_BASE_API + '/xg/studentInfo/import',
uploadHeaders: {
Authorization: 'Bearer ' + getToken()
},
uploadData: {
updateSupport: false
}
}
},
computed: {
dialogVisible: {
get() {
return this.visible
},
set(val) {
this.$emit('update:visible', val)
}
},
canNext() {
switch (this.currentStep) {
case 0:
return true
case 1:
return this.fileList.length > 0
case 2:
return this.validationResult && this.validationResult.success
default:
return false
}
}
},
watch: {
updateSupport(val) {
this.uploadData.updateSupport = val
}
},
methods: {
/** 下载模板 */
downloadTemplate() {
this.downloadLoading = true
getImportTemplate().then(response => {
this.$download.excel(response, '学生信息导入模板.xlsx')
this.downloadLoading = false
}).catch(() => {
this.downloadLoading = false
})
},
/** 上传前验证 */
beforeUpload(file) {
const isExcel = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ||
file.type === 'application/vnd.ms-excel'
const isLt10M = file.size / 1024 / 1024 < 10
if (!isExcel) {
this.$message.error('只能上传Excel文件!')
return false
}
if (!isLt10M) {
this.$message.error('文件大小不能超过10MB!')
return false
}
return true
},
/** 上传成功 */
handleUploadSuccess(response, file, fileList) {
if (response.code === 200) {
this.validationResult = response.data
this.currentStep = 2
this.$message.success('文件上传成功,正在验证数据...')
} else {
this.$message.error(response.msg || '上传失败')
this.handleRemove(file, fileList)
}
},
/** 上传失败 */
handleUploadError(error, file, fileList) {
this.$message.error('上传失败: ' + error.message)
this.handleRemove(file, fileList)
},
/** 移除文件 */
handleRemove(file, fileList) {
this.fileList = fileList
this.validationResult = null
},
/** 上一步 */
prevStep() {
if (this.currentStep > 0) {
this.currentStep--
}
},
/** 下一步 */
nextStep() {
if (this.currentStep < 3) {
if (this.currentStep === 1) {
// 开始上传文件
this.$refs.upload.submit()
return
}
this.currentStep++
}
},
/** 开始导入 */
startImport() {
this.importLoading = true
const importData = {
studentInfoList: this.validationResult.validData,
isUpdateSupport: this.updateSupport,
operName: this.$store.state.user.name
}
importStudents(importData).then(response => {
this.importResult = {
success: response.code === 200,
message: response.data || response.msg
}
this.currentStep = 3
this.importLoading = false
if (response.code === 200) {
this.$message.success('导入成功')
this.$emit('refresh')
} else {
this.$message.error(response.msg || '导入失败')
}
}).catch(error => {
this.importResult = {
success: false,
message: error.message || '导入失败'
}
this.currentStep = 3
this.importLoading = false
})
},
/** 重置数据 */
resetData() {
this.currentStep = 0
this.fileList = []
this.updateSupport = false
this.validationResult = null
this.importResult = null
},
/** 关闭弹窗 */
handleClose() {
this.dialogVisible = false
this.resetData()
}
}
}
</script>
<style scoped>
.import-container {
padding: 20px;
}
.import-steps {
margin-bottom: 30px;
}
.import-steps :deep(.el-steps) {
margin-bottom: 20px;
}
.step-content {
min-height: 200px;
padding: 20px;
background: #fafbfc;
border-radius: 8px;
border: 1px solid #e4e7ed;
}
.download-section {
text-align: center;
padding: 40px 20px;
}
.download-section .el-button {
margin: 0 10px;
}
.upload-section {
text-align: center;
padding: 20px;
}
.upload-dragger {
background: #fff;
border: 2px dashed #d9d9d9;
border-radius: 8px;
padding: 40px;
transition: all 0.3s ease;
}
.upload-dragger:hover {
border-color: #409eff;
background: #f0f9ff;
}
.upload-icon {
font-size: 48px;
color: #c0c4cc;
margin-bottom: 16px;
}
.upload-text {
color: #606266;
font-size: 14px;
margin-bottom: 8px;
}
.upload-hint {
color: #909399;
font-size: 12px;
}
.validation-section {
padding: 20px;
}
.validation-result {
margin-bottom: 20px;
}
.result-summary {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16px 20px;
background: #f8f9fa;
border-radius: 8px;
border: 1px solid #e4e7ed;
margin-bottom: 20px;
}
.summary-item {
text-align: center;
}
.summary-label {
font-size: 14px;
color: #909399;
margin-bottom: 4px;
}
.summary-value {
font-size: 20px;
font-weight: bold;
color: #303133;
}
.error-list {
max-height: 200px;
overflow-y: auto;
border: 1px solid #e4e7ed;
border-radius: 8px;
}
.error-item {
padding: 12px 16px;
border-bottom: 1px solid #f0f2f5;
display: flex;
align-items: center;
}
.error-item:last-child {
border-bottom: none;
}
.error-icon {
color: #f56c6c;
margin-right: 8px;
}
.error-message {
flex: 1;
color: #606266;
font-size: 14px;
}
.preview-table {
margin-top: 20px;
}
.preview-table :deep(.el-table__header th) {
background-color: #f8f9fa;
color: #333;
font-weight: 600;
}
.preview-table :deep(.el-table__body-wrapper .el-table__row:hover) {
background-color: #f5f7fa;
}
.confirm-section {
padding: 20px;
text-align: center;
}
.confirm-info {
padding: 20px;
background: #f0f9ff;
border: 1px solid #d9ecff;
border-radius: 8px;
margin-bottom: 20px;
}
.confirm-title {
font-size: 18px;
font-weight: 600;
color: #303133;
margin-bottom: 12px;
}
.confirm-details {
color: #606266;
font-size: 14px;
line-height: 1.6;
}
.dialog-footer {
display: flex;
justify-content: space-between;
align-items: center;
gap: 12px;
width: 100%;
}
.footer-left {
display: flex;
align-items: center;
gap: 12px;
}
.footer-right {
display: flex;
align-items: center;
gap: 12px;
}
.progress-info {
color: #909399;
font-size: 14px;
}
</style>
@@ -0,0 +1,626 @@
<template>
<el-dialog
:title="dialogTitle"
v-model="dialogVisible"
width="90%"
:before-close="handleClose"
append-to-body
>
<div v-loading="loading" class="statistics-container">
<!-- 图表选择器 -->
<div class="chart-selector">
<el-radio-group v-model="activeChart" @change="handleChartChange">
<el-radio-button label="college">学院分布</el-radio-button>
<el-radio-button label="grade">年级分布</el-radio-button>
<el-radio-button label="major">专业分布</el-radio-button>
<el-radio-button label="status">学籍状态</el-radio-button>
<el-radio-button label="completion">完整度分布</el-radio-button>
<el-radio-button label="gender">性别分布</el-radio-button>
</el-radio-group>
</div>
<!-- 图表区域 -->
<div class="chart-content">
<el-row :gutter="20">
<!-- 左侧图表 -->
<el-col :span="16">
<div class="chart-wrapper">
<div :id="chartId" class="chart-container"></div>
</div>
</el-col>
<!-- 右侧数据表格 -->
<el-col :span="8">
<div class="data-table-wrapper">
<h4>详细数据</h4>
<el-table
:data="tableData"
size="small"
max-height="400"
style="width: 100%"
>
<el-table-column
prop="name"
label="名称"
show-overflow-tooltip
/>
<el-table-column
prop="count"
label="数量"
width="80"
align="right"
/>
<el-table-column
prop="percentage"
label="占比"
width="80"
align="right"
>
<template slot-scope="scope">
{{ scope.row.percentage }}%
</template>
</el-table-column>
</el-table>
</div>
</el-col>
</el-row>
</div>
<!-- 统计摘要 -->
<div class="statistics-summary">
<el-row :gutter="20">
<el-col :span="6">
<div class="summary-item">
<div class="summary-label">总数</div>
<div class="summary-value">{{ summaryData.total }}</div>
</div>
</el-col>
<el-col :span="6">
<div class="summary-item">
<div class="summary-label">类别数</div>
<div class="summary-value">{{ summaryData.categories }}</div>
</div>
</el-col>
<el-col :span="6">
<div class="summary-item">
<div class="summary-label">最大值</div>
<div class="summary-value">{{ summaryData.max }}</div>
</div>
</el-col>
<el-col :span="6">
<div class="summary-item">
<div class="summary-label">平均值</div>
<div class="summary-value">{{ summaryData.average }}</div>
</div>
</el-col>
</el-row>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleExport">导出图表</el-button>
<el-button @click="handleClose">关闭</el-button>
</div>
</el-dialog>
</template>
<script>
import {
getCollegeStatistics,
getGradeStatistics,
getMajorStatistics,
getStudentStatusStatistics,
getCompletionRateStatistics,
getStatisticsOverview
} from '@/api/xg-xx/student'
import * as echarts from 'echarts'
export default {
name: 'StatisticsChartDialog',
props: {
visible: {
type: Boolean,
default: false
},
chartType: {
type: String,
default: 'college'
}
},
data() {
return {
loading: false,
activeChart: 'college',
chartInstance: null,
chartId: 'statisticsChart',
tableData: [],
summaryData: {
total: 0,
categories: 0,
max: 0,
average: 0
},
chartColors: [
'#409EFF', '#67C23A', '#E6A23C', '#F56C6C', '#909399',
'#5470C6', '#91CC75', '#FAC858', '#EE6666', '#73C0DE',
'#3BA272', '#FC8452', '#9A60B4', '#EA7CCC', '#95D4F2'
]
}
},
computed: {
dialogVisible: {
get() {
return this.visible
},
set(val) {
this.$emit('update:visible', val)
}
},
dialogTitle() {
const titleMap = {
college: '学院分布统计',
grade: '年级分布统计',
major: '专业分布统计',
status: '学籍状态统计',
completion: '信息完整度统计',
gender: '性别分布统计'
}
return titleMap[this.activeChart] || '统计图表'
}
},
watch: {
visible(val) {
if (val) {
this.activeChart = this.chartType || 'college'
this.$nextTick(() => {
this.initChart()
this.loadChartData()
})
} else {
this.destroyChart()
}
}
},
methods: {
/** 初始化图表 */
initChart() {
const chartDom = document.getElementById(this.chartId)
if (chartDom) {
this.chartInstance = echarts.init(chartDom)
// 监听窗口大小变化
window.addEventListener('resize', this.handleResize)
}
},
/** 销毁图表 */
destroyChart() {
if (this.chartInstance) {
this.chartInstance.dispose()
this.chartInstance = null
}
window.removeEventListener('resize', this.handleResize)
},
/** 处理窗口大小变化 */
handleResize() {
if (this.chartInstance) {
this.chartInstance.resize()
}
},
/** 图表类型切换 */
handleChartChange(type) {
this.activeChart = type
this.loadChartData()
},
/** 加载图表数据 */
loadChartData() {
this.loading = true
let apiCall
switch (this.activeChart) {
case 'college':
apiCall = getCollegeStatistics()
break
case 'grade':
apiCall = getGradeStatistics()
break
case 'major':
apiCall = getMajorStatistics()
break
case 'status':
apiCall = getStudentStatusStatistics()
break
case 'completion':
apiCall = getCompletionRateStatistics()
break
case 'gender':
apiCall = this.getGenderStatistics()
break
default:
apiCall = getCollegeStatistics()
}
apiCall.then(response => {
const data = response.data
this.processChartData(data)
this.renderChart(data)
this.loading = false
}).catch(() => {
this.loading = false
})
},
/** 处理图表数据 */
processChartData(data) {
let tableData = []
let total = 0
let max = 0
switch (this.activeChart) {
case 'college':
tableData = data.map(item => ({
name: item.collegeName,
count: item.count,
percentage: 0
}))
break
case 'grade':
tableData = data.map(item => ({
name: item.grade + '级',
count: item.count,
percentage: 0
}))
break
case 'major':
tableData = data.map(item => ({
name: item.majorName,
count: item.count,
percentage: 0
}))
break
case 'status':
tableData = data.map(item => ({
name: this.getStatusText(item.studentStatus),
count: item.count,
percentage: 0
}))
break
case 'completion':
tableData = data.map(item => ({
name: item.rateRange,
count: item.count,
percentage: 0
}))
break
case 'gender':
tableData = data.map(item => ({
name: item.gender === 'M' ? '男' : '女',
count: item.count,
percentage: 0
}))
break
}
// 计算总数和百分比
total = tableData.reduce((sum, item) => sum + item.count, 0)
tableData.forEach(item => {
item.percentage = total > 0 ? ((item.count / total) * 100).toFixed(1) : 0
max = Math.max(max, item.count)
})
this.tableData = tableData
this.summaryData = {
total,
categories: tableData.length,
max,
average: total > 0 ? Math.round(total / tableData.length) : 0
}
},
/** 渲染图表 */
renderChart(data) {
if (!this.chartInstance) return
const option = this.getChartOption(data)
this.chartInstance.setOption(option, true)
},
/** 获取图表配置 */
getChartOption(data) {
const isBar = ['college', 'major'].includes(this.activeChart)
const isPie = ['status', 'completion', 'gender'].includes(this.activeChart)
if (isPie) {
return this.getPieChartOption(data)
} else if (isBar) {
return this.getBarChartOption(data)
} else {
return this.getLineChartOption(data)
}
},
/** 获取饼图配置 */
getPieChartOption(data) {
const pieData = this.tableData.map(item => ({
name: item.name,
value: item.count
}))
return {
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b}: {c} ({d}%)'
},
legend: {
orient: 'vertical',
left: 'left',
data: pieData.map(item => item.name)
},
series: [
{
name: this.dialogTitle,
type: 'pie',
radius: ['40%', '70%'],
center: ['60%', '50%'],
avoidLabelOverlap: false,
label: {
show: false,
position: 'center'
},
emphasis: {
label: {
show: true,
fontSize: '18',
fontWeight: 'bold'
}
},
labelLine: {
show: false
},
data: pieData,
itemStyle: {
color: (params) => {
return this.chartColors[params.dataIndex % this.chartColors.length]
}
}
}
]
}
},
/** 获取柱状图配置 */
getBarChartOption(data) {
const xData = this.tableData.map(item => item.name)
const yData = this.tableData.map(item => item.count)
return {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: {
type: 'category',
data: xData,
axisLabel: {
rotate: 45,
interval: 0
}
},
yAxis: {
type: 'value'
},
series: [
{
name: '学生数量',
type: 'bar',
data: yData,
itemStyle: {
color: (params) => {
return this.chartColors[params.dataIndex % this.chartColors.length]
}
}
}
]
}
},
/** 获取折线图配置 */
getLineChartOption(data) {
const xData = this.tableData.map(item => item.name)
const yData = this.tableData.map(item => item.count)
return {
tooltip: {
trigger: 'axis'
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: {
type: 'category',
data: xData
},
yAxis: {
type: 'value'
},
series: [
{
name: '学生数量',
type: 'line',
data: yData,
smooth: true,
lineStyle: {
color: '#409EFF'
},
areaStyle: {
color: 'rgba(64, 158, 255, 0.1)'
}
}
]
}
},
/** 获取性别统计数据 */
getGenderStatistics() {
return getStatisticsOverview().then(response => {
const data = response.data
return {
data: [
{ gender: 'M', count: data.maleCount || 0 },
{ gender: 'F', count: data.femaleCount || 0 }
]
}
})
},
/** 获取学籍状态文本 */
getStatusText(status) {
const statusMap = {
'1': '在籍',
'2': '休学',
'3': '复学',
'4': '退学',
'5': '毕业'
}
return statusMap[status] || '未知'
},
/** 导出图表 */
handleExport() {
if (this.chartInstance) {
const url = this.chartInstance.getDataURL({
type: 'png',
pixelRatio: 2,
backgroundColor: '#fff'
})
const link = document.createElement('a')
link.download = `${this.dialogTitle}.png`
link.href = url
link.click()
}
},
/** 关闭弹窗 */
handleClose() {
this.dialogVisible = false
this.destroyChart()
}
},
beforeDestroy() {
this.destroyChart()
}
}
</script>
<style scoped>
.statistics-container {
height: 600px;
padding: 20px;
}
.statistics-header {
margin-bottom: 20px;
padding: 16px 20px;
background: #f8f9fa;
border-radius: 8px;
border: 1px solid #e4e7ed;
}
.statistics-tabs {
height: 100%;
display: flex;
flex-direction: column;
}
.statistics-tabs :deep(.el-tabs__header) {
margin: 0 0 20px 0;
}
.statistics-tabs :deep(.el-tabs__nav-wrap::after) {
height: 1px;
background: #e4e7ed;
}
.statistics-tabs :deep(.el-tabs__item) {
font-size: 15px;
font-weight: 500;
padding: 0 20px;
height: 44px;
line-height: 44px;
}
.statistics-tabs :deep(.el-tabs__item.is-active) {
color: rgb(93, 135, 255);
font-weight: 600;
}
.statistics-tabs :deep(.el-tabs__active-bar) {
background: rgb(93, 135, 255);
}
.statistics-tabs :deep(.el-tabs__content) {
flex: 1;
overflow-y: auto;
padding: 0;
}
.chart-container {
height: 400px;
margin-bottom: 20px;
}
.stats-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 20px;
margin-bottom: 20px;
}
.stat-item {
padding: 20px;
background: white;
border-radius: 8px;
border: 1px solid #e4e7ed;
text-align: center;
transition: all 0.3s ease;
}
.stat-item:hover {
border-color: #409eff;
box-shadow: 0 4px 12px rgba(64, 158, 255, 0.15);
}
.stat-value {
font-size: 24px;
font-weight: bold;
color: #303133;
margin-bottom: 8px;
}
.stat-label {
font-size: 14px;
color: #909399;
}
.data-table {
margin-top: 20px;
}
.data-table :deep(.el-table__header th) {
background-color: #f8f9fa;
color: #333;
font-weight: 600;
}
.data-table :deep(.el-table__body-wrapper .el-table__row:hover) {
background-color: #f5f7fa;
}
.dialog-footer {
display: flex;
justify-content: flex-end;
gap: 12px;
width: 100%;
}
</style>
@@ -0,0 +1,769 @@
<template>
<el-dialog
title="学生详细信息"
v-model="dialogVisible"
width="80%"
:before-close="handleClose"
append-to-body
>
<div v-loading="loading" class="student-detail">
<el-tabs v-model="activeTab" type="border-card" class="detail-tabs">
<!-- 基本信息 -->
<el-tab-pane label="基本信息" name="basic">
<div class="info-section">
<div class="section-header">
<h3>个人基本信息</h3>
</div>
<el-row :gutter="20">
<el-col :span="6">
<div class="photo-container">
<el-image
:src="studentInfo.photoUrl || '/static/images/default-avatar.png'"
fit="cover"
class="student-photo"
/>
</div>
</el-col>
<el-col :span="18">
<el-row :gutter="20">
<el-col :span="8">
<div class="info-item">
<label>学号:</label>
<span>{{ studentInfo.studentNo }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>姓名:</label>
<span>{{ studentInfo.name }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>性别:</label>
<span>{{ studentInfo.gender === 'M' ? '男' : '女' }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>出生日期:</label>
<span>{{ studentInfo.birthDate }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>身份证号:</label>
<span>{{ studentInfo.idCard }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>民族:</label>
<span>{{ studentInfo.nation }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>政治面貌:</label>
<span>{{ studentInfo.politicalStatus }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>婚姻状况:</label>
<span>{{ studentInfo.maritalStatus }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>宗教信仰:</label>
<span>{{ studentInfo.religion || '无' }}</span>
</div>
</el-col>
</el-row>
</el-col>
</el-row>
</div>
<div class="info-section">
<div class="section-header">
<h3>联系信息</h3>
</div>
<el-row :gutter="20">
<el-col :span="8">
<div class="info-item">
<label>手机号:</label>
<span>{{ studentInfo.phone }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>邮箱:</label>
<span>{{ studentInfo.email }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>QQ:</label>
<span>{{ studentInfo.qq }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>微信:</label>
<span>{{ studentInfo.wechat }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>宿舍楼:</label>
<span>{{ studentInfo.dormitoryBuilding }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>宿舍号:</label>
<span>{{ studentInfo.dormitoryRoom }}</span>
</div>
</el-col>
<el-col :span="24">
<div class="info-item">
<label>家庭地址:</label>
<span>{{ studentInfo.homeAddress }}</span>
</div>
</el-col>
</el-row>
</div>
</el-tab-pane>
<!-- 学籍信息 -->
<el-tab-pane label="学籍信息" name="academic">
<div class="info-section">
<div class="section-header">
<h3>学籍信息</h3>
</div>
<el-row :gutter="20">
<el-col :span="8">
<div class="info-item">
<label>入学年份:</label>
<span>{{ studentInfo.enrollmentYear }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>入学日期:</label>
<span>{{ studentInfo.enrollmentDate }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>学制:</label>
<span>{{ studentInfo.schoolSystem }}年</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>学历层次:</label>
<span>{{ studentInfo.educationLevel }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>培养方式:</label>
<span>{{ studentInfo.trainingType }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>学籍状态:</label>
<el-tag :type="getStatusType(studentInfo.studentStatus)">
{{ getStatusText(studentInfo.studentStatus) }}
</el-tag>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>学院:</label>
<span>{{ studentInfo.collegeName }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>专业:</label>
<span>{{ studentInfo.majorName }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>班级:</label>
<span>{{ studentInfo.className }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>年级:</label>
<span>{{ studentInfo.grade }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>辅导员:</label>
<span>{{ studentInfo.counselorName }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>班主任:</label>
<span>{{ studentInfo.classTeacherName }}</span>
</div>
</el-col>
</el-row>
</div>
</el-tab-pane>
<!-- 家庭信息 -->
<el-tab-pane label="家庭信息" name="family">
<div class="info-section">
<div class="section-header">
<h3>紧急联系人</h3>
</div>
<el-row :gutter="20">
<el-col :span="8">
<div class="info-item">
<label>紧急联系人:</label>
<span>{{ studentInfo.emergencyContactName }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>联系电话:</label>
<span>{{ studentInfo.emergencyContactPhone }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>关系:</label>
<span>{{ studentInfo.emergencyContactRelation }}</span>
</div>
</el-col>
</el-row>
</div>
<div class="info-section">
<div class="section-header">
<h3>父母信息</h3>
</div>
<el-row :gutter="20">
<el-col :span="8">
<div class="info-item">
<label>父亲姓名:</label>
<span>{{ studentInfo.fatherName }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>父亲电话:</label>
<span>{{ studentInfo.fatherPhone }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>父亲职业:</label>
<span>{{ studentInfo.fatherWorkUnit }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>母亲姓名:</label>
<span>{{ studentInfo.motherName }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>母亲电话:</label>
<span>{{ studentInfo.motherPhone }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>母亲职业:</label>
<span>{{ studentInfo.motherWorkUnit }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>家庭收入:</label>
<span>{{ studentInfo.familyIncome }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>家庭成员数:</label>
<span>{{ studentInfo.familyMembers }}人</span>
</div>
</el-col>
</el-row>
</div>
<div class="info-section">
<div class="section-header">
<h3>特殊情况</h3>
</div>
<el-row :gutter="20">
<el-col :span="6">
<div class="info-item">
<label>贫困生:</label>
<el-tag :type="studentInfo.isPoorStudent ? 'danger' : 'success'">
{{ studentInfo.isPoorStudent ? '是' : '否' }}
</el-tag>
</div>
</el-col>
<el-col :span="6">
<div class="info-item">
<label>少数民族:</label>
<el-tag :type="studentInfo.isMinority ? 'warning' : 'info'">
{{ studentInfo.isMinority ? '是' : '否' }}
</el-tag>
</div>
</el-col>
<el-col :span="6">
<div class="info-item">
<label>残疾学生:</label>
<el-tag :type="studentInfo.isDisabled ? 'danger' : 'success'">
{{ studentInfo.isDisabled ? '是' : '否' }}
</el-tag>
</div>
</el-col>
<el-col :span="6">
<div class="info-item">
<label>孤儿:</label>
<el-tag :type="studentInfo.isOrphan ? 'danger' : 'success'">
{{ studentInfo.isOrphan ? '是' : '否' }}
</el-tag>
</div>
</el-col>
<el-col :span="6">
<div class="info-item">
<label>留守儿童:</label>
<el-tag :type="studentInfo.isLeftBehindChild ? 'warning' : 'info'">
{{ studentInfo.isLeftBehindChild ? '是' : '否' }}
</el-tag>
</div>
</el-col>
<el-col :span="6">
<div class="info-item">
<label>独生子女:</label>
<el-tag :type="studentInfo.isSingleChild ? 'primary' : 'info'">
{{ studentInfo.isSingleChild ? '是' : '否' }}
</el-tag>
</div>
</el-col>
</el-row>
</div>
</el-tab-pane>
<!-- 健康信息 -->
<el-tab-pane label="健康信息" name="health">
<div class="info-section">
<div class="section-header">
<h3>体征信息</h3>
</div>
<el-row :gutter="20">
<el-col :span="8">
<div class="info-item">
<label>身高:</label>
<span>{{ studentInfo.height }}cm</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>体重:</label>
<span>{{ studentInfo.weight }}kg</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>血型:</label>
<span>{{ studentInfo.bloodType }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>健康状况:</label>
<span>{{ studentInfo.healthStatus }}</span>
</div>
</el-col>
<el-col :span="24">
<div class="info-item">
<label>过敏史:</label>
<span>{{ studentInfo.allergies || '无' }}</span>
</div>
</el-col>
<el-col :span="24">
<div class="info-item">
<label>病史:</label>
<span>{{ studentInfo.medicalHistory || '无' }}</span>
</div>
</el-col>
</el-row>
</div>
</el-tab-pane>
<!-- 银行信息 -->
<el-tab-pane label="银行信息" name="bank">
<div class="info-section">
<div class="section-header">
<h3>银行卡信息</h3>
</div>
<el-row :gutter="20">
<el-col :span="8">
<div class="info-item">
<label>银行卡号:</label>
<span>{{ studentInfo.bankCardNo }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>开户银行:</label>
<span>{{ studentInfo.bankName }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>开户支行:</label>
<span>{{ studentInfo.bankBranch }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>持卡人姓名:</label>
<span>{{ studentInfo.cardHolderName }}</span>
</div>
</el-col>
</el-row>
</div>
</el-tab-pane>
<!-- 扩展信息 -->
<el-tab-pane label="扩展信息" name="extended">
<div class="info-section">
<div class="section-header">
<h3>特长爱好</h3>
</div>
<div class="info-item">
<p>{{ studentInfo.specialties || '无' }}</p>
</div>
</div>
<div class="info-section">
<div class="section-header">
<h3>获奖情况</h3>
</div>
<div class="info-item">
<p>{{ studentInfo.awards || '无' }}</p>
</div>
</div>
<div class="info-section">
<div class="section-header">
<h3>违纪记录</h3>
</div>
<div class="info-item">
<p>{{ studentInfo.violations || '无' }}</p>
</div>
</div>
<div class="info-section">
<div class="section-header">
<h3>社会活动</h3>
</div>
<div class="info-item">
<p>{{ studentInfo.socialActivities || '无' }}</p>
</div>
</div>
</el-tab-pane>
<!-- 系统信息 -->
<el-tab-pane label="系统信息" name="system">
<div class="info-section">
<div class="section-header">
<h3>信息状态</h3>
</div>
<el-row :gutter="20">
<el-col :span="8">
<div class="info-item">
<label>信息状态:</label>
<el-tag :type="getInfoStatusType(studentInfo.infoStatus)">
{{ getInfoStatusText(studentInfo.infoStatus) }}
</el-tag>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>数据来源:</label>
<span>{{ getDataSourceText(studentInfo.dataSource) }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>信息完整度:</label>
<el-progress
:percentage="studentInfo.completionRate || 0"
:color="getCompletionColor(studentInfo.completionRate)"
/>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>最后审核时间:</label>
<span>{{ studentInfo.lastAuditTime || '未审核' }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>创建时间:</label>
<span>{{ studentInfo.createTime }}</span>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>更新时间:</label>
<span>{{ studentInfo.updateTime }}</span>
</div>
</el-col>
</el-row>
</div>
<div class="info-section" v-if="studentInfo.remark">
<div class="section-header">
<h3>备注信息</h3>
</div>
<div class="info-item">
<p>{{ studentInfo.remark }}</p>
</div>
</div>
</el-tab-pane>
</el-tabs>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleEdit" v-hasPermi="['xg:studentInfo:edit']">
编辑信息
</el-button>
<el-button @click="handleClose">关闭</el-button>
</div>
</el-dialog>
</template>
<script>
import { getStudent } from '@/api/xg-xx/student'
export default {
name: 'StudentDetailDialog',
props: {
visible: {
type: Boolean,
default: false
},
studentId: {
type: Number,
required: true
}
},
data() {
return {
loading: false,
activeTab: 'basic',
studentInfo: {}
}
},
computed: {
dialogVisible: {
get() {
return this.visible
},
set(val) {
this.$emit('update:visible', val)
}
}
},
watch: {
visible(val) {
if (val && this.studentId) {
this.getStudentInfo()
}
}
},
methods: {
/** 获取学生信息 */
getStudentInfo() {
this.loading = true
getStudent(this.studentId).then(response => {
this.studentInfo = response.data
this.loading = false
}).catch(() => {
this.loading = false
})
},
/** 编辑按钮 */
handleEdit() {
this.$emit('edit', this.studentInfo)
this.handleClose()
},
/** 关闭弹窗 */
handleClose() {
this.dialogVisible = false
this.activeTab = 'basic'
this.studentInfo = {}
},
/** 获取学籍状态类型 */
getStatusType(status) {
const statusMap = {
'1': 'success',
'2': 'warning',
'3': 'info',
'4': 'danger',
'5': 'primary'
}
return statusMap[status] || 'info'
},
/** 获取学籍状态文本 */
getStatusText(status) {
const statusMap = {
'1': '在籍',
'2': '休学',
'3': '复学',
'4': '退学',
'5': '毕业'
}
return statusMap[status] || '未知'
},
/** 获取信息状态类型 */
getInfoStatusType(status) {
const statusMap = {
'1': 'success',
'2': 'warning',
'3': 'info',
'4': 'danger',
'5': 'info'
}
return statusMap[status] || 'info'
},
/** 获取信息状态文本 */
getInfoStatusText(status) {
const statusMap = {
'1': '正常',
'2': '待审核',
'3': '审核中',
'4': '已驳回',
'5': '已锁定'
}
return statusMap[status] || '未知'
},
/** 获取数据来源文本 */
getDataSourceText(source) {
const sourceMap = {
'1': '学生录入',
'2': '批量导入',
'3': '系统迁移',
'4': '第三方同步'
}
return sourceMap[source] || '未知'
},
/** 获取完整度颜色 */
getCompletionColor(rate) {
if (rate >= 90) return '#67C23A'
if (rate >= 70) return '#E6A23C'
if (rate >= 50) return '#F56C6C'
return '#909399'
}
}
}
</script>
<style scoped>
.student-detail {
padding: 20px;
}
.detail-tabs {
border: none;
box-shadow: none;
}
.info-section {
margin-bottom: 30px;
}
.section-header {
margin-bottom: 20px;
padding-bottom: 10px;
border-bottom: 2px solid #f0f0f0;
}
.section-header h3 {
margin: 0;
color: #333;
font-size: 16px;
font-weight: 600;
}
.photo-container {
text-align: center;
padding: 20px;
}
.student-photo {
width: 120px;
height: 160px;
border-radius: 8px;
border: 2px solid #e0e0e0;
}
.info-item {
margin-bottom: 15px;
display: flex;
align-items: center;
}
.info-item label {
font-weight: 600;
color: #666;
min-width: 100px;
margin-right: 10px;
}
.info-item span {
color: #333;
flex: 1;
}
.info-item p {
margin: 0;
color: #333;
line-height: 1.6;
text-align: justify;
}
.dialog-footer {
text-align: right;
}
/* 响应式设计 */
@media (max-width: 768px) {
.student-photo {
width: 80px;
height: 100px;
}
.info-item {
flex-direction: column;
align-items: flex-start;
}
.info-item label {
min-width: auto;
margin-bottom: 5px;
}
}
</style>
File diff suppressed because it is too large. Load diff
+969
View File
@@ -0,0 +1,969 @@
<template>
<div class="page-container">
<!-- 统计卡片区域 -->
<div class="mb-[10px]">
<el-row :gutter="16">
<el-col :span="6">
<el-card shadow="hover" class="stat-card stat-card-primary">
<div class="stat-content">
<div class="stat-icon">
<el-icon><User /></el-icon>
</div>
<div class="stat-info">
<div class="stat-value">{{ statistics.totalStudents }}</div>
<div class="stat-label">学生总数</div>
</div>
</div>
</el-card>
</el-col>
<el-col :span="6">
<el-card shadow="hover" class="stat-card stat-card-success">
<div class="stat-content">
<div class="stat-icon">
<el-icon><Check /></el-icon>
</div>
<div class="stat-info">
<div class="stat-value">{{ statistics.activeStudents }}</div>
<div class="stat-label">在籍学生</div>
</div>
</div>
</el-card>
</el-col>
<el-col :span="6">
<el-card shadow="hover" class="stat-card stat-card-info">
<div class="stat-content">
<div class="stat-icon">
<el-icon><Document /></el-icon>
</div>
<div class="stat-info">
<div class="stat-value">{{ statistics.completeStudents }}</div>
<div class="stat-label">信息完整</div>
</div>
</div>
</el-card>
</el-col>
<el-col :span="6">
<el-card shadow="hover" class="stat-card stat-card-warning">
<div class="stat-content">
<div class="stat-icon">
<el-icon><Warning /></el-icon>
</div>
<div class="stat-info">
<div class="stat-value">{{ statistics.pendingStudents }}</div>
<div class="stat-label">待审核</div>
</div>
</div>
</el-card>
</el-col>
</el-row>
</div>
<!-- 搜索区域 -->
<el-card shadow="never" class="button-card">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="学号" prop="studentNo">
<el-input
v-model="queryParams.studentNo"
placeholder="请输入学号"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="姓名" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入姓名"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="性别" prop="gender">
<el-select v-model="queryParams.gender" placeholder="请选择性别" clearable>
<el-option label="男" value="M" />
<el-option label="女" value="F" />
</el-select>
</el-form-item>
<el-form-item label="学院" prop="collegeCode">
<el-select v-model="queryParams.collegeCode" placeholder="请选择学院" clearable @change="handleCollegeChange">
<el-option
v-for="college in collegeOptions"
:key="college.value"
:label="college.label"
:value="college.value"
/>
</el-select>
</el-form-item>
<el-form-item label="专业" prop="majorCode">
<el-select v-model="queryParams.majorCode" placeholder="请选择专业" clearable @change="handleMajorChange">
<el-option
v-for="major in majorOptions"
:key="major.value"
:label="major.label"
:value="major.value"
/>
</el-select>
</el-form-item>
<el-form-item label="班级" prop="classCode">
<el-select v-model="queryParams.classCode" placeholder="请选择班级" clearable>
<el-option
v-for="classItem in classOptions"
:key="classItem.value"
:label="classItem.label"
:value="classItem.value"
/>
</el-select>
</el-form-item>
<el-form-item label="状态" prop="studentStatus">
<el-select v-model="queryParams.studentStatus" placeholder="请选择状态" clearable>
<el-option label="在籍" value="1" />
<el-option label="休学" value="2" />
<el-option label="复学" value="3" />
<el-option label="退学" value="4" />
<el-option label="毕业" value="5" />
</el-select>
</el-form-item>
<div class="search-btn-container">
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</div>
</el-form>
</el-card>
<!-- 表格区域 -->
<el-card shadow="never" class="table-card">
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="Plus"
@click="handleAdd"
v-hasPermi="['xg:studentInfo:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="Edit"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['xg:studentInfo:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="Delete"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['xg:studentInfo:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="Download"
@click="handleExport"
v-hasPermi="['xg:studentInfo:export']"
>导出</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="Upload"
@click="handleImport"
v-hasPermi="['xg:studentInfo:import']"
>导入</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="DataAnalysis"
@click="handleStatistics"
v-hasPermi="['xg:studentInfo:statistics']"
>统计</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="Check"
:disabled="multiple"
@click="handleBatchAudit"
v-hasPermi="['xg:studentInfo:audit']"
>批量审核</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="Operation"
:disabled="multiple"
@click="handleBatchOperation"
v-hasPermi="['xg:studentInfo:batch']"
>批量操作</el-button>
</el-col>
<right-toolbar :showSearch="showSearch" @update:showSearch="(val) => showSearch = val" @queryTable="getList"></right-toolbar>
</el-row>
</template>
<div class="table-container">
<el-table
v-loading="loading"
:data="studentList"
@selection-change="handleSelectionChange"
class="scroll-table"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="学号" align="center" prop="studentNo" width="120" />
<el-table-column label="姓名" align="center" prop="name" width="100" />
<el-table-column label="性别" align="center" prop="gender" width="80">
<template #default="scope">
<el-tag v-if="scope.row.gender === 'M'" type="primary">男</el-tag>
<el-tag v-else-if="scope.row.gender === 'F'" type="success">女</el-tag>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="学院" align="center" prop="collegeName" width="120" />
<el-table-column label="专业" align="center" prop="majorName" width="120" />
<el-table-column label="班级" align="center" prop="className" width="100" />
<el-table-column label="年级" align="center" prop="grade" width="80" />
<el-table-column label="状态" align="center" prop="studentStatus" width="80">
<template #default="scope">
<el-tag v-if="scope.row.studentStatus === '1'" type="success">在籍</el-tag>
<el-tag v-else-if="scope.row.studentStatus === '2'" type="warning">休学</el-tag>
<el-tag v-else-if="scope.row.studentStatus === '3'" type="info">复学</el-tag>
<el-tag v-else-if="scope.row.studentStatus === '4'" type="danger">退学</el-tag>
<el-tag v-else-if="scope.row.studentStatus === '5'" type="info">毕业</el-tag>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="完整度" align="center" prop="completionRate" width="100">
<template #default="scope">
<el-progress
:percentage="scope.row.completionRate || 0"
:color="getCompletenessColor(scope.row.completionRate)"
:stroke-width="8"
:show-text="false"
/>
<span class="ml-2">{{ scope.row.completionRate || 0 }}%</span>
</template>
</el-table-column>
<el-table-column label="联系电话" align="center" prop="phone" width="120" />
<el-table-column label="入学时间" align="center" prop="enrollmentDate" width="110">
<template #default="scope">
<span>{{ parseTime(scope.row.enrollmentDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200" fixed="right">
<template #default="scope">
<div class="action-buttons">
<el-tooltip content="查看详情" placement="top">
<el-button
link
type="primary"
icon="View"
@click="handleDetail(scope.row)"
v-hasPermi="['xg:studentInfo:query']"
/>
</el-tooltip>
<el-tooltip content="编辑" placement="top">
<el-button
link
type="primary"
icon="Edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['xg:studentInfo:edit']"
/>
</el-tooltip>
<el-tooltip content="删除" placement="top">
<el-button
link
type="danger"
icon="Delete"
@click="handleDelete(scope.row)"
v-hasPermi="['xg:studentInfo:remove']"
/>
</el-tooltip>
<el-tooltip content="审核" placement="top">
<el-button
link
type="success"
icon="Check"
@click="handleAudit(scope.row)"
v-hasPermi="['xg:studentInfo:audit']"
/>
</el-tooltip>
</div>
</template>
</el-table-column>
</el-table>
</div>
<!-- 分页 -->
<div class="pagination-container">
<pagination
v-show="total > 0"
:total="total"
:page="queryParams.pageNum"
:limit="queryParams.pageSize"
@update:page="(val) => queryParams.pageNum = val"
@update:limit="(val) => queryParams.pageSize = val"
@pagination="getList"
/>
</div>
</el-card>
<!-- 学生详情弹窗 -->
<StudentDetailDialog
:visible="detailVisible"
:student-id="selectedStudentId"
@update:visible="(val) => detailVisible = val"
@refresh="getList"
/>
<!-- 学生编辑弹窗 -->
<StudentEditDialog
:visible="editVisible"
:student-id="selectedStudentId"
:is-edit="isEdit"
@update:visible="(val) => editVisible = val"
@refresh="getList"
/>
<!-- 统计图表弹窗 -->
<StatisticsChartDialog
:visible="statisticsVisible"
@update:visible="(val) => statisticsVisible = val"
/>
<!-- 导入弹窗 -->
<ImportDialog
:visible="importVisible"
@update:visible="(val) => importVisible = val"
@refresh="getList"
/>
<!-- 审核弹窗 -->
<AuditDialog
:visible="auditVisible"
:student-ids="selectedStudentIds"
:is-batch="isBatchAudit"
@update:visible="(val) => auditVisible = val"
@refresh="getList"
/>
<!-- 批量操作弹窗 -->
<BatchOperationDialog
:visible="batchOperationVisible"
:student-ids="selectedStudentIds"
@update:visible="(val) => batchOperationVisible = val"
@refresh="getList"
/>
</div>
</template>
<script>
import {
listStudents,
getStudent,
delStudent,
exportStudents,
getStatisticsOverview,
getCollegeOptions,
getMajorOptions,
getClassOptions
} from '@/api/xg-xx/student'
import StudentDetailDialog from './components/StudentDetailDialog'
import StudentEditDialog from './components/StudentEditDialog'
import AuditDialog from './components/AuditDialog'
import ImportDialog from './components/ImportDialog'
import BatchOperationDialog from './components/BatchOperationDialog'
import StatisticsChartDialog from './components/StatisticsChartDialog'
export default {
name: 'StudentInfo',
components: {
StudentDetailDialog,
StudentEditDialog,
AuditDialog,
ImportDialog,
BatchOperationDialog,
StatisticsChartDialog
},
data() {
return {
// 加载状态
loading: true,
// 选中数组
ids: [],
selectedIds: [],
selectedRows: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 学生表格数据
studentList: [],
// 弹窗标题
title: '',
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
studentNo: null,
name: null,
gender: null,
collegeCode: null,
majorCode: null,
classCode: null,
grade: null,
studentStatus: null,
infoStatus: null
},
// 表单参数
form: {},
// 表单校验
rules: {},
// 统计卡片数据
statistics: {
totalStudents: 0,
activeStudents: 0,
completeStudents: 0,
pendingStudents: 0
},
// 选项数据
collegeOptions: [],
majorOptions: [],
classOptions: [],
// 弹窗显示状态
detailVisible: false,
editVisible: false,
auditVisible: false,
importVisible: false,
batchOperationVisible: false,
statisticsVisible: false,
// 当前操作数据
selectedStudentId: null,
isEdit: false,
isBatchAudit: false,
selectedStudentIds: []
}
},
created() {
this.getList()
this.getStatistics()
this.getCollegeList()
},
methods: {
/** 查询学生列表 */
getList() {
this.loading = true
console.log('开始查询学生列表,查询参数:', this.queryParams)
listStudents(this.queryParams).then(response => {
console.log('查询学生列表成功,响应数据:', response)
this.studentList = response.rows
this.total = response.total
this.loading = false
}).catch(error => {
console.error('查询学生列表失败,错误详情:', error)
// 提供更详细的错误信息
let errorMessage = '查询学生列表失败'
if (error.response) {
// 服务器返回了错误响应
const status = error.response.status
const data = error.response.data
if (status === 401) {
errorMessage = '认证失败,请重新登录'
// 可以在这里跳转到登录页面
// this.$router.push('/login')
} else if (status === 403) {
errorMessage = '权限不足,无法访问学生信息'
} else if (status === 500) {
errorMessage = '服务器内部错误'
if (data && data.msg) {
errorMessage += ': ' + data.msg
}
} else if (data && data.msg) {
errorMessage = data.msg
}
} else if (error.request) {
// 请求发送了但没有收到响应
errorMessage = '网络连接失败,请检查网络状态'
} else {
// 请求配置错误
errorMessage = '请求配置错误: ' + error.message
}
this.$modal.msgError(errorMessage)
this.loading = false
})
},
/** 获取统计数据 */
getStatistics() {
console.log('开始获取统计数据')
getStatisticsOverview().then(response => {
console.log('获取统计数据成功:', response)
const data = response.data
this.statistics.totalStudents = data.totalCount || 0
this.statistics.activeStudents = data.activeCount || 0
this.statistics.completeStudents = data.completeCount || 0
this.statistics.pendingStudents = data.pendingCount || 0
}).catch(error => {
console.error('获取统计数据失败:', error)
let errorMessage = '获取统计数据失败'
if (error.response && error.response.data && error.response.data.msg) {
errorMessage += ': ' + error.response.data.msg
}
this.$modal.msgError(errorMessage)
})
},
/** 获取学院列表 */
getCollegeList() {
console.log('开始获取学院列表')
getCollegeOptions().then(response => {
console.log('获取学院列表成功:', response)
this.collegeOptions = response.data
}).catch(error => {
console.error('获取学院列表失败:', error)
let errorMessage = '获取学院列表失败'
if (error.response && error.response.data && error.response.data.msg) {
errorMessage += ': ' + error.response.data.msg
}
this.$modal.msgError(errorMessage)
})
},
/** 学院变化处理 */
handleCollegeChange(collegeCode) {
this.queryParams.majorCode = null
this.queryParams.classCode = null
this.majorOptions = []
this.classOptions = []
if (collegeCode) {
console.log('学院变化,获取专业列表:', collegeCode)
getMajorOptions(collegeCode).then(response => {
console.log('获取专业列表成功:', response)
this.majorOptions = response.data
}).catch(error => {
console.error('获取专业列表失败:', error)
let errorMessage = '获取专业列表失败'
if (error.response && error.response.data && error.response.data.msg) {
errorMessage += ': ' + error.response.data.msg
}
this.$modal.msgError(errorMessage)
})
}
},
/** 专业变化处理 */
handleMajorChange(majorCode) {
this.queryParams.classCode = null
this.classOptions = []
if (majorCode) {
console.log('专业变化,获取班级列表:', majorCode)
getClassOptions(majorCode).then(response => {
console.log('获取班级列表成功:', response)
this.classOptions = response.data
}).catch(error => {
console.error('获取班级列表失败:', error)
let errorMessage = '获取班级列表失败'
if (error.response && error.response.data && error.response.data.msg) {
errorMessage += ': ' + error.response.data.msg
}
this.$modal.msgError(errorMessage)
})
}
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.$refs.queryRef?.resetFields()
this.queryParams = {
pageNum: 1,
pageSize: 10,
studentNo: null,
name: null,
gender: null,
collegeCode: null,
majorCode: null,
classCode: null,
grade: null,
studentStatus: null,
infoStatus: null
}
// 重置级联选择器
this.majorOptions = []
this.classOptions = []
this.handleQuery()
},
/** 多选框选中数据 */
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.selectedIds = selection.map(item => item.id)
this.selectedRows = selection
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.selectedStudentId = null
this.isEdit = false
this.editVisible = true
},
/** 修改按钮操作 */
handleUpdate(row) {
const id = row.id || this.ids[0]
this.selectedStudentId = id
this.isEdit = true
this.editVisible = true
},
/** 查看详情 */
handleDetail(row) {
this.selectedStudentId = row.id
this.detailVisible = true
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id ? [row.id] : this.ids
this.$modal.confirm('是否确认删除学生编号为"' + ids + '"的数据项?').then(function() {
return delStudent(ids)
}).then(() => {
this.getList()
this.$modal.msgSuccess('删除成功')
}).catch(() => {})
},
/** 导出按钮操作 */
handleExport() {
this.$modal.confirm('是否确认导出所有学生数据项?').then(() => {
this.loading = true
return exportStudents(this.queryParams)
}).then(response => {
this.$download.excel(response, '学生信息.xlsx')
this.loading = false
}).catch(() => {
this.loading = false
})
},
/** 导入按钮操作 */
handleImport() {
this.importVisible = true
},
/** 审核操作 */
handleAudit(row) {
this.selectedStudentIds = [row.id]
this.isBatchAudit = false
this.auditVisible = true
},
/** 批量审核 */
handleBatchAudit() {
this.selectedStudentIds = this.selectedIds
this.isBatchAudit = true
this.auditVisible = true
},
/** 批量操作 */
handleBatchOperation() {
if (this.selectedIds.length === 0) {
this.$modal.msgError('请选择要操作的数据')
return
}
this.batchOperationVisible = true
},
/** 显示统计图表 */
handleStatistics() {
this.statisticsVisible = true
},
/** 获取学籍状态类型 */
getStatusType(status) {
const statusMap = {
'1': 'success',
'2': 'warning',
'3': 'info',
'4': 'danger',
'5': 'primary'
}
return statusMap[status] || 'info'
},
/** 获取学籍状态文本 */
getStatusText(status) {
const statusMap = {
'1': '在籍',
'2': '休学',
'3': '复学',
'4': '退学',
'5': '毕业'
}
return statusMap[status] || '未知'
},
/** 获取信息状态类型 */
getInfoStatusType(status) {
const statusMap = {
'1': 'success',
'2': 'warning',
'3': 'info',
'4': 'danger',
'5': 'info'
}
return statusMap[status] || 'info'
},
/** 获取信息状态文本 */
getInfoStatusText(status) {
const statusMap = {
'1': '正常',
'2': '待审核',
'3': '审核中',
'4': '已驳回',
'5': '已锁定'
}
return statusMap[status] || '未知'
},
/** 获取完整度颜色 */
getCompletenessColor(rate) {
if (rate >= 90) return '#67C23A'
if (rate >= 70) return '#E6A23C'
if (rate >= 50) return '#F56C6C'
return '#909399'
}
}
}
</script>
<style scoped>
/* 页面容器样式 */
.page-container {
padding: 8px;
}
/* 统计卡片样式 */
.stat-card {
border-radius: 8px;
transition: all 0.3s ease;
height: 90px;
}
.stat-card:hover {
transform: translateY(-2px);
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}
.stat-content {
display: flex;
align-items: center;
padding: 5px 12px;
height: 100%;
box-sizing: border-box;
}
.stat-icon {
font-size: 24px;
margin-right: 12px;
opacity: 0.8;
}
.stat-info {
flex: 1;
}
.stat-value {
font-size: 20px;
font-weight: bold;
line-height: 1;
margin-bottom: 3px;
}
.stat-label {
font-size: 13px;
opacity: 0.7;
line-height: 1;
}
.stat-card-primary {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
}
.stat-card-success {
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
color: white;
}
.stat-card-warning {
background: linear-gradient(135deg, #ff9a56 0%, #ffad56 100%);
color: white;
}
.stat-card-info {
background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
color: #333;
}
/* 表格卡片布局 */
.table-card {
margin-top: 0;
}
.table-card :deep(.el-card__body) {
padding: 0px 20px 20px 20px !important;
}
/* 表格容器 - 支持横向滚动 */
.table-container {
width: 100%;
margin-bottom: 0;
}
/* 横向滚动表格样式 */
.scroll-table {
width: 100%;
}
/* 表格横向滚动条样式优化 */
.scroll-table :deep(.el-table__body-wrapper) {
overflow-x: auto !important;
overflow-y: auto;
}
.scroll-table :deep(.el-table__header-wrapper) {
overflow-x: hidden;
}
/* 强制显示表格横向滚动条 - 适用于所有浏览器 */
.scroll-table :deep(.el-table__body-wrapper) {
scrollbar-width: thin;
scrollbar-color: #409eff #f0f0f0;
}
/* Webkit 浏览器的横向滚动条样式 */
.scroll-table :deep(.el-table__body-wrapper)::-webkit-scrollbar {
height: 12px !important;
width: 12px !important;
}
.scroll-table :deep(.el-table__body-wrapper)::-webkit-scrollbar-track {
background: #f0f0f0 !important;
border-radius: 6px !important;
border: 1px solid #e4e7ed !important;
}
.scroll-table :deep(.el-table__body-wrapper)::-webkit-scrollbar-thumb {
background: #409eff !important;
border-radius: 6px !important;
border: 2px solid #f0f0f0 !important;
min-height: 20px !important;
}
.scroll-table :deep(.el-table__body-wrapper)::-webkit-scrollbar-thumb:hover {
background: #337ecc !important;
}
.scroll-table :deep(.el-table__body-wrapper)::-webkit-scrollbar-thumb:active {
background: #2b6cb0 !important;
}
/* 确保滚动条始终可见的额外设置 */
.scroll-table :deep(.el-table__body-wrapper)::-webkit-scrollbar-corner {
background: #f0f0f0;
}
/* 固定列样式优化 */
.scroll-table :deep(.el-table__fixed-right) {
box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
}
.scroll-table :deep(.el-table__fixed-left) {
box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
}
/* 确保固定列在滚动时有正确的背景色 */
.scroll-table :deep(.el-table__fixed-right .el-table__cell),
.scroll-table :deep(.el-table__fixed-left .el-table__cell) {
background-color: #fff;
}
/* 表格行悬停效果在固定列上的同步 */
.scroll-table :deep(.el-table__row:hover .el-table__cell) {
background-color: #f5f7fa !important;
}
/* 表格样式 */
.scroll-table :deep(.el-table__header-wrapper .el-table__header th) {
background-color: #f8f9fa;
color: #333;
font-weight: 600;
}
.scroll-table :deep(.el-table__body-wrapper .el-table__row:hover) {
background-color: #f5f7fa;
}
/* 分页容器样式 */
.pagination-container {
display: flex;
justify-content: flex-end;
padding: 16px 20px 0 0 !important;
background-color: #fff;
margin-top: 0px !important;
}
/* 移除按钮栏底部边框 */
.button-card :deep(.el-card__header) {
border-bottom: none !important;
}
/* 操作按钮样式 */
.action-buttons {
display: flex;
gap: 8px;
justify-content: center;
align-items: center;
white-space: nowrap;
}
/* 确保操作按钮宽度一致 */
.action-buttons .el-button {
width: 27px !important;
height: 27px !important;
padding: 0 !important;
display: flex;
align-items: center;
justify-content: center;
}
/* 搜索按钮容器样式 */
.search-btn-container {
display: flex;
justify-content: flex-end;
margin-top: 10px;
}
.search-btn-container .el-form-item {
margin-bottom: 0 !important;
}
</style>