Merge remote-tracking branch 'origin/teacher' into dev

This commit is contained in:
zhaofang
2022-06-06 16:30:59 +08:00
5 changed files with 209 additions and 46 deletions

View File

@@ -26,6 +26,13 @@ import ajax from '@/api/boe/boeApiAjax.js'
const editTeacher = function(data) { const editTeacher = function(data) {
return ajax.postJson('/b1/system/teacher/add-and-edit-teacher',data); return ajax.postJson('/b1/system/teacher/add-and-edit-teacher',data);
} }
// api
/**
* 发薪地接口
*/
const getPayrollPlace = function(id) {
return ajax.get('/b1/system/teacher/payroll-place');
}
/** /**
* 教师体系和级别接口 * 教师体系和级别接口
* @param { * @param {
@@ -141,5 +148,6 @@ export default {
getCourseInfo, getCourseInfo,
teacherUpgradePrecess, teacherUpgradePrecess,
deleteModelTeacher, deleteModelTeacher,
editModelTeacher editModelTeacher,
getPayrollPlace
} }

View File

@@ -23,6 +23,10 @@ const getInfoById = function(id) {
* pageIndex 起始页 * pageIndex 起始页
* pageSize 每页条数 * pageSize 每页条数
* name 姓名 * name 姓名
* tlevelId级别
* salaryId发薪地
* tsystemId
* } query * } query
* @returns * @returns
*/ */
@@ -104,7 +108,7 @@ const save = function(data) {
* @param {teacherId->sysId : 原系统的id,接口返回} sysId * @param {teacherId->sysId : 原系统的id,接口返回} sysId
*/ */
const updateSysId = function(id,sysId) { const updateSysId = function(id,sysId) {
return ajax.postJson('/xboe/teacher/update-sysid',{id,sysId}); return ajax.post('/xboe/teacher/update-sysid',{id,sysId});
} }
@@ -183,6 +187,17 @@ const exports=function(query){
const findAllCourses=function(query){ const findAllCourses=function(query){
return ajax.post('/xboe/teacher/compose/find/courses',query); return ajax.post('/xboe/teacher/compose/find/courses',query);
} }
/**
* 内部讲师-删除模块讲师接口
* @param {
courseId // 课程id
modId // 模块id
teacherId // 教师id
remark // 备注
*/
const syncUpdate = function(data) {
return ajax.postJson('/xboe/teacher/update-sync',data);
}
export default { export default {
findByName, findByName,
@@ -197,5 +212,6 @@ export default {
has, has,
start, start,
end, end,
exports exports,
syncUpdate
} }

View File

@@ -3,20 +3,20 @@
<div style="padding-bottom: 10px;"> <div style="padding-bottom: 10px;">
<div style="display: flex;justify-content:flex-start;"> <div style="display: flex;justify-content:flex-start;">
<div style="padding: 0px 5px;"> <div style="padding: 0px 5px;">
<el-select v-model="tSystemData" value-key="id" clearable @change="changeSystem" placeholder="请选择教师体系"> <el-select v-model="query.tSystemId" value-key="id" clearable @change="queryChangeSystem" placeholder="请选择教师体系">
<el-option v-for="item in systemData" :key="item.id" :label="item.name" :value="item"></el-option> <el-option v-for="item in systemData" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select> </el-select>
</div> </div>
<!-- 要在换一个变量与新建区别开 --> <!-- 要在换一个变量与新建区别开 -->
<div style="padding: 0px 5px;"> <div style="padding: 0px 5px;">
<el-select v-model="tLevelData" clearable value-key="id" placeholder="请选择教师级别"> <el-select v-model="query.tLevelId" clearable value-key="id" placeholder="请选择教师级别">
<el-option v-for="item in levelData" :key="item.id" :label="item.name" :value="item"></el-option> <el-option v-for="item in queryLevelData" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select> </el-select>
</div> </div>
<div style="padding: 0px 5px;"><el-input placeholder="请输入姓名" v-model="queryName" clearable></el-input></div> <div style="padding: 0px 5px;"><el-input placeholder="请输入姓名" v-model="query.queryName" clearable></el-input></div>
<div style="padding: 0px 5px;"> <div style="padding: 0px 5px;">
<el-select v-model="tLevelData" clearable value-key="id" placeholder="请选择发薪地"> <el-select v-model="query.salaryId" clearable value-key="id" placeholder="请选择发薪地">
<el-option v-for="item in levelData" :key="item.id" :label="item.name" :value="item"></el-option> <el-option v-for="item in placeList" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select> </el-select>
</div> </div>
</div> </div>
@@ -74,9 +74,9 @@
background background
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
:current-page="pageIndex" :current-page="query.pageIndex"
:page-sizes="[10, 20, 30, 40]" :page-sizes="[10, 20, 30, 40]"
:page-size="pageSize" :page-size="query.pageSize"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:total="count"> :total="count">
</el-pagination> </el-pagination>
@@ -86,7 +86,7 @@
<el-form label-width="100px" :model="form" ref="form" :rules="rules"> <el-form label-width="100px" :model="form" ref="form" :rules="rules">
<el-form-item> <el-form-item>
<div class="avator"> <div class="avator">
<imageUpload dir="avatar" :value="fileBaseUrl + form.account.avatar" @success="handleUploadSuccess" @remove="removeHandle"></imageUpload> <imageUpload dir="avatar" :value="coverImage" @success="handleUploadSuccess" @remove="removeHandle"></imageUpload>
<div class="avatorText"> <div class="avatorText">
<p>上传头像</p> <p>上传头像</p>
<p>图片尺寸建议在宽100px,高100px</p> <p>图片尺寸建议在宽100px,高100px</p>
@@ -180,6 +180,15 @@
components:{imageUpload,teacherDetails}, components:{imageUpload,teacherDetails},
data(){ data(){
return { return {
query:{
tSystemId:'',
tSystemIds:'',
tLevelId:'',
queryName:'',
salaryId:'',
pageIndex: 1,
pageSize: 10,
},
teacherDetailId:'',//新数据id teacherDetailId:'',//新数据id
teacherDetailsId: '',// sid teacherDetailsId: '',// sid
showTeacherDetails:false, showTeacherDetails:false,
@@ -239,6 +248,10 @@
systemLevelTree:[], systemLevelTree:[],
systemData:[],//体系数组{id,name} systemData:[],//体系数组{id,name}
levelData:[],//级别数组{id,name} levelData:[],//级别数组{id,name}
queryLevelData:[],
teacherSystemids:[],
coverImage:'',
placeList:[],
} }
}, },
watch:{ watch:{
@@ -248,14 +261,27 @@
} }
} }
}, },
mounted() { mounted() {
this.loadData(1); this.getTeachersystem();
this.getTeachersystem(); this.getPayrollPlace();
}, },
computed: { computed: {
...mapGetters(['userInfo']) ...mapGetters(['userInfo'])
}, },
methods:{ methods:{
getPayrollPlace(){
teacherBoeApi.getPayrollPlace().then(res=>{
// console.log(res,'res');
if(res.status == '200') {
for(let i in res.result){
this.placeList.push({
value:i,
label:res.result[i]
})
}
}
})
},
handleCloseOne() { handleCloseOne() {
// this.teacherDetailsId = ''; // this.teacherDetailsId = '';
this.showTeacherDetails = false; this.showTeacherDetails = false;
@@ -272,18 +298,38 @@
this.systemLevelTree=res.result; this.systemLevelTree=res.result;
this.systemData=[]; this.systemData=[];
res.result.forEach(item => { res.result.forEach(item => {
this.teacherSystemids.push(item.teacher_system_id);
this.systemData.push({ this.systemData.push({
id:item.teacher_system_id, id:item.teacher_system_id,
name:item.system_name name:item.system_name
}) })
}); });
this.loadData(1);
} else { } else {
this.$message.error('教师体系数据获取失败!') this.$message.error('教师体系数据获取失败!')
this.loadData(1);
} }
}) })
}, },
queryChangeSystem(val) {
this.query.tLevelId = '';
let array=[];
this.systemLevelTree.forEach(sl=>{
if(sl.teacher_system_id==val){
sl.teacher_level.forEach(lev=>{
array.push({
id:lev.teacher_level_id,
name:lev.level_name
})
})
}
});
this.queryLevelData=array;
},
changeSystem(val){ changeSystem(val){
//console.log(val,'val'); this.tLevelData = {};
this.form.tlevelId = '';
this.form.tlevelName='';
let array=[]; let array=[];
this.systemLevelTree.forEach(sl=>{ this.systemLevelTree.forEach(sl=>{
if(sl.teacher_system_id==val.id){ if(sl.teacher_system_id==val.id){
@@ -302,7 +348,13 @@
this.loadData(1); this.loadData(1);
}, },
reset (){ reset (){
this.queryName = ''; this.query.queryName = '';
this.query.tSystemId='',
this.query.tLevelId='',
this.query.queryName='',
this.query.salaryId='',
this.query.pageIndex= 1,
this.query.pageSize= 10,
this.$refs.teacherTable.clearFilter(); this.$refs.teacherTable.clearFilter();
this.pageIndex = 1; this.pageIndex = 1;
this.loadData(1); this.loadData(1);
@@ -389,8 +441,9 @@
if (res.status == 200 && res.result != null) { if (res.status == 200 && res.result != null) {
this.havaInfo = true; this.havaInfo = true;
this.form.account = res.result.account; this.form.account = res.result.account;
// this.fileBaseUrl + if(res.result.photo != '') {
this.form.account.avatar = this.fileBaseUrl + res.result.account.avatar; this.coverImage = this.fileBaseUrl+res.result.photo;
}
this.form.user = res.result; this.form.user = res.result;
} else { } else {
this.havaInfo = false; this.havaInfo = false;
@@ -403,13 +456,15 @@
}, },
removeHandle(){ removeHandle(){
this.form.account.avatar = ''; this.form.account.avatar = '';
this.coverImage = '';
this.form.photo = '';
}, },
handleUploadSuccess(res){ handleUploadSuccess(res){
this.coverImage = this.fileBaseUrl + res.result.filePath;
this.form.account.avatar = res.result.filePath; this.form.account.avatar = res.result.filePath;
this.form.photo = res.result.filePath;
}, },
saveHandle(){ saveHandle(){
//console.log(this.tSystemData,'tSystemData');
//console.log(this.tLevelData,'tLevelData');
this.form.tsystemId = this.tSystemData.id; this.form.tsystemId = this.tSystemData.id;
this.form.tsystemName=this.tSystemData.name; this.form.tsystemName=this.tSystemData.name;
this.form.tlevelId = this.tLevelData.id; this.form.tlevelId = this.tLevelData.id;
@@ -424,10 +479,12 @@
this.saveBoe(); this.saveBoe();
this.dialogVisible = false; this.dialogVisible = false;
this.loadData(1); this.loadData(1);
this.saveLoading = false;
}else{ }else{
this.$message({ type: "error", message: res.message }); this.$message({ type: "error", message: res.message });
} }
}).catch(err => { }).catch(err => {
this.saveLoading = false;
this.$message({ type: "error", message: err }); this.$message({ type: "error", message: err });
}); });
}else{ }else{
@@ -438,9 +495,11 @@
this.dialogVisible = false; this.dialogVisible = false;
this.loadData(1); this.loadData(1);
}else{ }else{
this.saveLoading = false;
this.$message({ type: "error", message: res.message }); this.$message({ type: "error", message: res.message });
} }
}).catch(err => { }).catch(err => {
this.saveLoading = false;
this.$message({ type: "error", message: err }); this.$message({ type: "error", message: err });
}); });
} }
@@ -469,7 +528,7 @@
teacherBoeApi.editTeacher(data).then(res=>{ teacherBoeApi.editTeacher(data).then(res=>{
this.saveLoading=false; this.saveLoading=false;
if(res.status == 200) { if(res.status == 200) {
this.updateSysId(this.form.user.id,res.result.sysId); this.updateSysId(this.form.user.id,res.result.teacher_id);
this.$message({ type: "success", message: "保存成功" }); this.$message({ type: "success", message: "保存成功" });
}else{ }else{
this.$message({ type: "warning", message: "同步失败,本地已保存" }); this.$message({ type: "warning", message: "同步失败,本地已保存" });
@@ -477,7 +536,7 @@
}) })
}, },
updateSysId(id,sysId) { updateSysId(id,sysId) {
teacherBoeApi.updateSysId(id,sysId).then(res=>{ teacherApi.updateSysId(id,sysId).then(res=>{
if(res.status == 200) { if(res.status == 200) {
this.$message.success('教师同步成功!') this.$message.success('教师同步成功!')
} else { } else {
@@ -486,6 +545,7 @@
}) })
}, },
updateHandle(data){ updateHandle(data){
this.coverImage = '';
this.saveLoading=false; this.saveLoading=false;
this.newOrEdit='编辑教师'; this.newOrEdit='编辑教师';
this.allowInput=true; this.allowInput=true;
@@ -493,18 +553,46 @@
if (res.status == 200) { if (res.status == 200) {
const result = res.result; const result = res.result;
this.form = result; this.form = result;
this.dialogVisible = true; this.tSystemData = {
id:result.tsystemId,
name:result.tlevelName
};
this.tLevelData = {
id:result.tlevelId,
name: result.tlevelName
};
if(res.result.photo != '') {
this.coverImage = this.fileBaseUrl+res.result.photo;
}
this.updateSystem(result.tsystemId)
this.dialogVisible = true;
} }
}) })
}, },
updateSystem(val) {
let array=[];
this.systemLevelTree.forEach(sl=>{
if(sl.teacher_system_id==val){
sl.teacher_level.forEach(lev=>{
array.push({
id:lev.teacher_level_id,
name:lev.level_name
})
})
}
});
this.levelData=array;
},
loadData(pageIndex) { loadData(pageIndex) {
this.pageIndex = pageIndex; this.query.pageIndex = pageIndex;
this.query.tSystemIds = this.query.tSystemId || this.teacherSystemids.join();
teacherApi teacherApi
.page({ .page(
pageIndex: this.pageIndex, this.query
pageSize: this.pageSize, // pageIndex: this.pageIndex,
name: this.queryName , // pageSize: this.pageSize,
}) // name: this.queryName,
)
.then((res) => { .then((res) => {
if (res.status == 200) { if (res.status == 200) {
const result = res.result; const result = res.result;
@@ -613,13 +701,13 @@
document.body.removeChild(eleLink); document.body.removeChild(eleLink);
}, },
handleSizeChange(val) { handleSizeChange(val) {
this.pageSize = val this.query.pageSize = val
this.pageIndex = 1 this.query.pageIndex = 1
this.loadData(this.pageIndex) this.loadData(this.query.pageIndex)
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
this.pageIndex = val this.query.pageIndex = val
this.loadData(this.pageIndex) this.loadData(this.query.pageIndex)
}, },
} }
} }

View File

@@ -3,16 +3,16 @@
<el-tabs v-model="activeName" @tab-click="handleClick"> <el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="个人详情" name="first"> <el-tab-pane label="个人详情" name="first">
<div class="one"> <div class="one">
<el-row :gutter="10"> <el-row :gutter="10" style="width:720px">
<el-col :span="24"> <el-col :span="24">
<el-form label-width="120px" size="mini"> <el-form label-width="120px" size="mini">
<el-form-item label="头像:"> <el-form-item label="头像:">
<div style="width: 90px;height: 90px" v-if="newForm && newForm.account && newForm.account.avatar == ''"> <div style="width: 90px;height: 90px" v-if="newForm && newForm.photo == ''">
<img style="width:100%;height:100%" v-if="newForm.gender == 1" :src="webBaseUrl + '/images/Avatarman.png'" alt="" srcset=""> <img style="width:100%;height:100%" v-if="newForm.gender == 1" :src="webBaseUrl + '/images/Avatarman.png'" alt="" srcset="">
<img style="width:100%;height:100%" v-else :src="webBaseUrl + '/images/Avatarwoman.png'" alt="" srcset=""> <img style="width:100%;height:100%" v-else :src="webBaseUrl + '/images/Avatarwoman.png'" alt="" srcset="">
</div> </div>
<div style="width: 90px;height: 90px" v-else> <div style="width: 90px;height: 90px" v-else>
<img style="width:100%;height:100%" :src="newForm && newForm.account && newForm.account.avatar" alt="" srcset=""> <img style="width:100%;height:100%" :src="fileBaseUrl + newForm.photo" alt="" srcset="">
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="讲师账号:"> <el-form-item label="讲师账号:">
@@ -47,7 +47,7 @@
<el-col :span="12">{{formatsec(form.certify_at *1000)}}</el-col> <el-col :span="12">{{formatsec(form.certify_at *1000)}}</el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="认证资料:"> <el-form-item label="认证资料:">
<!-- <a href="http://" target="_blank" rel="noopener noreferrer"></a> --> <i style="color:blue" title="点击下载" @click="downloadActioon(form.certification)" class="el-icon-download"></i>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-form-item> </el-form-item>
@@ -169,7 +169,7 @@
label="课程类型" label="课程类型"
width="100"> width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.courseType == '0'">在线班</span> <span v-if="scope.row.courseType == '0'">录播</span>
<span v-if="scope.row.courseType == '1'">面授</span> <span v-if="scope.row.courseType == '1'">面授</span>
<span v-if="scope.row.courseType == '2'">线下课</span> <span v-if="scope.row.courseType == '2'">线下课</span>
</template> </template>
@@ -274,10 +274,10 @@ export default {
name: "teacherDetails", name: "teacherDetails",
components: { imageUpload }, components: { imageUpload },
props: { props: {
id:{ id:{// sysId
type: String, type: String,
}, },
newId:{ newId:{// id
type: String, type: String,
} }
}, },
@@ -286,9 +286,11 @@ export default {
formatsec, formatsec,
formatSeconds, formatSeconds,
baseUrl: process.env.VUE_APP_BASE_API, baseUrl: process.env.VUE_APP_BASE_API,
fileBaseUrl: process.env.VUE_APP_FILE_BASE_URL,
newForm:{ newForm:{
account:{}, account:{},
user:{}, user:{},
photo:''
}, },
dialogVisible:false, dialogVisible:false,
activeName: "first", activeName: "first",
@@ -332,14 +334,26 @@ export default {
...mapGetters(["userInfo"]) ...mapGetters(["userInfo"])
}, },
methods: { methods: {
downloadActioon(filePath) {
if (!filePath) return;
let link = document.createElement('a'); //创建a标签
link.style.display = 'none'; //使其隐藏
link.download = this.fileBaseUrl + filePath;
link.setAttribute('target', '_blank');
link.href = this.fileBaseUrl + filePath; //赋予文件下载地址
link.setAttribute('download', '资料'); //设置下载属性 以及文件名
document.body.appendChild(link); //a标签插至页面中
link.click(); //强制触发a标签事件
document.body.removeChild(link);
},
getAvatar(){ getAvatar(){
teacherApi.detail(this.newId).then(res => { teacherApi.detail(this.newId).then(res => {
if (res.status == 200) { if (res.status == 200) {
// const result = res.result; // const result = res.result;
this.newForm = res.result; this.newForm = res.result;
if(res.result.account.avatar != '') { // if(res.result.account.avatar != '') {
this.newForm.account.avatar = this.baseUrl + res.result.account.avatar; // this.newForm.account.avatar = this.baseUrl + res.result.account.avatar;
} // }
} }
}) })
}, },
@@ -485,11 +499,47 @@ export default {
if (res.status == 200) { if (res.status == 200) {
const result = res.result; const result = res.result;
this.form = result; this.form = result;
this.synchronization(res.result);
} else { } else {
this.$message.error(res.message); this.$message.error(res.message);
} }
}); });
},
synchronization(result) {
let param = {
id: this.newId,//当前老师记录的id
/**因为有可能部分老师没有这个字段,对应返回的teacher_id*/
sysId: result.teacher_id,
/**因为有可能部分老师没有这个字段*/
companyId: result.company_id,
companyName: result.company_name,
teacherCode: result.teacher_code,
/**返回的字段,不知道什么意义*/
teacherType: result.teacher_type,
userId: result.user_id,
userNo: result.user_no,
gender: result.gender,
teachingTime: result.teaching_time,
certification: result.certification,
language: result.language,
timezone: result.timezone,
tsystemId: result.system_id,
tsystemName: result.system_name,
tlevelId: result.level_id,
tlevelName: result.level_name,
/**认证人*/
certifyby: result.certify_by,
/**状态0临时1正式2停用*/
pstatus: result.status,
/**员工状态 2正常 3离职*/
pemployeeStatus: result.employee_status,
} }
teacherApi.syncUpdate(param).then(res=>{
if(res.status != 200) {
console.log(res)
}
})
}
} }
}; };
</script> </script>

View File

@@ -110,6 +110,7 @@ module.exports = {
// 使用代理 // 使用代理
// 172.16.6.175 // 172.16.6.175
// 114.115.162.187 测试环境 // 114.115.162.187 测试环境
// 192.168.0.107 晋宇
proxy: { proxy: {
'/systemapi': { '/systemapi': {
// 目标代理服务器地址 // 目标代理服务器地址