455 lines
11 KiB
TypeScript
455 lines
11 KiB
TypeScript
import request from '@/utils/request'
|
|
import { AxiosPromise } from 'axios'
|
|
import { getToken } from '@/utils/auth'
|
|
|
|
// 学生信息数据类型
|
|
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[]> {
|
|
console.log('调用班主任API: /xg/classInfo/teacherOptions')
|
|
return request({
|
|
url: '/xg/classInfo/teacherOptions',
|
|
method: 'get',
|
|
headers: {
|
|
// 确保请求带有认证信息
|
|
'Authorization': 'Bearer ' + getToken(),
|
|
'clientid': import.meta.env.VITE_APP_CLIENT_ID
|
|
}
|
|
})
|
|
}
|
|
|
|
// 检查学号是否存在
|
|
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'
|
|
})
|
|
}
|