11wqe1 8 місяців тому
батько
коміт
3fcc787ce8

Різницю між файлами не показано, бо вона завелика
+ 315 - 340
src/components/pages/components/exportDataDialog.vue


+ 3 - 67
src/components/pages/components/exportWorksDialog.vue

@@ -826,82 +826,18 @@ export default {
         );
       });
 
-      // let domHeight = this.$refs.reportPdf.offsetHeight;
-      // // console.log('this.$refs.reportPdf',this.$refs.reportPdf.offsetHeight);
-      // let maxHeight = 64257;
-      //   html2canvas(this.$refs.reportPdf, {
-      //     useCORS: true, // 如果截图的内容里有图片,可能会有跨域的情况,加上这个参数,解决文件跨域问题
-      //     scale: maxHeight / domHeight > 1 ? 1 : maxHeight / domHeight
-      //   })
-      //     .then(canvas => {
-      //       const contentWidth = canvas.width;
-      //       const contentHeight = canvas.height;
-
-      //       var pageData = canvas.toDataURL("image/jpeg", 1.0);
-
-      //       var pdf = new jspdf("", "pt", [contentWidth, contentHeight]);
-
-      //       //有两个高度需要区分,一个是html页面的实际高度,和生成pdf的页面高度(841.89)
-      //       //当内容未超过pdf一页显示的范围,无需分页
-      //       // if (leftHeight < pageHeight) {
-      //       pdf.addImage(pageData, "JPEG", 0, 0, contentWidth, contentHeight);
-
-      //       pdf.save(
-      //         this.worksDialogCon2.course +
-      //           "-作业集-" +
-      //           this.worksDialogCon2.sName +
-      //           ".pdf"
-      //       );
-      //       return resolve();
-      //     })
-      //     .catch(err => {
-      //       console.log(err);
-      //     });
+  
     },
 
     // 压缩pdf
     async getPdf2() {
-      // html2canvas(content)
-      //   .then(canvas => {
-      //     const imgData = canvas.toDataURL("image/png");
-      //     const pdf = new jspdf("p", "pt", [
-      //       content.offsetWidth,
-      //       content.offsetHeight
-      //     ]);
-
-      //     pdf.addImage(
-      //       imgData,
-      //       "PNG",
-      //       0,
-      //       0,
-      //       content.offsetWidth,
-      //       content.offsetHeight
-      //     );
-      //     pdf.save(
-      //       this.worksDialogCon2.course +
-      //           "-作业集-" +
-      //           this.worksDialogCon2.sName +
-      //           ".pdf"
-      //     );
-      //   })
-      // let domHeight = this.$refs.reportPdf.offsetHeight;
-      // let maxHeight = 64257;
+  
       const content = this.$refs.reportPdf;
 
       return new Promise((resolve, reject) => {
         html2canvas(content)
           .then(canvas => {
-            // const contentWidth = canvas.width;
-            // const contentHeight = canvas.height;
-
-            // var pageData = canvas.toDataURL("image/jpeg", 1.0);
-
-            // var pdf = new jspdf("", "pt", [contentWidth, contentHeight]);
-
-            // //有两个高度需要区分,一个是html页面的实际高度,和生成pdf的页面高度(841.89)
-            // //当内容未超过pdf一页显示的范围,无需分页
-            // // if (leftHeight < pageHeight) {
-            // pdf.addImage(pageData, "JPEG", 0, 0, contentWidth, contentHeight);
+          
             const imgData = canvas.toDataURL("image/png");
             const pdf = new jspdf("p", "pt", [
               content.offsetWidth,

+ 93 - 71
src/components/pages/components/lookReport.vue

@@ -34,6 +34,15 @@
           size="small"
           >一键导出</el-button
         >
+        <el-button
+          v-if="checkCourse.state == 5"
+          @click="batchExportPdf"
+          :type="multipleSelection.length < 3 ? 'info' : 'primary'"
+          :disabled="multipleSelection.length < 3"
+          size="small"
+          >批量导出</el-button
+        >
+
         <el-button
           style="margin-left: 20px;"
           @click="pageBack"
@@ -100,7 +109,15 @@
         :fit="true"
         style="width: 100%"
         :header-cell-style="{ background: 'rgb(238,238,238)' }"
+        @selection-change="handleSelectionChange"
       >
+        <el-table-column
+          v-if="checkCourse.state == 5"
+          key="1"
+          type="selection"
+          width="55"
+        >
+        </el-table-column>
         <el-table-column
           prop="sName"
           label="姓名"
@@ -160,7 +177,6 @@
       </div>
     </div>
 
-
     <!-- ai查看报告 -->
     <el-dialog
       :visible.sync="worksDialog"
@@ -171,39 +187,33 @@
       :fullscreen="true"
     >
       <div slot="title" class="header-title">
-        <div style="color: #fff">{{ this.digNum == 2 ?'查看':'导出' }}报告</div>
+        <div style="color: #fff">
+          {{ this.digNum == 2 ? "查看" : "导出" }}报告
+        </div>
       </div>
-      <exportDataDialog  
+      <exportDataDialog
         v-if="checkCourse.state == 5"
-        :key="exportW" 
+        :key="exportW"
         :digNum="digNum"
-        :oid="oid" 
-        :multipleSelection="multipleSelection" 
-        :worksDialogCon="worksDialogCon" 
-        :worksDialog.sync="worksDialog" 
-        :cid="checkCourse.courseId">
+        :oid="oid"
+        :classAarray="classAarray"
+        :multipleSelection="multipleSelection"
+        :worksCon="worksDialogCon"
+        :worksDialog.sync="worksDialog"
+        :cid="checkCourse.courseId"
+      >
       </exportDataDialog>
-
+      <!-- 非ai查看报告 -->
       <div v-else class="report_box">
         <studentReport
-            :checkCourse="checkCourse.courseId"
-            :checkStudent="checkStudent"
-            @cancelR="cancelR"
-            :oid="oid"
+          :checkCourse="checkCourse.courseId"
+          :checkStudent="checkStudent"
+          @cancelR="cancelR"
+          :oid="oid"
         ></studentReport>
       </div>
     </el-dialog>
 
-
-    <!-- 非ai查看报告
-    <div class="report_box" v-if="reportVisible">
-        <studentReport
-            :checkCourse="checkCourse.courseId"
-            :checkStudent="checkStudent"
-            @cancelR="cancelR"
-            :oid="oid"
-        ></studentReport> 
-    </div> -->
   </div>
 </template>
 
@@ -212,7 +222,7 @@ import exportDataDialog from "./exportDataDialog.vue";
 import studentReport from "./studentReport.vue";
 
 export default {
-  props: ["signDialog", "checkCourse","oid"],
+  props: ["signDialog", "checkCourse", "oid"],
   components: {
     exportDataDialog,
     studentReport
@@ -221,12 +231,12 @@ export default {
     return {
       // 查看报告table数据
       lookReportTab: [],
-      exportW:0,
-      multipleSelection:[],
-      worksDialog:false,
-      digNum:0,
+      exportW: 0,
+      multipleSelection: [],
+      worksDialog: false,
+      digNum: 0,
       reportVisible: false,
-      checkStudent:'',
+      checkStudent: "",
       userAarray: [],
       classAarray: [],
       uname: "",
@@ -235,7 +245,7 @@ export default {
       page2: 1,
       total2: 0,
       isLoading2: false,
-      worksDialogCon:{}
+      worksDialogCon: {}
     };
   },
   mounted() {
@@ -250,56 +260,71 @@ export default {
     }
   },
   methods: {
+    // 批量选择作业
+    handleSelectionChange(val) {
+      this.multipleSelection = val;
+    },
     // ai查看报告
-    lookPdf(val){
-      this.worksDialogCon=val
+    lookPdf(val) {
+      this.worksDialogCon = val;
       this.worksDialog = true;
-      this.digNum = 2
-      this.exportW++
+      this.digNum = 2;
+      this.exportW++;
     },
     // 一键导出
     exportWorkPdf() {
-      this
-        .$confirm("一键导出所有报告需要占用您大量时间,是否导出?", "提示", {
-          confirmButtonText: "确认",
-          cancelButtonText: "取消",
-          type: "warning",
+      this.$confirm("一键导出所有报告需要占用您大量时间,是否导出?", "提示", {
+        confirmButtonText: "确认",
+        cancelButtonText: "取消",
+        type: "warning"
+      })
+        .then(() => {
+          this.worksDialog = true;
+          this.digNum = 1;
+          this.exportW++;
         })
+        .catch(err => {
+          console.log(err);
+        });
+    },
+    batchExportPdf() {
+      this.$confirm("批量导出报告需要占用您一些时间,是否导出?", "提示", {
+        confirmButtonText: "确认",
+        cancelButtonText: "取消",
+        type: "warning"
+      })
         .then(() => {
+
           this.worksDialog = true;
-          this.digNum = 1
-          this.exportW++
+
+          this.digNum = 0;
+          this.exportW++;
         })
-        .catch((err) => {
-            console.log(err);
+        .catch(err => {
+          console.log(err);
         });
-     
     },
     // 导出报告
     getPdf(val) {
-
-        this
-        .$confirm("直接导出报告需要占用您一些时间,是否导出?", "提示", {
-          confirmButtonText: "确认",
-          cancelButtonText: "取消",
-          type: "warning",
-        })
+      this.$confirm("直接导出报告需要占用您一些时间,是否导出?", "提示", {
+        confirmButtonText: "确认",
+        cancelButtonText: "取消",
+        type: "warning"
+      })
         .then(() => {
-            console.log('val',val);
+          console.log("val", val);
 
-            this.worksDialogCon=val
-            this.worksDialog = true;
+          this.worksDialogCon = val;
+          this.worksDialog = true;
 
-            this.multipleSelection = []
-            this.multipleSelection.push(val)
-            this.digNum = 0
-            this.exportW++
+          this.multipleSelection = [];
+          this.multipleSelection.push(val);
+          this.digNum = 0;
+          this.exportW++;
         })
-        .catch((err) => {
-            console.log(err);
+        .catch(err => {
+          console.log(err);
         });
-        
-
     },
     // 关闭弹框返回查看课程
     pageBack() {
@@ -358,8 +383,7 @@ export default {
     },
     handleClose(done) {
       done();
-    },
-   
+    }
   }
 };
 </script>
@@ -369,9 +393,9 @@ export default {
   width: 94%;
   margin: auto;
 }
-.TableCss >>> .el-table__header-wrapper .el-table__header .el-checkbox {
+/* .TableCss >>> .el-table__header-wrapper .el-table__header .el-checkbox {
   display: none;
-}
+} */
 .JsonTit {
   width: 100%;
   padding: 20px 0;
@@ -394,14 +418,12 @@ export default {
   margin-left: 10px;
 }
 
-
-
-.worksDialogCSSExp>>> .el-dialog__header {
+.worksDialogCSSExp >>> .el-dialog__header {
   /* padding: 9px 20px 10px; */
   background: #32455b !important;
 }
 
-.worksDialogCSSExp >>> .el-dialog__wrapper{
+.worksDialogCSSExp >>> .el-dialog__wrapper {
   overflow: hidden !important;
 }
 .worksDialogCSSExp >>> .el-dialog__body {

+ 33 - 12
src/components/pages/components/report.vue

@@ -97,7 +97,7 @@
       :fullscreen="true"
     >
       <div slot="title" class="header-title">
-        <div style="color: #fff">自定义导出:{{ dataJson.title }}</div>
+        <div style="color: #fff">{{dataJson.state == 5 ?"按任务导出" :'自定义导出' + ':' +dataJson.title }}</div>
       </div>
 
       <div class="worksDiaCon" ref="reportPdf">
@@ -668,17 +668,36 @@ export default {
           content.offsetHeight
         );
 
-        let username = "";
+        let className = "";
+
+        if (this.chooseClass.length) {
+          this.classArray.forEach((e,i)=>{
+            if (this.chooseClass.indexOf(e.id) != -1) {
+              className += `${e.name}、`
+            }
+          })
+        }else{
+          this.classArray.forEach(e=>{
+              className += `${e.name}、`
+          })
+        }
+
+        className = className.slice(0 , -1 ) + '-'
+
+        
+
+
+
         let taskName = "";
         let taskList = JSON.parse(JSON.stringify(this.task));
 
-        this.pdfUser.forEach((e, i) => {
-          if (this.pdfUser.length - 1 == i) {
-            username += `${e.username}-`;
-          } else {
-            username += `${e.username},`;
-          }
-        });
+        // this.pdfUser.forEach((e, i) => {
+        //   if (this.pdfUser.length - 1 == i) {
+        //     username += `${e.username}-`;
+        //   } else {
+        //     username += `${e.username},`;
+        //   }
+        // });
 
         if (this.dataJson.state == 5) {
           if (!taskList.length) {
@@ -694,12 +713,14 @@ export default {
             console.log("ar", ar);
 
             if (taskList.indexOf(ar) != -1) {
-              taskName += `${e.name}-`;
+              taskName += `${e.name}`;
             }
           });
-          pdf.save(username + this.dataJson.title + "-" + taskName + ".pdf");
+          taskName = taskName.slice(0 , -1 ) + '-'
+
+          pdf.save(className + this.dataJson.title + "-" + taskName + ".pdf");
         } else {
-          pdf.save(username + this.dataJson.title + ".pdf");
+          pdf.save(className + this.dataJson.title + ".pdf");
         }
 
         // this.worksDialog = false;

+ 1 - 13
src/components/pages/components/studentWorksDetail.vue

@@ -1470,18 +1470,6 @@
     </el-dialog>
 
     <div class="report_box" v-if="reportVisible">
-      <!-- <el-dialog
-        v-if="exportData.state == 5"
-        :visible.sync="reportVisible"
-        width="100%"
-        :before-close="handleClose"
-        class="full_diy"
-        :append-to-body="true"
-      >
-      <div slot="title" class="header-title">
-        <div style="color: #fff">查看作业</div>
-      </div>
-    </el-dialog>  -->
 
     <el-dialog
       v-if="exportData.state == 5"
@@ -1495,7 +1483,7 @@
       <div slot="title" class="header-title">
         <div style="color: #fff">查看报告</div>
       </div>
-      <exportDataDialog  :key="checkStudent" :digNum="'2'" :oid="oid" :worksDialogCon="exportData" :cid="checkCourse"></exportDataDialog>
+      <exportDataDialog  :key="checkStudent" :digNum="'2'" :oid="oid" :worksCon="exportData" :cid="checkCourse"></exportDataDialog>
 
     </el-dialog>
 

+ 5 - 4
src/components/pages/components/worksDetail2.vue

@@ -18,18 +18,19 @@
           >一键导出</el-button
         >
         <el-button @click="exportData" 
-          v-if="DState == 5 && cutTabNum == 0 && multipleSelection.length > 1"
-          type="primary" 
+          v-if="DState == 5 && cutTabNum == 0"
+          :type="multipleSelection.length < 3 ? 'info' : 'primary'" 
+          :disabled="multipleSelection.length < 3"
           size="small"
           >批量导出</el-button
         >
-        <el-button
+        <!-- <el-button
           v-if="DState == 5 && cutTabNum == 0 && multipleSelection.length < 2"
           type="info" 
           disabled
           size="small"
           >批量导出</el-button
-        >
+        > -->
         <el-button @click="customizeExport" 
           type="primary" 
           size="small"

+ 2 - 2
src/components/pages/works.vue

@@ -492,7 +492,7 @@
       ></studentReport>
     </div>
 
-    <el-dialog
+    <!-- <el-dialog
       :visible.sync="worksDialog"
       :before-close="handleClose"
       class="worksDialogCSSExp"
@@ -512,7 +512,7 @@
         :worksDialog.sync="worksDialog" 
         :cid="checkCourse.courseId">
       </exportDataDialog>
-    </el-dialog>
+    </el-dialog> -->
    
   </div>
 </template>

Деякі файли не було показано, через те що забагато файлів було змінено