2022年5月29日从svn移到git

This commit is contained in:
daihh
2022-05-29 18:56:34 +08:00
commit b050613020
488 changed files with 68444 additions and 0 deletions

View File

@@ -0,0 +1,712 @@
<template>
<div class="u-page">
<div style="padding-bottom: 10px;">
<div style="display: flex;justify-content:flex-start;">
<div style="padding: 0px 5px;">
<el-select v-model="tSystemData" value-key="id" clearable @change="changeSystem" placeholder="请选择教师体系">
<el-option v-for="item in systemData" :key="item.id" :label="item.name" :value="item"></el-option>
</el-select>
</div>
<!-- 要在换一个变量与新建区别开 -->
<div style="padding: 0px 5px;">
<el-select v-model="tLevelData" clearable value-key="id" placeholder="请选择教师级别">
<el-option v-for="item in levelData" :key="item.id" :label="item.name" :value="item"></el-option>
</el-select>
</div>
<div style="padding: 0px 5px;"><el-input placeholder="请输入姓名" v-model="queryName" clearable></el-input></div>
<div style="padding: 0px 5px;">
<el-select v-model="tLevelData" clearable value-key="id" placeholder="请选择发薪地">
<el-option v-for="item in levelData" :key="item.id" :label="item.name" :value="item"></el-option>
</el-select>
</div>
</div>
<div style="margin-top:10px;padding: 0px 5px;">
<el-button icon="el-icon-search" type="primary" @click="loadData(1)">搜索</el-button>
<el-button icon="el-icon-refresh-right" type="primary" @click="reset">重置</el-button>
<el-button icon="el-icon-circle-plus-outline" type="primary" @click="openDialog">新建教师</el-button>
<el-button icon="el-icon-folder-opened" type="primary" @click="exportsExcel">导出</el-button>
</div>
</div>
<el-table ref="teacherTable" style="100%" :data="tableData" border stripe @selection-change="handleSelectionChange">
<el-table-column type="selection"></el-table-column>
<el-table-column label="姓名" prop="name" fixed>
<template slot-scope="scope">
<span @click="handleName(scope.row)">{{scope.row.name}}</span>
</template>
</el-table-column>
<el-table-column label="部门" prop="departName"></el-table-column>
<!-- <el-table-column label="创建时间" sortable prop="sysCreateTime"></el-table-column> -->
<el-table-column label="修改时间" sortable width="155" prop="sysUpdateTime"></el-table-column>
<el-table-column label="授课时长" prop="teaching"></el-table-column>
<el-table-column label="在职状态" width="90" :filters="[{ text: '在职', value: '0'}, { text: '离职', value: '1' }]"
:filter-method="filterWork">
<template slot-scope="scope">
{{scope.row.waitStatus=='0'?'在职': scope.row.waitStatus=='1' ? '离职' :''}}
</template>
</el-table-column>
<el-table-column label="认证状态" width="90" :filters="[{ text: '未认证', value: '0'}, { text: '已认证', value: '1' }]"
:filter-method="filterCertification">
<template slot-scope="scope">
{{scope.row.certStatus==0 ?'未认证': scope.row.certStatus==1 ? '已认证' :''}}
</template>
</el-table-column>
<el-table-column label="账号状态" width="90"
:filters="[{ text: '停用', value: 2}, { text: '启用', value: 1 }]"
:filter-method="filterStatus">
<template slot-scope="scope">
{{scope.row.status===2?'停用':'启用'}}
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" width="260px">
<template slot-scope="scope">
<el-tooltip effect="dark" content="导出授课记录" placement="top">
<el-button type="text" @click="exportCourse(scope.row)" icon="el-icon-folder-opened">导出</el-button>
</el-tooltip>
<el-button type="text" icon="el-icon-edit" @click="updateHandle(scope.row)">修改</el-button>
<el-button type="text" @click="delItem(scope.row)" icon="el-icon-delete">删除</el-button>
<el-button type="text" @click="accountAction(scope.row)" icon="el-icon-video-play">{{scope.row.status===2?'启用':'停用'}}</el-button>
</template>
</el-table-column>
</el-table>
<div style="text-align: center;margin-top: 70px;">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="pageIndex"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="count">
</el-pagination>
</div>
<div style="height: 100px;"></div>
<el-dialog :title="newOrEdit" custom-class="g-dialog" width="900px" :visible.sync="dialogVisible" :close-on-click-modal='false' >
<el-form label-width="100px" :model="form" ref="form" :rules="rules">
<el-form-item>
<div class="avator">
<imageUpload dir="avatar" :value="fileBaseUrl + form.account.avatar" @success="handleUploadSuccess" @remove="removeHandle"></imageUpload>
<div class="avatorText">
<p>上传头像</p>
<p>图片尺寸建议在宽100px,高100px</p>
<p>图片大小及类型1.00M|.jpg.gif.png.jpeg.bmp.</p>
</div>
</div>
</el-form-item>
<el-row>
<el-col :span='11'>
<el-form-item label="讲师账号" prop="account.loginName">
<el-input v-model="form.account.loginName" :disabled="allowInput">
<el-button slot="append" v-if="form.id == null" @click="searchUser">同步</el-button>
</el-input>
</el-form-item>
</el-col>
<el-col :span='11' :offset="2">
<el-form-item label="讲师姓名" prop="user.name">
<el-input v-model="form.user.name" disabled></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='11'>
<el-form-item label="讲师组织">
<el-input v-model="form.user.departName" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span='11' :offset="2">
<el-form-item label="初始授课时长">
<el-input v-model="form.teaching"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='11'>
<el-form-item label="讲师体系" prop="teacherBody">
<el-select v-model="tSystemData" value-key="id" clearable @change="changeSystem">
<el-option v-for="item in systemData" :key="item.id" :label="item.name" :value="item"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span='11' :offset="2">
<el-form-item label="讲师级别" prop="teacherLevel" >
<el-select v-model="tLevelData" clearable value-key="id">
<el-option v-for="item in levelData" :key="item.id" :label="item.name" :value="item"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="认证状态">
<el-radio-group v-model="form.certStatus">
<el-radio :label="0">未认证</el-radio>
<el-radio :label="1">已认证</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注">
<el-input v-model="form.description" clearable type="textarea" :autosize='{ minRows: 3, maxRows: 6 }'></el-input>
</el-form-item>
<el-form-item label="擅长课程">
<el-input v-model="form.courses" clearable placeholder="请输入"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button :loading="saveLoading" type="primary" @click="saveHandle"> </el-button>
</span>
</el-dialog>
<el-dialog
title="教师详情"
:close-on-click-modal="false"
:visible.sync="showTeacherDetails"
width="800px">
<teacher-details v-if="teacherDetailsId != ''" :id="teacherDetailsId"></teacher-details>
<span slot="footer" class="dialog-footer">
<el-button @click="handleClose"> </el-button>
<!-- <el-button type="primary" @click="showTeacherDetails = false"> </el-button> -->
</span>
</el-dialog>
</div>
</template>
<script>
import teacherApi from "@/api/modules/teacher";
import teacherBoeApi from "@/api/boe/teacher";
import userApi from "@/api/system/user";
import imageUpload from '@/components/ImageUpload/index.vue';
import teacherDetails from './teacherDetails.vue';
import { mapGetters } from 'vuex';
export default {
name: 'teacher',
components:{imageUpload,teacherDetails},
data(){
return {
teacherDetailsId: '',
showTeacherDetails:false,
tSystemData:{},
tLevelData:{},
fileBaseUrl: process.env.VUE_APP_FILE_BASE_URL,
pageIndex: 1,
pageSize: 10,
newOrEdit:'',
count: 0,
form:{
account: {avatar:'',id:'',},
user: {id:'',name:'',},
sysId:'',
photo:'',
status:1,//启用
waitStatus:0,//在职
certStatus:0,//未认证
},
rules: {
"account.loginName": [
{ required: true, message: "请输入讲师账号", trigger: "blur" },
{ max: 20, message: "长度最多20个字符", trigger: "blur" },
],
"user.name": [
{ required: true, message: "请先同步录入讲师姓名", trigger: "blur" },
],
"departName":[
{ required: false, message: "请先同步录入讲师组织", trigger: "blur"},
],
"tSystemId":[
{ required: true, message: "请选择讲师体系", trigger: "change"},
],
"tLevelId":[
{required: true, message: "请选择讲师级别", trigger: "change"}
]
},
selectList:[],
queryName:"",
dialogVisible:false,
tableData:[],
searchName:null,
havaInfo:false,
shareShow:false,
shareInfo:{
aid:'',
name:'',
toType:1,
toAid:'',
toName:'',
toInfo:'',
remark:''
},
allowInput:false,
loading:false,//控制点击启用停用的点击操作
saveLoading:false,//保存控制
systemLevelTree:[],
systemData:[],//体系数组{id,name}
levelData:[],//级别数组{id,name}
}
},
watch:{
showTeacherDetails(val) {
if(!val) {
this.teacherDetailsId = '';
}
}
},
mounted() {
this.loadData(1);
this.getTeachersystem();
},
computed: {
...mapGetters(['userInfo'])
},
methods:{
handleClose() {
console.log("1111");
// this.teacherDetailsId = '';
this.showTeacherDetails = false;
},
handleName(row) {
this.showTeacherDetails = true;
this.teacherDetailsId = row.id;
},
getTeachersystem() {
teacherBoeApi.teacherSystem(this.userInfo.sysId).then(res=>{
if(res.status == 200) {
this.systemLevelTree=res.result;
this.systemData=[];
res.result.forEach(item => {
this.systemData.push({
id:item.teacher_system_id,
name:item.system_name
})
});
} else {
this.$message.error('教师体系数据获取失败!')
}
})
},
changeSystem(val){
//console.log(val,'val');
let array=[];
this.systemLevelTree.forEach(sl=>{
if(sl.teacher_system_id==val.id){
sl.teacher_level.forEach(lev=>{
array.push({
id:lev.teacher_level_id,
name:lev.level_name
})
})
}
});
this.levelData=array;
},
reset (){
this.queryName = '';
this.$refs.teacherTable.clearFilter();
this.loadData(1);
},
openDialog(){
this.saveLoading=false;
this.newOrEdit='新建教师';
this.allowInput=false;
this.searchName='',
this.form = {
account: {avatar:'',id:''},
user: {id:'',name:''},
sysId:'',
photo:'',
status:1,//启用
waitStatus:0,//在职
certStatus:0,//未认证
}
this.dialogVisible=true
},
filterWork(value,row){
return row.waitStatus==value
},
filterCertification(value,row){
// console.log(row.certificationStatus,value)
return row.certStatus==value
},
filterStatus(value,row){
//console.log(row.status,value,"qwerqw");
return row.status==value
},
shareItem(item){
this.shareShow=true;
},
setTop(item,idx){
let msg='已设置置顶';
if(item.isTop){
item.isTop=false;
msg='已取消置顶';
}else{
item.isTop=true;
}
this.$message({message:msg,type:'success',offset:50});
},
setEssence(item,idx){ //没有了
let msg='已设置精华';
if(item.isEssence){
item.isEssence=false;
msg='已取消精华';
}else{
item.isEssence=true;
}
this.$message({message:msg,type:'success',offset:50});
},
delItem(row){
this.$confirm('您确定要删除所选教师吗?', '删除提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
teacherApi.del(row.id).then(res =>{
if(res.status == 200){
if(row.sysId){
this.deleteTeacher(row.sysId)
}
this.loadData(1);
this.$message({type: 'success',message: '删除成功!',offset:50});
}
});
});
},
deleteTeacher(id){
teacherBoeApi.deleteTeacher(id).then(res=>{
console.log(res);
})
},
handleSelectionChange(data){
this.selectList=data
},
searchUser(){
if(this.form.account&&this.form.account.loginName){
userApi.searchLoginName(this.form.account.loginName).then((res) => {
if (res.status == 200 && res.result != null) {
this.havaInfo = true;
this.form.account = res.result.account;
// this.fileBaseUrl +
this.form.account.avatar = this.fileBaseUrl + res.result.account.avatar;
this.form.user = res.result;
} else {
this.havaInfo = false;
this.form.account = {};
this.form.user = {};
this.$message({ type: "info", message: "未找到相关信息" });
}
});
}
},
removeHandle(){
this.form.account.avatar = '';
},
handleUploadSuccess(res){
this.form.account.avatar = res.result.filePath;
},
saveHandle(){
//console.log(this.tSystemData,'tSystemData');
//console.log(this.tLevelData,'tLevelData');
this.form.tsystemId = this.tSystemData.id;
this.form.tsystemName=this.tSystemData.name;
this.form.tlevelId = this.tLevelData.id;
this.form.tlevelName=this.tLevelData.name;
this.$refs.form.validate((valid) => {
if (valid) {
this.saveLoading=true;
if(this.form.id == null || this.form.id == ''){
teacherApi.save(this.form).then((res) => {
if (res.status == 200) {
//this.$message({ type: "success", message: "保存成功" });
this.saveBoe();
this.dialogVisible = false;
this.loadData(1);
}else{
this.$message({ type: "error", message: res.message });
}
}).catch(err => {
this.$message({ type: "error", message: err });
});
}else{
teacherApi.update(this.form).then((res) => {
if (res.status == 200) {
this.saveBoe();
//this.$message({ type: "success", message: "保存成功" });
this.dialogVisible = false;
this.loadData(1);
}else{
this.$message({ type: "error", message: res.message });
}
}).catch(err => {
this.$message({ type: "error", message: err });
});
}
}
});
},
saveBoe() {
let data = {
teacher_user_id:this.form.user.sysId,// 教师对应的用户的id
teacher_id:this.form.sysId, // 教师id ,有则编辑,没有则新建教师
teacher_type:"0", // 教师类型0内部讲师1外聘讲师2助教
teacher_name:this.form.user.name, // 教师名称
teacher_thumb_url:this.form.account.avatar, // 头像地址
description:this.form.user.description, // 介绍
teacher_system:this.tSystemData.name, // 体系名称
teacher_system_id:this.tSystemData.id, // 体系id
default_teaching_time:this.form.teaching, //初始授课时长
teacher_level_id:this.tLevelData.id, // 讲师级别id
teacher_level:this.tLevelData.name, // 讲师级别名称
is_certify:this.form.certStatus, //是否认证 0:未认证 1:已认证)
certification:"", //认证资料图片地址
remark:this.form.description, // 备注
email:"", // 邮件(外部讲师填写)
mobile_no:this.form.user.mobileNo // 手机号码(外部讲师填写)
}
teacherBoeApi.editTeacher(data).then(res=>{
this.saveLoading=false;
if(res.status == 200) {
this.updateSysId(this.form.user.id,res.result.sysId);
this.$message({ type: "success", message: "保存成功" });
}else{
this.$message({ type: "warning", message: "同步失败,本地已保存" });
}
})
},
updateSysId(id,sysId) {
teacherBoeApi.updateSysId(id,sysId).then(res=>{
if(res.status == 200) {
this.$message.success('教师同步成功!')
} else {
this.$message.success('教师同步失败!请手动同步!')
}
})
},
updateHandle(data){
this.saveLoading=false;
this.newOrEdit='编辑教师';
this.allowInput=true;
teacherApi.detail(data.id).then(res => {
if (res.status == 200) {
const result = res.result;
this.form = result;
this.dialogVisible = true;
}
})
},
loadData(pageIndex) {
this.pageIndex = pageIndex;
teacherApi
.page({
pageIndex: this.pageIndex,
pageSize: this.pageSize,
name: this.queryName ,
})
.then((res) => {
if (res.status == 200) {
const result = res.result;
this.tableData = result.list;
this.count = result.count;
this.loading = false;
}
})
.catch((err) => {
this.$message({ type: "error", message: "查询数据错误:" + err });
});
},
//账号启用和停用
accountAction(row){
if(this.loading){
return
}
if(row.status==2){
teacherApi.start(row.id).then(res=>{
if(res.status==200){
this.$nextTick(()=>{
row.status=1;
this.loading=false;
this.$message.success("启用成功")
this.updateStatus(row);
})
}
})
}else{
this.$confirm('您确定要停用该教师吗?', '删除提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
teacherApi.end(row.id).then(res=>{
if(res.status==200){
this.$nextTick(()=>{
row.status=2;
this.loading=false;
this.$message.success("停用成功")
this.updateStatus(row);
})
}
})
});
}
},
updateStatus(row) {
let status = null;
if(row.status == 2){
status = 1;
} else {
status = 2;
}
let param = {
teacher_id: row.id,
status:status,// 状态0临时1正式2停用
}
teacherBoeApi.updateStatus(param).then(res=>{
console.log(res,'res');
})
},
exportsExcel(){
let ids = [];
if(this.selectList.length > 0) {
this.selectList.forEach((item,index)=>{
ids.push(item.id);
})
ids = ids.join();
}
//如果是勾选的那需要传id的值使用逗号分隔
//get请求
// var eleLink = document.createElement('a');
// eleLink.download = '教师列表';
// eleLink.style.display = 'none';
// eleLink.href = `${process.env.VUE_APP_BASE_API}/xboe/teacher/export?name=${this.queryName}`;
// document.body.appendChild(eleLink);
// eleLink.click();
// 然后移除
// document.body.removeChild(eleLink);
//post请求
var eleForm=document.createElement('form');
eleForm.style="display:none;";
eleForm.method='post';
eleForm.action=`${process.env.VUE_APP_BASE_API}/xboe/teacher/export?name=${this.queryName}`;
var hdnFilePath = document.createElement('input');
hdnFilePath.type = 'hidden';
hdnFilePath.name = 'ids';
hdnFilePath.value = ids;
eleForm.appendChild(hdnFilePath);
document.body.appendChild(eleForm);
eleForm.submit();
document.body.removeChild(eleForm);
},
exportCourse(row){
var eleLink = document.createElement('a');
eleLink.download = '教师授课信息';
eleLink.style.display = 'none';
eleLink.setAttribute('target', '_blank');
eleLink.href = `${process.env.VUE_APP_BASE_API}/xboe/m/course/manage/export-teacher-course?teacherId=${row.id}`;
document.body.appendChild(eleLink);
eleLink.click();
document.body.removeChild(eleLink);
},
handleSizeChange(val) {
this.pageSize = val
this.pageIndex = 1
this.loadData(this.pageIndex)
},
handleCurrentChange(val) {
this.pageIndex = val
this.loadData(this.pageIndex)
},
}
}
</script>
<style lang="scss" scoped>
.el-form{
.avator{
height: 200px;
display: flex;
justify-content: flex-start;
align-items: center;
padding: 5px 20px;
border: 1px solid rgb(219, 219, 219);
.avatorText{
// width: 500px;
p{
line-height: 1;
margin: 30px auto 30px 20px;
}
}
}
}
.article-status1{
padding: 3px;
border: 1px dotted #1EA0FA;
color:#1EA0FA;
}
.article-status2{
padding: 3px;
border: 1px dotted #00aa00;
color:#00aa00;
}
.article-status3{
padding: 3px;
border: 1px dotted #ff0000;
color:#ff0000;
}
.article-list {
margin: 5px 0;
border: 1px solid #dddddd;
padding: 10px;
}
.article-info {
.article-info-title {
font-size: 16px;
font-weight: 400;
height: 40px;
line-height: 40px;
.article-info-date {
width: 150px;
height: 40px;
line-height: 40px;
float: right;
font-weight: 200;
color: #999999;
i {
margin-right: 5px;
}
}
}
.article-info-summary {
height: 65px;
color: #999999;
}
.article-info-tools {
height: 30px;
.article-info-tools-auth {
float: left;
font-size: 13px;
color: #999999;
img {
margin-right: 10px;
width: 30px;
border: 1px solid #eee;
border-radius: 50%;
vertical-align: middle;
}
}
.article-info-tools-btns {
float: right;
.article-info-tools-btn {
margin: 0 0 0 15px;
}
}
}
}
.case-row-btn{
line-height: 25px;
button{
height: 20px;
padding: 3px 20px;
}
}
</style>