Browse Source

导出名称修改

11wqe1 7 months ago
parent
commit
c6a3c23bf4

+ 3 - 3
src/components/pages/components/studentWorksDetail.vue

@@ -3355,11 +3355,11 @@ export default {
           // pdf.addImage(pageData, "JPEG", 10, 0, imgWidth - 20, imgHeight - 20);
           pdf.addImage(pageData, 'JPEG', 0, 0, contentWidth, contentHeight );
 
-          pdf.save(
-            this.allWorks.course + "-" + this.allWorks.sName + "学生作业集.pdf"
-          );
+          pdf.save( this.allWorks.course+'-作业集' + '-'+ this.allWorks.sName+'.pdf')
+
           this.worksLoading = false;
         })
+        
         .catch(err => {
           this.worksLoading = false;
           console.log(err);

+ 54 - 90
src/components/pages/components/worksDetail2.vue

@@ -242,7 +242,7 @@
                 size="small"
                 v-else
                 @click="
-                  exportPdfSet(scope.row.id, scope.row.userid, 0, scope.$index,scope.row)
+                  exportPdfSet(scope.row.userid,scope.row)
                 "
                 >导出作业集</el-button
               > -->
@@ -1874,7 +1874,8 @@ export default {
       typeCheck: false,
       word2: require("../../../assets/icon/word2.png"),
       worksLoading:false,
-      cutTabNum:0
+      cutTabNum:0,
+      allWorkData:[]
     };
   },
   computed: {
@@ -2102,7 +2103,7 @@ export default {
         // if (leftHeight < pageHeight) {
         pdf.addImage(pageData, 'JPEG', 0, 0, contentWidth, contentHeight );
        
-        pdf.save( this.allWorks.course+'-'+ this.allWorks.sName+'学生作业集.pdf')
+        pdf.save( this.allWorks.course+'-作业集' + '-'+ this.allWorks.sName+'.pdf')
         this.worksLoading = false
     })
     .catch((err) => {
@@ -2944,9 +2945,7 @@ export default {
         });
     },
     // 按任务查看导出作业集
-    exportPdfSet(id, uid, type, index,con) {
-      this.scopeId1 = id;
-      this.studentId = uid;
+    exportPdfSet(uid, con) {
       let params = {
         uid: uid,
         cid: this.id,
@@ -2954,38 +2953,12 @@ export default {
       this.ajax
         .get(this.$store.state.api + "selectAllWorksDetail", params)
         .then((res) => {
-          var b = res.data[0].reduce((result, item) => {
-            const key = item.stage + "-" + item.task;
-            if (!result[key]) {
-              result[key] = item;
-            }
-            return result;
-          }, {});
-
-          // 将结果转换为数组形式
-          b = Object.values(b);
-          var c = b.sort(function (x, y) {
-            // 首先比较stage字段
-            if (x.stage !== y.stage) {
-              return parseInt(x.stage) - parseInt(y.stage);
-            }
-
-            // 如果stage字段相同,则比较task字段
-            return parseInt(x.task) - parseInt(y.task);
-          });
-          this.sInfo = c;      
-          var chapters = [],
-            eList = [],
-            _ooption = [],
-            _rate = [],
-            _rateList = [];
-            console.log('res.data',res.data);
-          var worksDetail = res.data[1];
           
-          var askInfo = res.data[3];
-          var answerInfo = res.data[4];
-          var pptInfo = res.data[5];
-          var chooseInfo = res.data[6];
+          var worksDetail = res.data[1]; 
+          var askInfo = res.data[3]; //问卷
+          var answerInfo = res.data[4]; //问答题
+          var pptInfo = res.data[5]; 
+          var chooseInfo = res.data[6]; //选择题
           var pjInfo = res.data[7]; //个人评价作业
           var xztkInfo = res.data[8]; //选择匹配作业
           var lccjInfo = res.data[9]; //排序作业
@@ -2993,8 +2966,48 @@ export default {
           var cocopiInfo = res.data[11]; //cocopi或源码编辑作业
           var wordInfo = res.data[12]; //文档作业
           var workEvaList = res.data[13];
-          var workJson = {};
-          let checkJson = {};
+
+          // this.allWorkData 
+          let AreaAllWork = [...res.data[1],...res.data[3],...res.data[4],...res.data[5],...res.data[6],...res.data[7],...res.data[8],...res.data[9],...res.data[10],...res.data[11],...res.data[12],...res.data[13]]
+          
+          
+          AreaAllWork.sort(function(a,b){
+            return a.stage-b.stage;//从小到大排序
+          })
+
+          let phaseList = JSON.parse(JSON.stringify(this.dyList))
+
+          phaseList.forEach(e=>{
+            e.stageData = []
+            AreaAllWork.forEach((k,index)=>{
+              if (k.stage == e.id) {
+                e.stage.push(k)
+              }
+            })
+          })
+
+          // phaseList.forEach(e=>{
+          //   e.taskList
+          //   e.stageData.forEach((k,index)=>{
+          //     if (k.stage == e.id) {
+          //       e.stage.push(k)
+          //     }
+          //   })
+          // })
+          // AreaAllWork.forEach((e,index)=>{
+          //     e.stage
+          // })
+
+          // let subset = []
+
+          
+
+          console.log('AreaAllWork',AreaAllWork);
+          
+
+          return
+
+
 
           for (var k = 0; k < res.data[0].length; k++) {
             this.allWorks = res.data[0][k];
@@ -4242,42 +4255,6 @@ export default {
             }
            
           }
-
-          //#region 
-          // for (var i = 0; i < pptInfo.length; i++) {
-          //   var a = ["PPT", "PPTX", "XLSX", "XLS", "DOC", "DOCX"];
-          //   if (
-          //     a.indexOf(
-          //       pptInfo[i].content
-          //         .split(".")
-          //         [pptInfo[i].content.split(".").length - 1].toLocaleUpperCase()
-          //     ) != -1
-          //   ) {
-          //     var a =
-          //       "https://view.officeapps.live.com/op/view.aspx?src=" +
-          //       pptInfo[i].content;
-          //     workJson.wpptInfo.push({
-          //       wpptInfo: a,
-          //       score: pptInfo[i].score
-          //         ? JSON.parse(pptInfo[i].score).wScore
-          //         : pptInfo[i].score,
-          //     });
-          //   } else if (
-          //     pptInfo[i].content
-          //       .split(".")
-          //       [
-          //         pptInfo[i].content.split(".").length - 1
-          //       ].toLocaleUpperCase() == "PDF"
-          //   ) {
-          //     workJson.wpptInfo.push({
-          //       wpptInfo: pptInfo[i].content,
-          //       score: pptInfo[i].score
-          //         ? JSON.parse(pptInfo[i].score).wScore
-          //         : pptInfo[i].score,
-          //     });
-          //   }
-          // }
-//#endregion
           for (var i = 0; i < answerInfo.length; i++) {
             if (answerInfo[i].stage == w.stage && answerInfo[i].task == w.task) {
               const element = answerInfo[i];
@@ -4552,20 +4529,6 @@ export default {
               _choose += `<div>${_div.innerHTML}</div>`;
             }
           }
-
-          // var _pj = "";
-          // if(workJson.pjInfo.length > 0){
-          //   var _pj = "<h3>个人评价<h3>";
-          //   for(var i = 0;i<workJson.pjInfo.length;i++){
-          //     var _div = document.createElement("div");
-          //     _div.innerHTML = `<h4>个人评价:${workJson.pjInfo[i].answer.eBzText}</h4> `;
-          //     _div.innerHTML += `<div>${workJson.pjInfo[i].radio}</div> `;
-          //     _choose += `<div>${_div.innerHTML}</div>`;
-          //   }
-          // }
-
-            //  console.log(workJson.lccjInfo)
-          
           var _lccjInfo = "";        
           if (workJson.lccjInfo.length>0) {
             if (workJson.lccjInfo[0].lccjInfo.length > 0) {
@@ -4745,7 +4708,7 @@ export default {
       // debugger
       // 生成报告
       const link = document.createElement("a");
-      let dname = w.course + "-"+ (this.dyList[w.stage].name ? this.dyList[w.stage].name : `阶段${w.stage+1}`) +"-" + (this.dyList[w.stage].taskList[w.task].name ? this.dyList[w.stage].taskList[w.task].name : `任务${w.task+1}`) + w.sName + ".html";
+      let dname = w.course + "-"+ (this.dyList[w.stage].name ? this.dyList[w.stage].name : `阶段${w.stage+1}`) +"-" + (this.dyList[w.stage].taskList[w.task].name ? this.dyList[w.stage].taskList[w.task].name : `任务${w.task+1}`) + '-' +w.sName + ".html";
       // link.download = "报告.html"; // 文件名
       console.log('dname',dname);
       
@@ -5349,6 +5312,7 @@ export default {
   font-size: 16px;
   color: #7c7c7c;
   width: 100%;
+  /* min-width: 1246px; */
   /* margin-bottom: 10px; */
   display: flex;
   justify-content: space-between;