js代码
//获取组织用户成绩列表
getUserList() {
this.listQuery.OrgId = this.temp.parentId;
var _this = this;
// this.listQuery.CourseId = this.Classvalue;
// console.log(this.listQuery);
//获取用户
users.getList(this.listQuery).then((response) => {
//连接查询
this.userList = [];
this.List = response.data;
// 遍历成绩表
this.List.forEach((item) => {
console.log(this.ScoreList);
this.ScoreList.forEach((item1) =>{
console.log(item.id == item1.userId);
if(item.id == item1.userId){//判断用户id和课程表里的id是否相等
item.scoreId = item1.id;
item.score = item1.score;
item.status = 200;
}
});
if (item.score == undefined) {
item.score = 0;
}
this.userList.push(item);
});
console.log(this.userList);
_this.total = response.count;
});
},
//获取成绩列表
getScoreList() {
this.ScoreList = [];
queryClass
.getCourseScore({ page: 1, limit: 500, key: undefined })
.then((res) => {
console.log(res.data);
console.log(this.Classvalue);
res.data.forEach((item) => {
if (item.courseId == this.Classvalue) {
this.ScoreList.push(item);
}
});
console.log("这是成绩列表");
console.log(this.ScoreList);
});
},
//查询成绩
queryScore() {
this.getScoreList();
this.getUserList();
},
这是有时候点击查询会出现的效果
这是正常工作的效果