This commit is contained in:
zhaofang
2022-07-29 16:45:41 +08:00
parent f15fb2fea2
commit 7aa2211f61
2 changed files with 39 additions and 9 deletions

View File

@@ -5,7 +5,18 @@
v-for="(item,index) in teacherValueList"
:key="item.teacherId"
@close="handleClose(item,index)">{{item.teacherName}}</el-tag>
<el-select
<el-input
placeholder="请输入授课教师姓名"
v-model="teacherValues"
clearable>
<el-button :loading="loading" slot="append" icon="el-icon-search" @click="remoteFindTeacher()"></el-button>
</el-input>
<div class="choice-box" v-if="teacherDownList.length>0">
<ul>
<li v-for="te in teacherDownList" :key="te.key" @click="changeTeachers(te)">{{te.teacherName + te.teacherCode}}</li>
</ul>
</div>
<!-- <el-select
style="width: 100%;"
v-model="teacherValues"
filterable
@@ -19,7 +30,7 @@
:remote-method="remoteFindTeacher"
:loading="loading">
<el-option v-for="item in teacherDownList" :key="item.teacherId" :label="item.teacherName + item.teacherCode" :value="item"></el-option>
</el-select>
</el-select> -->
</div>
</template>
@@ -39,7 +50,7 @@
data(){
return {
teacherValueList:[],
teacherValues:{},
teacherValues:'',
loading:false,
teacherDownList:[],
}
@@ -60,23 +71,24 @@
if(t) {
let isCan = this.teacherValueList.some(it=>it.teacherId == t.teacherId);
if(isCan){
this.teacherValues = {};
this.teacherValues = '';
this.teacherDownList = [];
this.$message.warning('教师重复,请重新选择!')
return;
}
this.teacherValueList.push(t);
this.teacherDownList = [];
this.teacherValues = {};
this.teacherValues = '';
this.$emit('getTeacherList',this.teacherValueList);
}
},
// 教师列标,远程查询
async remoteFindTeacher(query) {
if (query) {
async remoteFindTeacher() {
console.log("2222");
if (this.teacherValues !== '') {
this.loading = true;
try {
const { result, message, status } = await apiTeacher.findByName(query);
const { result, message, status } = await apiTeacher.findByName(this.teacherValues);
this.loading = false;
if (status === 200) {
let list = [];
@@ -104,10 +116,28 @@
</script>
<style lang="scss">
.choice{
position: relative;
.el-tag--info{
height: 22px;
line-height: 22px;
}
.choice-box{
position: absolute;
// top: 40px;
width: 280px;
z-index: 999;
background: #fff;
border-radius: 4px;
border: 1px solid #eee;
box-shadow: 3px 3px 3px 3px #eee;
ul{
margin: 0;
padding:0 10px;
}
li{
list-style: none;
}
}
}
</style>

View File

@@ -81,7 +81,7 @@ import {userAvatarText,cutFullName} from "@/utils/tools.js";
mounted() {
this.sex = this.userInfo.sex;
// 判断路由是进入的学员默认页面就重置setCurIdentity
if(this.$route.path == '/uc/study/task'){
if(this.$route.path == '/uc/study/task' || this.$route.path == '/study/index'){
this.setCurIdentity(1);
}
//let testName='京东方科技集团股份有限公司/北京中祥英科技有限公司/技术中心';