lrf402788946 há 4 anos atrás
pai
commit
71bd969e09
1 ficheiros alterados com 5 adições e 3 exclusões
  1. 5 3
      src/views/stuscore/scoreList.vue

+ 5 - 3
src/views/stuscore/scoreList.vue

@@ -54,10 +54,12 @@ export default {
     async search({ skip, limit = 10, ...info } = {}) {
     async search({ skip, limit = 10, ...info } = {}) {
       let res = await this.query({ lessonid: this.lessonid, teacherid: this.teacherid, ...info });
       let res = await this.query({ lessonid: this.lessonid, teacherid: this.teacherid, ...info });
       if (res.errcode === 0) {
       if (res.errcode === 0) {
-        this.$set(this, `list`, res.data);
+        let nd = _.uniqBy(res.data, 'stuid');
+        nd = nd.filter(f => this.stuList.find(sf => sf._id === f.stuid));
+        this.$set(this, `list`, nd);
         this.$set(this, `total`, res.total);
         this.$set(this, `total`, res.total);
         // 教师总分
         // 教师总分
-        let teatotal = res.data.reduce((p, n) => p + (n['score'] * 1 || 0), 0);
+        let teatotal = nd.reduce((p, n) => p + (n['score'] * 1 || 0), 0);
         // 教师平均分
         // 教师平均分
         let teapinjuntotal = _.round(teatotal / this.stutotal, 2);
         let teapinjuntotal = _.round(teatotal / this.stutotal, 2);
         let data = {
         let data = {
@@ -69,7 +71,7 @@ export default {
         let noScoreList = [];
         let noScoreList = [];
         let duplicate = _.cloneDeep(this.stuList);
         let duplicate = _.cloneDeep(this.stuList);
         duplicate = duplicate.map(i => {
         duplicate = duplicate.map(i => {
-          const r = res.data.find(f => f.stuid === i._id);
+          const r = nd.find(f => f.stuid === i._id);
           if (r) i.score = r.score * 1;
           if (r) i.score = r.score * 1;
           else {
           else {
             noScoreList.push(i.name);
             noScoreList.push(i.name);