소스 검색

修改数据报告功能

zengyicheng 1 년 전
부모
커밋
83a3d66d50

+ 28 - 43
src/components/pages/components/classStudentComponents/courseInfo.vue

@@ -105,7 +105,7 @@ export default {
         return;
       }
       this.ajax
-        .get(this.$store.state.api + "getCourseInfo", params)
+        .get(this.$store.state.api + "getCourseInfoMore", params)
         .then((res) => {
           this.isloading = false;
           var ctitle = "";
@@ -138,9 +138,6 @@ export default {
                 j++
               ) {
                 if (chapters[i].chapterInfo[0].taskJson[j].toolChoose.length) {
-                  let _toolsAarry = [
-                    1, 3, 6, 7, 16, 15, 4, 40, 41, 42, 49, 50, 52, 32, 57,
-                  ];
                   for (
                     var k = 0;
                     k <
@@ -148,49 +145,37 @@ export default {
                     k++
                   ) {
                     if (
-                      chapters[i].chapterInfo[0].taskJson[j].toolChoose[k].tool
-                        .length > 0
+                      chapters[i].chapterInfo[0].taskJson[j].toolChoose[
+                        k
+                      ].tool.indexOf(7) != -1
                     ) {
-                      if (
-                        chapters[i].chapterInfo[0].taskJson[j].toolChoose[
-                          k
-                        ].tool.indexOf(7) != -1
-                      ) {
-                        wang++;
-                      } else if (
-                        chapters[i].chapterInfo[0].taskJson[j].toolChoose[
-                          k
-                        ].tool.indexOf(3) != -1
-                      ) {
-                        si++;
-                      } else if (
-                        chapters[i].chapterInfo[0].taskJson[j].toolChoose[
-                          k
-                        ].tool.indexOf(1) != -1
-                      ) {
-                        dian++;
-                      } else if (
-                        chapters[i].chapterInfo[0].taskJson[j].toolChoose[
-                          k
-                        ].tool.indexOf(4) != -1
-                      ) {
-                        xuan++;
-                      } else {
-                        other++;
-                      }
-                      if (
-                        _toolsAarry.indexOf(
-                          chapters[i].chapterInfo[0].taskJson[j].toolChoose[k]
-                            .tool[0]
-                        ) != -1
-                      ) {
-                        tool++;
-                      }
+                      wang++;
+                    } else if (
+                      chapters[i].chapterInfo[0].taskJson[j].toolChoose[
+                        k
+                      ].tool.indexOf(3) != -1
+                    ) {
+                      si++;
+                    } else if (
+                      chapters[i].chapterInfo[0].taskJson[j].toolChoose[
+                        k
+                      ].tool.indexOf(1) != -1
+                    ) {
+                      dian++;
+                    } else if (
+                      chapters[i].chapterInfo[0].taskJson[j].toolChoose[
+                        k
+                      ].tool.indexOf(4) != -1
+                    ) {
+                      xuan++;
+                    } else {
+                      other++;
                     }
                   }
                 }
-                // tool +=
-                //   chapters[i].chapterInfo[0].taskJson[j].toolChoose.length;
+
+                tool +=
+                  chapters[i].chapterInfo[0].taskJson[j].toolChoose.length;
               }
             }
           }

+ 21 - 0
src/components/pages/components/classStudentComponents/courseRadar.vue

@@ -232,6 +232,27 @@ export default {
           //   document.getElementById("#charts_canvas")
         );
         let _xarray = [];
+        var a = this.workJson;
+        const existObj = {};
+
+        // 对原数组进行遍历
+        const newArr = a.filter((item) => {
+          // 如果 sName 为 null,则直接过滤掉该项
+          if (item.sName === null) {
+            return false;
+          }
+          // 如果 sName 已经存在,则返回 false,过滤掉该项
+          if (existObj[item.sName]) {
+            return false;
+          }
+          // 将该 sName 加入已经存在的对象中
+          existObj[item.sName] = true;
+          // 返回 true,保留该项
+          return true;
+        });
+        
+        this.workJson = [];
+        this.workJson = newArr;
         // this.workJson[j].workJson[i].allWork
         for (var i = 0; i < this.workJson[0].workJson.length; i++) {
           _xarray.push("阶段" + (i + 1));

+ 28 - 14
src/components/pages/components/classStudentComponents/studentAbility.vue

@@ -493,7 +493,18 @@ export default {
           let _pWork = res.data[3];
           let _allWork = res.data[4];
           let _allComment = res.data[5];
-          let _isWorks = res.data[6];
+          var b = res.data[6].reduce((result, item) => {
+            const key = item.stage + "-" + item.task;
+            if (!result[key]) {
+              result[key] = item;
+            }
+            return result;
+          }, {});
+
+          // 将结果转换为数组形式
+          b = Object.values(b);
+          let _isWorks = b;
+          let workEvalist = res.data[7];
           var randarJson = [];
           var randarAarray = [];
 
@@ -506,19 +517,22 @@ export default {
           for (var z = 0; z < courseList.length; z++) {
             var chapters = JSON.parse(courseList[z].chapters);
             for (var i = 0; i < _isWorks.length; i++) {
-              if (
-                _isWorks[i].rate != "" &&
-                courseList[z].courseId == _isWorks[i].courseid
-              ) {
-                _workW.push({
-                  stage: _isWorks[i].stage,
-                  task: _isWorks[i].task,
-                  rate: JSON.parse(_isWorks[i].rate),
-                  elist:
-                    chapters[_isWorks[i].stage].chapterInfo[0].taskJson[
-                      _isWorks[i].task
-                    ].eList,
-                });
+              for (var k = 0; k < workEvalist.length; k++) {
+                if (
+                  _isWorks[i].stage == workEvalist[k].stage &&
+                  _isWorks[i].task == workEvalist[k].task &&
+                  courseList[z].courseId == _isWorks[i].courseid
+                ) {
+                  _workW.push({
+                    stage: _isWorks[i].stage,
+                    task: _isWorks[i].task,
+                    rate: JSON.parse(workEvalist[k].rate),
+                    elist:
+                      chapters[_isWorks[i].stage].chapterInfo[0].taskJson[
+                        _isWorks[i].task
+                      ].eList,
+                  });
+                }
               }
             }
             for (var i = 0; i < chapters.length; i++) {

+ 45 - 27
src/components/pages/components/classStudentComponents/worksDetail3.vue

@@ -1340,6 +1340,7 @@ export default {
       dyList2: [],
       userAarray: [],
       checkJson: [],
+      word2: require("../../../../assets/icon/word2.png"),
     };
   },
   //   mounted() {
@@ -1438,6 +1439,7 @@ export default {
           var bgInfo = res.data[10]; //表格作业
           var cocopiInfo = res.data[11]; //cocopi或源码编辑作业
           var wordInfo = res.data[12]; //文档作业
+          var workEvaList = res.data[13];
           var workJson = [];
           for (var k = 0; k < res.data[0].length; k++) {
             this.allWorks = res.data[0][k];
@@ -1869,36 +1871,52 @@ export default {
             );
           });
           for (var l = 0; l < b.length; l++) {
-            eList =
-              chapters[0][b[l].stage].chapterInfo[0].taskJson[b[l].task].eList;
-            if (eList && eList.length) {
-              _ooption = [];
-              result[l].eList = eList;
-              for (var i = 0; i < eList.length; i++) {
-                _ooption.push({ value: 0, name: eList[i].value });
-                result[l].rateList[eList[i].value] = 0;
-              }
-              result[l].rateList.content = "";
-              this.ooption[l] = _ooption;
-            }
-            if (b[l].rate && eList && eList.length) {
-              _rate[l] = JSON.parse(b[l].rate);
-              _rateList[l] = Object.keys(JSON.parse(b[l].rate));
-              for (var i = 0; i < _rateList[l].length; i++) {
-                var _c = Object.keys(result[l].rateList);
-                if (_c.indexOf(_rateList[l][i]) != -1) {
-                  result[l].rateList[_rateList[l][i]] =
-                    _rate[l][_rateList[l][i]];
+            for (var p = 0; p < workEvaList.length; p++) {
+              if (
+                b[l].stage == workEvaList[p].stage &&
+                b[l].task == workEvaList[p].task
+              ) {
+                var eListOld =
+                  chapters[0][b[l].stage].chapterInfo[0].taskJson[b[l].task]
+                    .eList;
+                var eListNew = Object.keys(eListOld).map(function (key) {
+                  return { detail: eListOld[key].detail, score: eListOld[key].score, value: eListOld[key].value };
+                });
+                eList = eListNew;
+                if (eList && eList.length) {
+                  _ooption = [];
+                  result[l].eList = eList;
+                  for (var i = 0; i < eList.length; i++) {
+                    _ooption.push({ value: 0, name: eList[i].value });
+                    result[l].rateList[eList[i].value] = 0;
+                  }
+                  result[l].rateList.content = "";
+                  this.ooption[l] = _ooption;
                 }
-              }
-              for (var i = 0; i < this.ooption[l].length; i++) {
-                if (_rateList[l].indexOf(this.ooption[l][i].name) != -1) {
-                  this.ooption[l][i].value = _rate[l][this.ooption[l][i].name];
+                if (workEvaList[p].rate && eList && eList.length) {
+                  _rate[l] = JSON.parse(workEvaList[p].rate);
+                  _rateList[l] = Object.keys(JSON.parse(workEvaList[p].rate));
+                  for (var i = 0; i < _rateList[l].length; i++) {
+                    var _c = Object.keys(result[l].rateList);
+                    if (_c.indexOf(_rateList[l][i]) != -1) {
+                      result[l].rateList[_rateList[l][i]] =
+                        _rate[l][_rateList[l][i]];
+                    }
+                  }
+                  for (var i = 0; i < this.ooption[l].length; i++) {
+                    if (_rateList[l].indexOf(this.ooption[l][i].name) != -1) {
+                      this.ooption[l][i].value =
+                        _rate[l][this.ooption[l][i].name];
+                    }
+                  }
+                } else {
+                  _rate[l] = [];
+                  _rateList[l] = [];
                 }
+              } else {
+                _rate[l] = [];
+                _rateList[l] = [];
               }
-            } else {
-              _rate[l] = [];
-              _rateList[l] = [];
             }
           }
 

+ 64 - 36
src/components/pages/components/report/courseInfo.vue

@@ -104,50 +104,78 @@ export default {
         return;
       }
       this.ajax
-        .get(this.$store.state.api + "getCourseInfo", params)
+        .get(this.$store.state.api + "getCourseInfoMore", params)
         .then((res) => {
-          this.isloading = false
-          this.courseInfo = res.data[0][0];
-          let teachers = res.data[1];
-          let teacher = [];
-          for (var i = 0; i < teachers.length; i++) {
-            teacher.push(teachers[i].name);
+          this.isloading = false;
+          var ctitle = "";
+          for (var i = 0; i < res.data[0].length; i++) {
+            if (ctitle == "") {
+              ctitle = res.data[0][i].title;
+            } else {
+              if (ctitle.split(",").indexOf(res.data[0][i].title) == -1) {
+                ctitle += "," + res.data[0][i].title;
+              }
+            }
           }
-          this.teacher = teacher.join("、");
+          this.courseInfo.title = ctitle;
 
-          let chapters = JSON.parse(res.data[0][0].chapters);
           var task = 0;
           var tool = 0;
 
-          var wang = 0;//7
-          var si = 0;//3
-          var dian = 0;//1
-          var xuan = 0;//4
+          var wang = 0; //7
+          var si = 0; //3
+          var dian = 0; //1
+          var xuan = 0; //4
           var other = 0;
-          for (var i = 0; i < chapters.length; i++) {
-            task += chapters[i].chapterInfo[0].taskJson.length;
-            for (
-              var j = 0;
-              j < chapters[i].chapterInfo[0].taskJson.length;
-              j++
-            ) {
-              if (chapters[i].chapterInfo[0].taskJson[j].toolChoose.length) {
-                for (var k = 0; k < chapters[i].chapterInfo[0].taskJson[j].toolChoose.length; k++) {
-                  if (chapters[i].chapterInfo[0].taskJson[j].toolChoose[k].tool.indexOf(7) != -1) {
-                    wang++
-                  } else if (chapters[i].chapterInfo[0].taskJson[j].toolChoose[k].tool.indexOf(3) != -1) {
-                    si++
-                  } else if (chapters[i].chapterInfo[0].taskJson[j].toolChoose[k].tool.indexOf(1) != -1) {
-                    dian++
-                  } else if (chapters[i].chapterInfo[0].taskJson[j].toolChoose[k].tool.indexOf(4) != -1) {
-                    xuan++
-                  } else {
-                    other++
+          for (var z = 0; z < res.data[0].length; z++) {
+            var chapters = JSON.parse(res.data[0][z].chapters);
+            for (var i = 0; i < chapters.length; i++) {
+              task += chapters[i].chapterInfo[0].taskJson.length;
+              for (
+                var j = 0;
+                j < chapters[i].chapterInfo[0].taskJson.length;
+                j++
+              ) {
+                if (chapters[i].chapterInfo[0].taskJson[j].toolChoose.length) {
+                  for (
+                    var k = 0;
+                    k <
+                    chapters[i].chapterInfo[0].taskJson[j].toolChoose.length;
+                    k++
+                  ) {
+                    if (
+                      chapters[i].chapterInfo[0].taskJson[j].toolChoose[
+                        k
+                      ].tool.indexOf(7) != -1
+                    ) {
+                      wang++;
+                    } else if (
+                      chapters[i].chapterInfo[0].taskJson[j].toolChoose[
+                        k
+                      ].tool.indexOf(3) != -1
+                    ) {
+                      si++;
+                    } else if (
+                      chapters[i].chapterInfo[0].taskJson[j].toolChoose[
+                        k
+                      ].tool.indexOf(1) != -1
+                    ) {
+                      dian++;
+                    } else if (
+                      chapters[i].chapterInfo[0].taskJson[j].toolChoose[
+                        k
+                      ].tool.indexOf(4) != -1
+                    ) {
+                      xuan++;
+                    } else {
+                      other++;
+                    }
                   }
                 }
-              }
 
-              tool += chapters[i].chapterInfo[0].taskJson[j].toolChoose.length;
+                tool +=
+                  chapters[i].chapterInfo[0].taskJson[j].toolChoose.length;
+              }
             }
           }
           this.chartJson = {
@@ -155,8 +183,8 @@ export default {
             si,
             dian,
             xuan,
-            other
-          }
+            other,
+          };
           this.tool.stage = chapters.length;
           this.tool.task = task;
           this.tool.tool = tool;

+ 115 - 138
src/components/pages/components/report/studentAbility.vue

@@ -2,17 +2,41 @@
   <div v-loading="isloading">
     <div style="background: #fff; padding: 10px 0; height: 100%">
       <div class="sd_person_button">
-        <span @click="setType(2)" :class="{ active: type == 2 }">个人项目评价</span>
-        <span @click="setType(1)" :class="{ active: type == 1 }">课程目标设置</span>
+        <span @click="setType(2)" :class="{ active: type == 2 }"
+          >个人项目评价</span
+        >
+        <span @click="setType(1)" :class="{ active: type == 1 }"
+          >课程目标设置</span
+        >
         <!-- <span @click="setType(3)" :class="{ active: type == 3 }">其他项目</span> -->
       </div>
       <div style="display: flex; width: 100%; height: calc(100% - 50px)">
-        <div id="person_canvas1" class="echart" v-show="type == 1"
-          style="width: 100%; height: 100%;display: flex;align-items: center;justify-content: center;">
+        <div
+          id="person_canvas1"
+          class="echart"
+          v-show="type == 1"
+          style="
+            width: 100%;
+            height: 100%;
+            display: flex;
+            align-items: center;
+            justify-content: center;
+          "
+        >
           <span v-if="!eJson">暂无数据</span>
         </div>
-        <div id="person_canvas2" class="echart" v-show="type == 2"
-          style="width: 100%; height: 100%;display: flex;align-items: center;justify-content: center;">
+        <div
+          id="person_canvas2"
+          class="echart"
+          v-show="type == 2"
+          style="
+            width: 100%;
+            height: 100%;
+            display: flex;
+            align-items: center;
+            justify-content: center;
+          "
+        >
           <!-- <div class="box2" v-show="work.length ? true : false">
             <div v-for="(item,index) in work" :key="index" class="target_box">
               <div class="target_task">
@@ -34,8 +58,6 @@
           </div>
           <span v-show="!work.length ? true : false">暂无数据</span> -->
           <span v-show="!randarJson.length ? true : false">暂无数据</span>
-
-
         </div>
       </div>
     </div>
@@ -43,8 +65,6 @@
 </template>
 
 <script>
-
-
 export default {
   props: ["userid", "courseid"],
   data() {
@@ -77,7 +97,7 @@ export default {
           },
           label: {
             show: true,
-            fontSize: 10
+            fontSize: 10,
           },
         },
       },
@@ -109,7 +129,7 @@ export default {
           data: ["阶段1", "阶段2", "阶段3", "阶段4", "阶段5"],
         },
         legend: {
-          show: false
+          show: false,
         },
         series: [
           {
@@ -361,7 +381,7 @@ export default {
             }
             i++;
           }
-          this.option2.series.data = _array
+          this.option2.series.data = _array;
           // 初始化雷达图
           this.chartObj2 = chartObj2;
           this.chartObj2.setOption(this.option2);
@@ -393,19 +413,19 @@ export default {
               //劳动课程
               this.$el.querySelector("#person_canvas2")
             );
-            let radarOption = JSON.parse(JSON.stringify(this.radarOption))
+            let radarOption = JSON.parse(JSON.stringify(this.radarOption));
             for (var i = 0; i < this.randarJson.length; i++) {
               radarOption.radar.indicator.push({
                 name: this.randarJson[i].target,
                 max: 5,
               });
-              radarOption.series[0].data[0].value.push((this.randarJson[i].value / this.randarJson[i].count).toFixed(1));
+              radarOption.series[0].data[0].value.push(
+                (this.randarJson[i].value / this.randarJson[i].count).toFixed(1)
+              );
             }
 
-
             this.chartObj3 = chartObj3;
             this.chartObj3.setOption(radarOption);
-
           }
 
           // var _work = []
@@ -423,8 +443,6 @@ export default {
           // this.work = _work;
           // console.log(_work);
           // this.$forceUpdate();
-
-
         }
       });
       let _this = this;
@@ -436,7 +454,6 @@ export default {
 
         if (_this.chartObj2) {
           _this.chartObj2.resize();
-
         }
         if (_this.chartObj3) {
           _this.chartObj3.resize();
@@ -457,7 +474,7 @@ export default {
       }
     },
     getInfo() {
-      this.isloading = true
+      this.isloading = true;
       let params = {
         uid: this.userid,
         cid: this.courseid,
@@ -468,21 +485,34 @@ export default {
       this.ajax
         .get(this.$store.state.api + "getUserInfo", params)
         .then((res) => {
-          this.isloading = false
+          this.isloading = false;
           let chapters = JSON.parse(res.data[2][0].chapters);
           var tool = 0;
-          let workJson = []
+          let workJson = [];
           let _pWork = res.data[3];
           let _allWork = res.data[4];
           let _allComment = res.data[5];
-          let _isWorks = res.data[6];
-          var randarJson = []
-          var randarAarray = []
+          var b = res.data[6].reduce((result, item) => {
+            const key = item.stage + "-" + item.task;
+            if (!result[key]) {
+              result[key] = item;
+            }
+            return result;
+          }, {});
+
+          // 将结果转换为数组形式
+          b = Object.values(b);
+          let _isWorks = b;
+          let workEvalist = res.data[7];
+          var randarJson = [];
+          var randarAarray = [];
 
-          this.eJson = res.data[2][0].content ? JSON.parse(res.data[2][0].content) : "";
+          this.eJson = res.data[2][0].content
+            ? JSON.parse(res.data[2][0].content)
+            : "";
 
           for (var i = 0; i < chapters.length; i++) {
-            workJson[i] = { tool: 0, ptool: 0, work: 0, ishuo: 0, isCan: 0 }
+            workJson[i] = { tool: 0, ptool: 0, work: 0, ishuo: 0, isCan: 0 };
             for (
               var j = 0;
               j < chapters[i].chapterInfo[0].taskJson.length;
@@ -501,23 +531,21 @@ export default {
                   ) != -1
                 ) {
                   tool++;
-                  workJson[i].tool++
+                  workJson[i].tool++;
                 }
               }
             }
 
             for (var k = 0; k < _pWork.length; k++) {
               if (_pWork[k].stage == i) {
-                workJson[i].ptool++
+                workJson[i].ptool++;
               }
             }
             for (var k = 0; k < _allComment.length; k++) {
               if (_allComment[k].stage == i) {
-                workJson[i].ishuo++
+                workJson[i].ishuo++;
               }
             }
-
-
           }
           this.userinfo = res.data[0][0];
           this.ccount = tool;
@@ -528,133 +556,84 @@ export default {
 
           for (var i = 0; i < workJson.length; i++) {
             if (workJson[i].ptool > workJson[i].tool) {
-              workJson[i].work = 5
+              workJson[i].work = 5;
             } else if (workJson[i].tool === 0) {
-              workJson[i].work = 5
+              workJson[i].work = 5;
             } else {
-              workJson[i].work = Math.round(workJson[i].ptool / workJson[i].tool * 100 / 20)
+              workJson[i].work = Math.round(
+                ((workJson[i].ptool / workJson[i].tool) * 100) / 20
+              );
             }
             if (workJson[i].ptool) {
-              workJson[i].isCan = 1
+              workJson[i].isCan = 1;
             }
           }
-          this.workJson = workJson
+          this.workJson = workJson;
 
           this.setChart();
-          let _workW = []
+          let _workW = [];
           for (var i = 0; i < _isWorks.length; i++) {
-            if (chapters[_isWorks[i].stage].chapterInfo[0].taskJson[_isWorks[i].task].eList && chapters[_isWorks[i].stage].chapterInfo[0].taskJson[_isWorks[i].task].eList.length) {
-              _workW.push({ stage: _isWorks[i].stage, task: _isWorks[i].task, rate: JSON.parse(_isWorks[i].rate), elist: chapters[_isWorks[i].stage].chapterInfo[0].taskJson[_isWorks[i].task].eList })
+            for (var k = 0; k < workEvalist.length; k++) {
+              if (
+                chapters[_isWorks[i].stage].chapterInfo[0].taskJson[
+                  _isWorks[i].task
+                ].eList &&
+                chapters[_isWorks[i].stage].chapterInfo[0].taskJson[
+                  _isWorks[i].task
+                ].eList.length
+              ) {
+                if (
+                  _isWorks[i].stage == workEvalist[k].stage &&
+                  _isWorks[i].task == workEvalist[k].task
+                ) {
+                  _workW.push({
+                    stage: _isWorks[i].stage,
+                    task: _isWorks[i].task,
+                    rate: JSON.parse(workEvalist[k].rate),
+                    elist:
+                      chapters[_isWorks[i].stage].chapterInfo[0].taskJson[
+                        _isWorks[i].task
+                      ].eList,
+                  });
+                }
+              }
             }
-            // else {
-            //   let elist = [
-            //     {
-            //       "value": "意识能力",
-            //       "score": 5,
-            //       "target": [
-            //         {
-            //           "name": "意识能力1",
-            //           "per": 0.5
-            //         },
-            //         {
-            //           "name": "意识能力2",
-            //           "per": 0.5
-            //         }
-            //       ]
-            //     },
-            //     {
-            //       "value": "科学探究能力",
-            //       "score": 5,
-            //       "target": [
-            //         {
-            //           "name": "科学探究能力1",
-            //           "per": 0.5
-            //         },
-            //         {
-            //           "name": "科学探究能力2",
-            //           "per": 0.5
-            //         }
-            //       ]
-            //     },
-            //     {
-            //       "value": "实践创新能力",
-            //       "score": 5,
-            //       "target": [
-            //         {
-            //           "name": "实践创新能力1",
-            //           "per": 0.5
-            //         },
-            //         {
-            //           "name": "实践创新能力2",
-            //           "per": 0.5
-            //         }
-            //       ]
-            //     },
-            //     {
-            //       "value": "学习反思能力",
-            //       "score": 5,
-            //       "target": [
-            //         {
-            //           "name": "学习反思能力1",
-            //           "per": 0.5
-            //         },
-            //         {
-            //           "name": "学习反思能力2",
-            //           "per": 0.5
-            //         }
-            //       ]
-            //     },
-            //     {
-            //       "value": "工程思维能力",
-            //       "score": 5,
-            //       "target": [
-            //         {
-            //           "name": "工程思维能力1",
-            //           "per": 0.5
-            //         },
-            //         {
-            //           "name": "工程思维能力2",
-            //           "per": 0.5
-            //         }
-            //       ]
-            //     }
-            //   ]
-            //   _workW.push({ stage: _isWorks[i].stage, task: _isWorks[i].task, rate: JSON.parse(_isWorks[i].rate), elist: elist })
-            // }
           }
           for (var i = 0; i < _workW.length; i++) {
-            _workW[i].work = []
+            _workW[i].work = [];
             for (var j = 0; j < _workW[i].elist.length; j++) {
               if (_workW[i].elist[j].target) {
                 if (randarAarray.indexOf(_workW[i].elist[j].target) == -1) {
-                  randarAarray.push(_workW[i].elist[j].target)
+                  randarAarray.push(_workW[i].elist[j].target);
                 }
               }
-              // for (var k = 0; k < _workW[i].elist[j].target.length; k++) {
-              //   _workW[i].elist[j].target[k].count = _workW[i].rate[_workW[i].elist[j].value] * _workW[i].elist[j].target[k].per
-              // }
-              _workW[i].work.push({ name: _workW[i].elist[j].value, target: _workW[i].elist[j].target })
-              _workW[i].work[_workW[i].work.length - 1][_workW[i].elist[j].value] = _workW[i].rate[_workW[i].elist[j].value]
-              _workW[i].work[_workW[i].work.length - 1].value = _workW[i].rate[_workW[i].elist[j].value]
+              _workW[i].work.push({
+                name: _workW[i].elist[j].value,
+                target: _workW[i].elist[j].target,
+              });
+              _workW[i].work[_workW[i].work.length - 1][
+                _workW[i].elist[j].value
+              ] = _workW[i].rate[_workW[i].elist[j].value];
+              _workW[i].work[_workW[i].work.length - 1].value =
+                _workW[i].rate[_workW[i].elist[j].value];
             }
           }
           for (var k = 0; k < randarAarray.length; k++) {
-            randarJson.push({ target: randarAarray[k], count: 0, value: 0 })
+            randarJson.push({ target: randarAarray[k], count: 0, value: 0 });
             for (var i = 0; i < _workW.length; i++) {
               for (var j = 0; j < _workW[i].work.length; j++) {
                 if (_workW[i].work[j].target == randarAarray[k]) {
-                  randarJson[k].count++
-                  randarJson[k].value += _workW[i].work[j].value
+                  randarJson[k].count++;
+                  randarJson[k].value += _workW[i].work[j].value;
                 }
               }
             }
           }
-          this.workW = _workW
-          this.randarJson = randarJson
-
+          this.workW = _workW;
+          this.randarJson = randarJson;
         })
         .catch((err) => {
-          this.isloading = false
+          this.isloading = false;
           console.error(err);
         });
     },
@@ -662,21 +641,20 @@ export default {
       this.type = type;
       if (this.chartObj2) {
         this.chartObj2.dispose();
-
       }
       if (this.chartObj3) {
         this.chartObj3.dispose();
-
       }
       this.getInfo();
     },
-    color16() {//十六进制颜色随机
+    color16() {
+      //十六进制颜色随机
       var r = Math.floor(Math.random() * 256);
       var g = Math.floor(Math.random() * 256);
       var b = Math.floor(Math.random() * 256);
-      var color = '#' + r.toString(16) + g.toString(16) + b.toString(16);
+      var color = "#" + r.toString(16) + g.toString(16) + b.toString(16);
       return color;
-    }
+    },
   },
   watch: {
     userid(newValue, oldValue) {
@@ -709,7 +687,6 @@ export default {
   color: rgb(30, 146, 255);
 }
 
-
 .target_box {
   display: flex;
   align-items: center;
@@ -717,7 +694,7 @@ export default {
   margin: 0 auto;
 }
 
-.target_box+.target_box {
+.target_box + .target_box {
   margin-top: 10px;
 }
 

+ 55 - 32
src/components/pages/components/studentWorksDetail.vue

@@ -1504,6 +1504,7 @@ export default {
       userid: this.uid,
       oid: this.ooid,
       org: this.oorg,
+      studentId:"",
       formLabelWidth: "100px",
       dialogImageUrl: "",
       pictureDialog: false,
@@ -1786,6 +1787,7 @@ export default {
     },
     lookWork(id, uid, cid) {
       this.scopeId1 = id;
+      this.studentId = uid;
       let params = {
         uid: uid,
         cid: cid,
@@ -1822,7 +1824,9 @@ export default {
           var bgInfo = res.data[10]; //表格作业
           var cocopiInfo = res.data[11]; //cocopi或源码编辑作业
           var wordInfo = res.data[12]; //文档作业
+          var workEvaList = res.data[13];
           var workJson = [];
+
           for (var k = 0; k < res.data[0].length; k++) {
             this.allWorks = res.data[0][k];
             if (this.chapInfo.length == 0) {
@@ -2253,36 +2257,52 @@ export default {
             );
           });
           for (var l = 0; l < b.length; l++) {
-            eList =
-              chapters[0][b[l].stage].chapterInfo[0].taskJson[b[l].task].eList;
-            if (eList && eList.length) {
-              _ooption = [];
-              result[l].eList = eList;
-              for (var i = 0; i < eList.length; i++) {
-                _ooption.push({ value: 0, name: eList[i].value });
-                result[l].rateList[eList[i].value] = 0;
-              }
-              result[l].rateList.content = "";
-              this.ooption[l] = _ooption;
-            }
-            if (b[l].rate && eList && eList.length) {
-              _rate[l] = JSON.parse(b[l].rate);
-              _rateList[l] = Object.keys(JSON.parse(b[l].rate));
-              for (var i = 0; i < _rateList[l].length; i++) {
-                var _c = Object.keys(result[l].rateList);
-                if (_c.indexOf(_rateList[l][i]) != -1) {
-                  result[l].rateList[_rateList[l][i]] =
-                    _rate[l][_rateList[l][i]];
+            for (var p = 0; p < workEvaList.length; p++) {
+              if (
+                b[l].stage == workEvaList[p].stage &&
+                b[l].task == workEvaList[p].task
+              ) {
+                var eListOld =
+                  chapters[0][b[l].stage].chapterInfo[0].taskJson[b[l].task]
+                    .eList;
+                var eListNew = Object.keys(eListOld).map(function (key) {
+                  return { detail: eListOld[key].detail, score: eListOld[key].score, value: eListOld[key].value };
+                });
+                eList = eListNew;
+                if (eList && eList.length) {
+                  _ooption = [];
+                  result[l].eList = eList;
+                  for (var i = 0; i < eList.length; i++) {
+                    _ooption.push({ value: 0, name: eList[i].value });
+                    result[l].rateList[eList[i].value] = 0;
+                  }
+                  result[l].rateList.content = "";
+                  this.ooption[l] = _ooption;
                 }
-              }
-              for (var i = 0; i < this.ooption[l].length; i++) {
-                if (_rateList[l].indexOf(this.ooption[l][i].name) != -1) {
-                  this.ooption[l][i].value = _rate[l][this.ooption[l][i].name];
+                if (workEvaList[p].rate && eList && eList.length) {
+                  _rate[l] = JSON.parse(workEvaList[p].rate);
+                  _rateList[l] = Object.keys(JSON.parse(workEvaList[p].rate));
+                  for (var i = 0; i < _rateList[l].length; i++) {
+                    var _c = Object.keys(result[l].rateList);
+                    if (_c.indexOf(_rateList[l][i]) != -1) {
+                      result[l].rateList[_rateList[l][i]] =
+                        _rate[l][_rateList[l][i]];
+                    }
+                  }
+                  for (var i = 0; i < this.ooption[l].length; i++) {
+                    if (_rateList[l].indexOf(this.ooption[l][i].name) != -1) {
+                      this.ooption[l][i].value =
+                        _rate[l][this.ooption[l][i].name];
+                    }
+                  }
+                } else {
+                  _rate[l] = [];
+                  _rateList[l] = [];
                 }
+              } else {
+                _rate[l] = [];
+                _rateList[l] = [];
               }
-            } else {
-              _rate[l] = [];
-              _rateList[l] = [];
             }
           }
 
@@ -2654,7 +2674,7 @@ export default {
           continue;
         }
         this.updateWorks(
-          this.worksDetail[i].scopeId,
+          this.worksDetail[i].stagetask,
           this.worksDetail[i].rateList,
           i
         );
@@ -2685,15 +2705,18 @@ export default {
         this.setChart(_ooption);
       }
     },
-    updateWorks(scopeId, rateList, i) {
+    updateWorks(stagetask, rateList, i) {
+      var arr = stagetask.split("-");
       let params = {
+        cid: this.id,
+        s: arr[0],
+        t: arr[1],
         rate: rateList,
-        tuid: this.userid,
-        id: scopeId,
+        uid: this.studentId,
       };
       const k = i;
       this.ajax
-        .get(this.$store.state.api + "updateWorks", params)
+        .get(this.$store.state.api + "updateWorksEva", params)
         .then((res) => {
           var _ooption = JSON.parse(JSON.stringify(this.ooption[k]));
           // var _option = JSON.parse(JSON.stringify(this.option));

+ 65 - 34
src/components/pages/components/worksDetail2.vue

@@ -1137,12 +1137,20 @@
                             </div>
                             <div v-if="c.type == 2">
                               <div class="workImg">
-                                <img :src="word2" alt />
+                                <img
+                                  :src="word2"
+                                  @click="openFile(c.url, c.type)"
+                                  alt
+                                />
                               </div>
                             </div>
                             <div v-if="c.type == 3">
                               <div class="workImg">
-                                <img :src="word2" alt />
+                                <img
+                                  :src="word2"
+                                  @click="openFile(c.url, c.type)"
+                                  alt
+                                />
                               </div>
                             </div>
                           </div>
@@ -1494,6 +1502,7 @@ export default {
       id: this.cid,
       userid: this.uid,
       oid: this.ooid,
+      studentId: "",
       formLabelWidth: "100px",
       dialogImageUrl: "",
       pictureDialog: false,
@@ -1786,6 +1795,7 @@ export default {
     },
     lookWork(id, uid, stage, task) {
       this.scopeId1 = id;
+      this.studentId = uid;
       let params = {
         uid: uid,
         cid: this.id,
@@ -1824,6 +1834,7 @@ export default {
           var bgInfo = res.data[10]; //表格作业
           var cocopiInfo = res.data[11]; //cocopi或源码编辑作业
           var wordInfo = res.data[12]; //文档作业
+          var workEvaList = res.data[13];
           var workJson = [];
 
           for (var k = 0; k < res.data[0].length; k++) {
@@ -2256,36 +2267,52 @@ export default {
             );
           });
           for (var l = 0; l < b.length; l++) {
-            eList =
-              chapters[0][b[l].stage].chapterInfo[0].taskJson[b[l].task].eList;
-            if (eList && eList.length) {
-              _ooption = [];
-              result[l].eList = eList;
-              for (var i = 0; i < eList.length; i++) {
-                _ooption.push({ value: 0, name: eList[i].value });
-                result[l].rateList[eList[i].value] = 0;
-              }
-              result[l].rateList.content = "";
-              this.ooption[l] = _ooption;
-            }
-            if (b[l].rate && eList && eList.length) {
-              _rate[l] = JSON.parse(b[l].rate);
-              _rateList[l] = Object.keys(JSON.parse(b[l].rate));
-              for (var i = 0; i < _rateList[l].length; i++) {
-                var _c = Object.keys(result[l].rateList);
-                if (_c.indexOf(_rateList[l][i]) != -1) {
-                  result[l].rateList[_rateList[l][i]] =
-                    _rate[l][_rateList[l][i]];
+            for (var p = 0; p < workEvaList.length; p++) {
+              if (
+                b[l].stage == workEvaList[p].stage &&
+                b[l].task == workEvaList[p].task
+              ) {
+                var eListOld =
+                  chapters[0][b[l].stage].chapterInfo[0].taskJson[b[l].task]
+                    .eList;
+                var eListNew = Object.keys(eListOld).map(function (key) {
+                  return { detail: eListOld[key].detail, score: eListOld[key].score, value: eListOld[key].value };
+                });
+                eList = eListNew;
+                if (eList && eList.length) {
+                  _ooption = [];
+                  result[l].eList = eList;
+                  for (var i = 0; i < eList.length; i++) {
+                    _ooption.push({ value: 0, name: eList[i].value });
+                    result[l].rateList[eList[i].value] = 0;
+                  }
+                  result[l].rateList.content = "";
+                  this.ooption[l] = _ooption;
                 }
-              }
-              for (var i = 0; i < this.ooption[l].length; i++) {
-                if (_rateList[l].indexOf(this.ooption[l][i].name) != -1) {
-                  this.ooption[l][i].value = _rate[l][this.ooption[l][i].name];
+                if (workEvaList[p].rate && eList && eList.length) {
+                  _rate[l] = JSON.parse(workEvaList[p].rate);
+                  _rateList[l] = Object.keys(JSON.parse(workEvaList[p].rate));
+                  for (var i = 0; i < _rateList[l].length; i++) {
+                    var _c = Object.keys(result[l].rateList);
+                    if (_c.indexOf(_rateList[l][i]) != -1) {
+                      result[l].rateList[_rateList[l][i]] =
+                        _rate[l][_rateList[l][i]];
+                    }
+                  }
+                  for (var i = 0; i < this.ooption[l].length; i++) {
+                    if (_rateList[l].indexOf(this.ooption[l][i].name) != -1) {
+                      this.ooption[l][i].value =
+                        _rate[l][this.ooption[l][i].name];
+                    }
+                  }
+                } else {
+                  _rate[l] = [];
+                  _rateList[l] = [];
                 }
+              } else {
+                _rate[l] = [];
+                _rateList[l] = [];
               }
-            } else {
-              _rate[l] = [];
-              _rateList[l] = [];
             }
           }
 
@@ -2544,7 +2571,7 @@ export default {
           continue;
         }
         this.updateWorks(
-          this.worksDetail[i].scopeId,
+          this.worksDetail[i].stagetask,
           this.worksDetail[i].rateList,
           i
         );
@@ -2575,15 +2602,18 @@ export default {
         this.setChart(_ooption);
       }
     },
-    updateWorks(scopeId, rateList, i) {
+    updateWorks(stagetask, rateList, i) {
+      var arr = stagetask.split("-");
       let params = {
+        cid: this.id,
+        s: arr[0],
+        t: arr[1],
         rate: rateList,
-        tuid: this.userid,
-        id: scopeId,
+        uid: this.studentId,
       };
       const k = i;
       this.ajax
-        .get(this.$store.state.api + "updateWorks", params)
+        .get(this.$store.state.api + "updateWorksEva", params)
         .then((res) => {
           var _ooption = JSON.parse(JSON.stringify(this.ooption[k]));
           // var _option = JSON.parse(JSON.stringify(this.option));
@@ -4520,5 +4550,6 @@ ol {
   width: 100%;
   height: 100%;
   object-fit: contain;
+  cursor: pointer;
 }
 </style>

+ 45 - 27
src/components/pages/components/worksDetail3.vue

@@ -1340,6 +1340,7 @@ export default {
       dyList2: [],
       userAarray: [],
       checkJson: [],
+      word2: require("../../../assets/icon/word2.png"),
     };
   },
   //   mounted() {
@@ -1438,6 +1439,7 @@ export default {
           var bgInfo = res.data[10]; //表格作业
           var cocopiInfo = res.data[11]; //cocopi或源码编辑作业
           var wordInfo = res.data[12]; //文档作业
+          var workEvaList = res.data[13];
           var workJson = [];
           for (var k = 0; k < res.data[0].length; k++) {
             this.allWorks = res.data[0][k];
@@ -1869,36 +1871,52 @@ export default {
             );
           });
           for (var l = 0; l < b.length; l++) {
-            eList =
-              chapters[0][b[l].stage].chapterInfo[0].taskJson[b[l].task].eList;
-            if (eList && eList.length) {
-              _ooption = [];
-              result[l].eList = eList;
-              for (var i = 0; i < eList.length; i++) {
-                _ooption.push({ value: 0, name: eList[i].value });
-                result[l].rateList[eList[i].value] = 0;
-              }
-              result[l].rateList.content = "";
-              this.ooption[l] = _ooption;
-            }
-            if (b[l].rate && eList && eList.length) {
-              _rate[l] = JSON.parse(b[l].rate);
-              _rateList[l] = Object.keys(JSON.parse(b[l].rate));
-              for (var i = 0; i < _rateList[l].length; i++) {
-                var _c = Object.keys(result[l].rateList);
-                if (_c.indexOf(_rateList[l][i]) != -1) {
-                  result[l].rateList[_rateList[l][i]] =
-                    _rate[l][_rateList[l][i]];
+            for (var p = 0; p < workEvaList.length; p++) {
+              if (
+                b[l].stage == workEvaList[p].stage &&
+                b[l].task == workEvaList[p].task
+              ) {
+                var eListOld =
+                  chapters[0][b[l].stage].chapterInfo[0].taskJson[b[l].task]
+                    .eList;
+                var eListNew = Object.keys(eListOld).map(function (key) {
+                  return { detail: eListOld[key].detail, score: eListOld[key].score, value: eListOld[key].value };
+                });
+                eList = eListNew;
+                if (eList && eList.length) {
+                  _ooption = [];
+                  result[l].eList = eList;
+                  for (var i = 0; i < eList.length; i++) {
+                    _ooption.push({ value: 0, name: eList[i].value });
+                    result[l].rateList[eList[i].value] = 0;
+                  }
+                  result[l].rateList.content = "";
+                  this.ooption[l] = _ooption;
                 }
-              }
-              for (var i = 0; i < this.ooption[l].length; i++) {
-                if (_rateList[l].indexOf(this.ooption[l][i].name) != -1) {
-                  this.ooption[l][i].value = _rate[l][this.ooption[l][i].name];
+                if (workEvaList[p].rate && eList && eList.length) {
+                  _rate[l] = JSON.parse(workEvaList[p].rate);
+                  _rateList[l] = Object.keys(JSON.parse(workEvaList[p].rate));
+                  for (var i = 0; i < _rateList[l].length; i++) {
+                    var _c = Object.keys(result[l].rateList);
+                    if (_c.indexOf(_rateList[l][i]) != -1) {
+                      result[l].rateList[_rateList[l][i]] =
+                        _rate[l][_rateList[l][i]];
+                    }
+                  }
+                  for (var i = 0; i < this.ooption[l].length; i++) {
+                    if (_rateList[l].indexOf(this.ooption[l][i].name) != -1) {
+                      this.ooption[l][i].value =
+                        _rate[l][this.ooption[l][i].name];
+                    }
+                  }
+                } else {
+                  _rate[l] = [];
+                  _rateList[l] = [];
                 }
+              } else {
+                _rate[l] = [];
+                _rateList[l] = [];
               }
-            } else {
-              _rate[l] = [];
-              _rateList[l] = [];
             }
           }
 

+ 28 - 14
src/components/pages/myReport/components/MyLookComponent/studentAbility.vue

@@ -495,7 +495,18 @@ export default {
           let _pWork = res.data[3];
           let _allWork = res.data[4];
           let _allComment = res.data[5];
-          let _isWorks = res.data[6];
+          var b = res.data[6].reduce((result, item) => {
+            const key = item.stage + "-" + item.task;
+            if (!result[key]) {
+              result[key] = item;
+            }
+            return result;
+          }, {});
+
+          // 将结果转换为数组形式
+          b = Object.values(b);
+          let _isWorks = b;
+          let workEvalist = res.data[7];
           var randarJson = [];
           var randarAarray = [];
 
@@ -508,19 +519,22 @@ export default {
           for (var z = 0; z < courseList.length; z++) {
             var chapters = JSON.parse(courseList[z].chapters);
             for (var i = 0; i < _isWorks.length; i++) {
-              if (
-                _isWorks[i].rate != "" &&
-                courseList[z].courseId == _isWorks[i].courseid
-              ) {
-                _workW.push({
-                  stage: _isWorks[i].stage,
-                  task: _isWorks[i].task,
-                  rate: JSON.parse(_isWorks[i].rate),
-                  elist:
-                    chapters[_isWorks[i].stage].chapterInfo[0].taskJson[
-                      _isWorks[i].task
-                    ].eList,
-                });
+              for (var k = 0; k < workEvalist.length; k++) {
+                if (
+                  _isWorks[i].stage == workEvalist[k].stage &&
+                  _isWorks[i].task == workEvalist[k].task &&
+                  courseList[z].courseId == _isWorks[i].courseid
+                ) {
+                  _workW.push({
+                    stage: _isWorks[i].stage,
+                    task: _isWorks[i].task,
+                    rate: JSON.parse(workEvalist[k].rate),
+                    elist:
+                      chapters[_isWorks[i].stage].chapterInfo[0].taskJson[
+                        _isWorks[i].task
+                      ].eList,
+                  });
+                }
               }
             }
             for (var i = 0; i < chapters.length; i++) {

+ 44 - 27
src/components/pages/myReport/components/MyLookComponent/worksDetail3.vue

@@ -1438,6 +1438,7 @@ export default {
           var bgInfo = res.data[10]; //表格作业
           var cocopiInfo = res.data[11]; //cocopi或源码编辑作业
           var wordInfo = res.data[12]; //文档作业
+          var workEvaList = res.data[13];
           var workJson = [];
           for (var k = 0; k < res.data[0].length; k++) {
             this.allWorks = res.data[0][k];
@@ -1869,36 +1870,52 @@ export default {
             );
           });
           for (var l = 0; l < b.length; l++) {
-            eList =
-              chapters[0][b[l].stage].chapterInfo[0].taskJson[b[l].task].eList;
-            if (eList && eList.length) {
-              _ooption = [];
-              result[l].eList = eList;
-              for (var i = 0; i < eList.length; i++) {
-                _ooption.push({ value: 0, name: eList[i].value });
-                result[l].rateList[eList[i].value] = 0;
-              }
-              result[l].rateList.content = "";
-              this.ooption[l] = _ooption;
-            }
-            if (b[l].rate && eList && eList.length) {
-              _rate[l] = JSON.parse(b[l].rate);
-              _rateList[l] = Object.keys(JSON.parse(b[l].rate));
-              for (var i = 0; i < _rateList[l].length; i++) {
-                var _c = Object.keys(result[l].rateList);
-                if (_c.indexOf(_rateList[l][i]) != -1) {
-                  result[l].rateList[_rateList[l][i]] =
-                    _rate[l][_rateList[l][i]];
+            for (var p = 0; p < workEvaList.length; p++) {
+              if (
+                b[l].stage == workEvaList[p].stage &&
+                b[l].task == workEvaList[p].task
+              ) {
+                var eListOld =
+                  chapters[0][b[l].stage].chapterInfo[0].taskJson[b[l].task]
+                    .eList;
+                var eListNew = Object.keys(eListOld).map(function (key) {
+                  return { detail: eListOld[key].detail, score: eListOld[key].score, value: eListOld[key].value };
+                });
+                eList = eListNew;
+                if (eList && eList.length) {
+                  _ooption = [];
+                  result[l].eList = eList;
+                  for (var i = 0; i < eList.length; i++) {
+                    _ooption.push({ value: 0, name: eList[i].value });
+                    result[l].rateList[eList[i].value] = 0;
+                  }
+                  result[l].rateList.content = "";
+                  this.ooption[l] = _ooption;
                 }
-              }
-              for (var i = 0; i < this.ooption[l].length; i++) {
-                if (_rateList[l].indexOf(this.ooption[l][i].name) != -1) {
-                  this.ooption[l][i].value = _rate[l][this.ooption[l][i].name];
+                if (workEvaList[p].rate && eList && eList.length) {
+                  _rate[l] = JSON.parse(workEvaList[p].rate);
+                  _rateList[l] = Object.keys(JSON.parse(workEvaList[p].rate));
+                  for (var i = 0; i < _rateList[l].length; i++) {
+                    var _c = Object.keys(result[l].rateList);
+                    if (_c.indexOf(_rateList[l][i]) != -1) {
+                      result[l].rateList[_rateList[l][i]] =
+                        _rate[l][_rateList[l][i]];
+                    }
+                  }
+                  for (var i = 0; i < this.ooption[l].length; i++) {
+                    if (_rateList[l].indexOf(this.ooption[l][i].name) != -1) {
+                      this.ooption[l][i].value =
+                        _rate[l][this.ooption[l][i].name];
+                    }
+                  }
+                } else {
+                  _rate[l] = [];
+                  _rateList[l] = [];
                 }
+              } else {
+                _rate[l] = [];
+                _rateList[l] = [];
               }
-            } else {
-              _rate[l] = [];
-              _rateList[l] = [];
             }
           }