|
@@ -1,28 +1,31 @@
|
|
|
<template>
|
|
|
<div class='set-teacher'>
|
|
|
- <div class="allClassLis">
|
|
|
- <div class="allClassBtn">
|
|
|
- 合奏1班
|
|
|
+ <!-- <div class="allClassLis">
|
|
|
+ <div class="allClassBtn"
|
|
|
+ @click="getAllClassInfo(item.id)"
|
|
|
+ :class="activeAllClass==item.id?'active':''"
|
|
|
+ v-for="(item,index) in allList"
|
|
|
+ :key='index'>
|
|
|
+ {{ item.name }}
|
|
|
</div>
|
|
|
- <div class="allClassBtn active">
|
|
|
- 合奏2班
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ </div> -->
|
|
|
<div class="tableWrap">
|
|
|
<el-table :data='singinList'
|
|
|
:header-cell-style="{background:'#EDEEF0',color:'#444'}">
|
|
|
<el-table-column label="单技课班级名称"
|
|
|
prop='name'
|
|
|
- width="180px">
|
|
|
-
|
|
|
+ width="160px">
|
|
|
</el-table-column>
|
|
|
<el-table-column label="主教老师"
|
|
|
width="200px">
|
|
|
<template slot-scope="scope">
|
|
|
<div>
|
|
|
- <el-select v-model="scope.row.coreTeacher">
|
|
|
- <el-option label="张老师"
|
|
|
- value="1"></el-option>
|
|
|
+ <el-select v-model="scope.row.teacherList.coreTeacher"
|
|
|
+ v-if='scope.row.teacherList'>
|
|
|
+ <el-option v-for='(item,index) in teacherList'
|
|
|
+ :label="item.username"
|
|
|
+ :key='index'
|
|
|
+ :value="item.id"></el-option>
|
|
|
</el-select>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -32,19 +35,14 @@
|
|
|
<template slot-scope="scope">
|
|
|
<div>
|
|
|
<el-select class='tableClass'
|
|
|
- v-model="scope.row.assistant[index]"
|
|
|
- v-for="(item,index) in scope.row.assistant"
|
|
|
- :key='index'>
|
|
|
- <el-option label="张老师"
|
|
|
- value="1"></el-option>
|
|
|
- <el-option label="李老师"
|
|
|
- value="2"></el-option>
|
|
|
+ v-if='scope.row.teacherList'
|
|
|
+ multiple
|
|
|
+ v-model="scope.row.teacherList.assistant">
|
|
|
+ <el-option v-for='(item,index) in teacherList'
|
|
|
+ :label="item.username"
|
|
|
+ :key='index'
|
|
|
+ :value="item.id"></el-option>
|
|
|
</el-select>
|
|
|
- <span style="font-size:20px;">
|
|
|
- <i class="el-icon-circle-plus-outline"></i>
|
|
|
- <i class="el-icon-remove-outline"></i>
|
|
|
- </span>
|
|
|
-
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -59,12 +57,15 @@
|
|
|
|
|
|
</el-table-column>
|
|
|
<el-table-column label="主教老师"
|
|
|
- width="160px">
|
|
|
+ width="200px;">
|
|
|
<template slot-scope="scope">
|
|
|
<div>
|
|
|
- <el-select v-model="scope.row.coreTeacher">
|
|
|
- <el-option label="张老师"
|
|
|
- value="1"></el-option>
|
|
|
+ <el-select v-model="scope.row.teacherList.coreTeacher"
|
|
|
+ v-if='scope.row.teacherList'>
|
|
|
+ <el-option v-for='(item,index) in teacherList'
|
|
|
+ :label="item.username"
|
|
|
+ :key='index'
|
|
|
+ :value="item.id"></el-option>
|
|
|
</el-select>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -74,19 +75,14 @@
|
|
|
<template slot-scope="scope">
|
|
|
<div>
|
|
|
<el-select class='tableClass'
|
|
|
- v-model="scope.row.assistant[index]"
|
|
|
- v-for="(item,index) in scope.row.assistant"
|
|
|
- :key='index'>
|
|
|
- <el-option label="张老师"
|
|
|
- value="1"></el-option>
|
|
|
- <el-option label="李老师"
|
|
|
- value="2"></el-option>
|
|
|
+ multiple
|
|
|
+ v-if='scope.row.teacherList'
|
|
|
+ v-model="scope.row.teacherList.assistant">
|
|
|
+ <el-option v-for='(item,index) in teacherList'
|
|
|
+ :label="item.username"
|
|
|
+ :key='index'
|
|
|
+ :value="item.id"></el-option>
|
|
|
</el-select>
|
|
|
- <span style="font-size:20px;">
|
|
|
- <i class="el-icon-circle-plus-outline"></i>
|
|
|
- <i class="el-icon-remove-outline"></i>
|
|
|
- </span>
|
|
|
-
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -94,22 +90,127 @@
|
|
|
</div>
|
|
|
<div class="footer">
|
|
|
<div class="reset">返回修改</div>
|
|
|
- <div class="next">下一步</div>
|
|
|
+ <div class="next"
|
|
|
+ @click="gotoNext">下一步</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
+import { getEveryClass, getTeacher, setTeamTeacher } from '@/api/buildTeam'
|
|
|
export default {
|
|
|
+ props: {
|
|
|
+ teamid: {
|
|
|
+ type: String,
|
|
|
+ required: true
|
|
|
+ }
|
|
|
+ },
|
|
|
data () {
|
|
|
return {
|
|
|
- singinList: [{
|
|
|
- name: '长笛',
|
|
|
- coreTeacher: '', // 主教
|
|
|
- assistant: ['1', '2', '3'] // 助教
|
|
|
- }],
|
|
|
- allList: []
|
|
|
+ singinList: [],
|
|
|
+ allList: [],
|
|
|
+ teacherList: [],
|
|
|
+ classGroupTeacherMapperList: []
|
|
|
+ // activeAllClass: ''
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+ // 该乐团里所有的单技班与合奏班
|
|
|
+ this.getEveryClass();
|
|
|
+ // 获取所有的老师列表
|
|
|
+ getTeacher().then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.teacherList = res.data;
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 根据合奏班id获取合奏班信息
|
|
|
+ getEveryClass () {
|
|
|
+ getEveryClass({ musicGroupId: this.teamid }).then(res => {
|
|
|
+ let singinList = [];
|
|
|
+ let allList = [];
|
|
|
+ res.data.map(item => {
|
|
|
+ item.teacherList = {
|
|
|
+ coreTeacher: '',
|
|
|
+ assistant: []
|
|
|
+ }
|
|
|
+ if (item.classGroupTeacherMapperList && item.classGroupTeacherMapperList.length > 0) {
|
|
|
+ //循环老师列表分配到不同的
|
|
|
+ for (let i in item.classGroupTeacherMapperList) {
|
|
|
+ if (item.classGroupTeacherMapperList[i].teacherRole == 'BISHOP') {
|
|
|
+ item.teacherList.coreTeacher = item.classGroupTeacherMapperList[i].userId
|
|
|
+ } else if (item.classGroupTeacherMapperList[i].teacherRole == 'TEACHING') {
|
|
|
+ item.teacherList.assistant.push(item.classGroupTeacherMapperList[i].userId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (item.type == 'NORMAL') {
|
|
|
+ singinList.push(item)
|
|
|
+ }
|
|
|
+ if (item.type == 'MIX') {
|
|
|
+ allList.push(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.singinList = singinList;
|
|
|
+ this.allList = allList;
|
|
|
+ })
|
|
|
+ },
|
|
|
+ gotoNext () {
|
|
|
+ // 点击下一步
|
|
|
+
|
|
|
+ let isTeacher = true;
|
|
|
+ let isTeachers = []
|
|
|
+ // 验证单技班主教老师是否指认
|
|
|
+ for (let i in this.singinList) {
|
|
|
+
|
|
|
+ if (this.singinList[i].teacherList.coreTeacher == '') {
|
|
|
+ isTeachers.push(false)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (let j in this.allList) {
|
|
|
+ if (this.allList[j].teacherList.coreTeacher == '') {
|
|
|
+ isTeachers.push(false)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ isTeachers.filter(item => {
|
|
|
+ isTeacher = isTeacher && item
|
|
|
+ })
|
|
|
+ if (!isTeacher) {
|
|
|
+ this.$message.error('请确定每个班级都有主教老师')
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 开始拼接数据
|
|
|
+ this.addDate(this.singinList);
|
|
|
+ this.addDate(this.allList);
|
|
|
+ console.log(this.classGroupTeacherMapperList);
|
|
|
+ setTeamTeacher(this.classGroupTeacherMapperList).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.classGroupTeacherMapperList = [];
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ addDate (arr) {
|
|
|
+ for (let i in arr) {
|
|
|
+ let obj = {}
|
|
|
+ obj.classGroupId = arr[i].id;
|
|
|
+ obj.musicGroupId = this.teamid;
|
|
|
+ obj.teacherRole = 'BISHOP';
|
|
|
+ obj.userId = arr[i].teacherList.coreTeacher;
|
|
|
+ this.classGroupTeacherMapperList.push(obj)
|
|
|
+ for (let j in arr[i].teacherList.assistant) {
|
|
|
+ let obj = {}
|
|
|
+ obj.classGroupId = arr[i].id;
|
|
|
+ obj.musicGroupId = this.teamid;
|
|
|
+ obj.teacherRole = 'TEACHING';
|
|
|
+ obj.userId = arr[i].teacherList.assistant[j];
|
|
|
+ this.classGroupTeacherMapperList.push(obj)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
}
|
|
|
</script>
|
|
|
<style lang="scss" scope>
|
|
@@ -178,4 +279,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+.tableClass.el-select {
|
|
|
+ width: 100% !important;
|
|
|
+}
|
|
|
</style>
|