forked from liweijie/education
139 lines
3.3 KiB
JavaScript
139 lines
3.3 KiB
JavaScript
import request from '@/utils/request'
|
||
|
||
// 教员管理:教员(JYB)+ 教员属性(JYSX)
|
||
// 接口依据:/jys/teacher/*(前端 baseURL 为 /api,此处不重复 /api 前缀)
|
||
|
||
/**
|
||
* 分页查询教员列表
|
||
* GET /jys/teacher/list
|
||
* 查询参数(JYBMapper.xml 支持):jyxm 模糊、jysdh 等值、zc 模糊、jylb 等值
|
||
*/
|
||
export function listTeacher(params) {
|
||
return request({
|
||
url: '/jys/teacher/list',
|
||
method: 'get',
|
||
params
|
||
})
|
||
}
|
||
|
||
/** 根据教员编号查询教员详情 GET /jys/teacher/get?jybh= */
|
||
export function getTeacher(jybh) {
|
||
return request({
|
||
url: '/jys/teacher/get',
|
||
method: 'get',
|
||
params: { jybh }
|
||
})
|
||
}
|
||
|
||
/**
|
||
* 新增教员 POST /jys/teacher/add
|
||
* body 为 AddTeacherDTO:{ teacher: JYB, attributes: JYSX }
|
||
* lzzt 前端不传,后端自动置 0
|
||
*/
|
||
export function addTeacher(data) {
|
||
return request({
|
||
url: '/jys/teacher/add',
|
||
method: 'post',
|
||
data
|
||
})
|
||
}
|
||
|
||
/** 更新教员基本信息 POST /jys/teacher/update(body 为 JYB,jybh 必传) */
|
||
export function updateTeacher(data) {
|
||
return request({
|
||
url: '/jys/teacher/update',
|
||
method: 'post',
|
||
data
|
||
})
|
||
}
|
||
|
||
/** 教员离职(逻辑删除)POST /jys/teacher/disable?jybh= */
|
||
export function disableTeacher(jybh) {
|
||
return request({
|
||
url: '/jys/teacher/disable',
|
||
method: 'post',
|
||
params: { jybh }
|
||
})
|
||
}
|
||
|
||
/** 教员复职(还原离职状态)POST /jys/teacher/enable?jybh= */
|
||
export function enableTeacher(jybh) {
|
||
return request({
|
||
url: '/jys/teacher/enable',
|
||
method: 'post',
|
||
params: { jybh }
|
||
})
|
||
}
|
||
|
||
/** 查询教员属性 GET /jys/teacher/attribute/get?jybh= */
|
||
export function getTeacherAttribute(jybh) {
|
||
return request({
|
||
url: '/jys/teacher/attribute/get',
|
||
method: 'get',
|
||
params: { jybh }
|
||
})
|
||
}
|
||
|
||
/** 更新教员属性 POST /jys/teacher/attribute/update(body 为 JYSX,jybh 必传) */
|
||
export function updateTeacherAttribute(data) {
|
||
return request({
|
||
url: '/jys/teacher/attribute/update',
|
||
method: 'post',
|
||
data
|
||
})
|
||
}
|
||
|
||
/** 下载教员导入模板 GET /download/jy */
|
||
export function downloadTeacherTemplate() {
|
||
return request({
|
||
url: '/download/jy',
|
||
method: 'get',
|
||
responseType: 'blob'
|
||
})
|
||
}
|
||
|
||
/** 导出教员 Excel GET /jys/teacher/export */
|
||
export function exportTeacher(params) {
|
||
return request({
|
||
url: '/jys/teacher/export',
|
||
method: 'get',
|
||
params,
|
||
responseType: 'blob'
|
||
})
|
||
}
|
||
|
||
/** 导入教员 Excel POST /jys/teacher/import */
|
||
export function importTeacher(file) {
|
||
const formData = new FormData()
|
||
formData.append('file', file)
|
||
return request({
|
||
url: '/jys/teacher/import',
|
||
method: 'post',
|
||
data: formData,
|
||
headers: { 'Content-Type': 'multipart/form-data' },
|
||
timeout: 60000
|
||
})
|
||
}
|
||
|
||
/** 单个教员补建/对齐系统账号 POST /jys/teacher/sync-user */
|
||
export function syncTeacherUser(jybh, params) {
|
||
return request({
|
||
url: '/jys/teacher/sync-user',
|
||
method: 'post',
|
||
params: Object.assign({ jybh }, params || {})
|
||
})
|
||
}
|
||
|
||
/**
|
||
* 对齐到用户表:为无账号教员批量建账号
|
||
* POST /jys/teacher/align-user body: { ids }(不传 = 全部无账号教员)
|
||
*/
|
||
export function alignTeacherUsers(ids) {
|
||
return request({
|
||
url: '/jys/teacher/align-user',
|
||
method: 'post',
|
||
data: ids && ids.length ? { ids } : {},
|
||
timeout: 180000
|
||
})
|
||
}
|