Browse Source

feat: [试验管理] 默认选中自己所在学科

master
memorylkf 4 days ago
parent
commit
9e8cf9977f
1 changed files with 18 additions and 5 deletions
  1. +18
    -5
      src/views/business/study/comp/suject.vue

+ 18
- 5
src/views/business/study/comp/suject.vue View File

@ -125,11 +125,24 @@ export default {
checkPermi, checkPermi,
checkRole, checkRole,
getList(){ getList(){
studySubject_listByStudyId({studyId:this.study.id}).then(response => {
this.subjectList = response.data;
this.selectedSubjectId = this.subjectList.length>0?this.subjectList[0].id:''
this.$emit('change',this.selectedSubjectId)
})
if(this.study.id){
this.selectedSubjectId = ''
studySubject_listByStudyId({studyId:this.study.id}).then(response => {
this.subjectList = response.data;
for(let i=0;i<this.subjectList.length;i++){
let item = this.subjectList[i]
if(item.leader==this.userId || (item.userIdList && item.userIdList.length>0 && item.userIdList.indexof(this.userId)>-1)){
this.selectedSubjectId = item.id
break
}
}
if(this.selectedSubjectId === ''){
this.selectedSubjectId = this.subjectList.length>0?this.subjectList[0].id:''
}
this.$emit('change',this.selectedSubjectId)
})
}
}, },
changeSelectedSubject(item){ changeSelectedSubject(item){
this.selectedSubjectId = item.id this.selectedSubjectId = item.id

Loading…
Cancel
Save