|
@@ -5,7 +5,7 @@
|
|
|
<Select v-model="curClassCode" style="width:200px">
|
|
|
<Option v-for="(item,index) in classList" :value="item.id" :key="index" @click.native="selectClass(index)">{{ item.name }}</Option>
|
|
|
</Select>
|
|
|
- <span v-if="classList[curClassIndex]" style="margin-left: 10px;color: #aaaaaa;">
|
|
|
+ <span v-if="classList[curClassIndex] && classList[curClassIndex].students" style="margin-left: 10px;color: #aaaaaa;">
|
|
|
{{$t('cusMgt.stuCount')}}{{classList[curClassIndex].students.length}}
|
|
|
</span>
|
|
|
<Button :disabled="!updated" size="small" style="float:right;margin-right:30px;margin-top:10px;" @click="saveGroup" icon="ios-albums-outline">保存分组</Button>
|
|
@@ -177,7 +177,7 @@ export default {
|
|
|
},
|
|
|
{
|
|
|
slot: 'action',
|
|
|
- title: this.$t('cusMgt.searchHolder'),
|
|
|
+ title: ' ',
|
|
|
align: 'center'
|
|
|
}
|
|
|
]
|
|
@@ -190,6 +190,9 @@ export default {
|
|
|
//切换班级
|
|
|
selectClass(index) {
|
|
|
this.curClassIndex = index
|
|
|
+ if(!this.classList[this.curClassIndex].students){
|
|
|
+ this.findClassStu()
|
|
|
+ }
|
|
|
if (this.viewType == 0) {
|
|
|
this.handelGroup()
|
|
|
}
|
|
@@ -436,19 +439,35 @@ export default {
|
|
|
},
|
|
|
//查询自己管理的班级
|
|
|
findClass() {
|
|
|
+ this.$store.dispatch('user/getSchoolProfile').then(
|
|
|
+ res => {
|
|
|
+ if (this.$store.state.userInfo.isHeadmaster) {
|
|
|
+ let classes = res.school_classes
|
|
|
+ console.log('class', classes)
|
|
|
+ this.classList = classes.filter(item => {
|
|
|
+ return this.$store.state.userInfo.mgtClasses.indexOf(item.id) > -1
|
|
|
+ })
|
|
|
+ if (this.classList.length > 0) {
|
|
|
+ this.curClassCode = this.classList[0].id
|
|
|
+ this.findClassStu()
|
|
|
+ }
|
|
|
+ console.log('list', this.classList)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ )
|
|
|
+ },
|
|
|
+ //查询班级学生
|
|
|
+ findClassStu(){
|
|
|
this.tableLoading = true
|
|
|
let params = {
|
|
|
'school_code': this.$store.state.userInfo.schoolCode,
|
|
|
- 'teacher.id': this.$store.state.userInfo.TEAMModelId,
|
|
|
+ 'ids': [this.curClassCode],
|
|
|
'scope': 'school'
|
|
|
}
|
|
|
this.$api.schoolSetting.getClassroomStudent(params).then(
|
|
|
(res) => {
|
|
|
if (!res.error) {
|
|
|
- this.classList = res.classrooms
|
|
|
- if (this.classList.length > 0) {
|
|
|
- this.curClassCode = this.classList[0].id
|
|
|
- }
|
|
|
+ this.classList[this.curClassIndex].students = res.classrooms[0] ? res.classrooms[0].students : []
|
|
|
} else {
|
|
|
this.$Message.error('API error!')
|
|
|
}
|
|
@@ -469,11 +488,6 @@ export default {
|
|
|
let dom = document.getElementById('table-wrap')
|
|
|
this.tableHeight = dom.offsetHeight - 30
|
|
|
})
|
|
|
- },
|
|
|
- mounted() {
|
|
|
-
|
|
|
- },
|
|
|
- computed: {
|
|
|
}
|
|
|
}
|
|
|
</script>
|