Sfoglia il codice sorgente

优化打印:成绩分析、错题分析打印padf

liurongli 2 settimane fa
parent
commit
035f6dcceb

BIN
src/assets/icon/report_loading.png


+ 99 - 2
src/components/ErrorsTablePdf.vue

@@ -122,6 +122,30 @@
       </div>
     </div>
   </div>
+  <div class="page_dialog">
+    <el-dialog
+      title="下载PDF"
+      v-model="showReportLoading"
+      width="500px"
+      top="15%"
+    >
+      <div class="report_loading">
+        <div class="report_loading_icon">
+          <img src="@/assets/icon/report_loading.png" />
+        </div>
+        <div class="report_loading_title">正在努力生成PDF中,请稍等...</div>
+        <div class="report_loading_progress">
+          <el-progress
+            :text-inside="true"
+            color="#2E64FA"
+            text-color="#ffffff"
+            :stroke-width="16"
+            :percentage="targetProgress"
+          ></el-progress>
+        </div>
+      </div>
+    </el-dialog>
+  </div>
 </template>
 
 <script lang="ts" setup>
@@ -129,6 +153,7 @@ import { getNowTime } from "@/utils/common";
 import { ref, nextTick, watch } from "vue";
 import { ElMessage } from "element-plus";
 import { jsPDF } from "jspdf";
+import { onUnmounted } from "vue";
 import domtoimage from "dom-to-image";
 // 定义数据类型
 interface TableItem {
@@ -170,6 +195,11 @@ const props = defineProps({
     default: "",
   },
 });
+// 打印弹框
+const showReportLoading = ref(false);
+const targetProgress = ref(0);
+const progressInterval = ref(null);
+
 const tablePageData = ref<TableItem[][]>([]);
 const totalPageNum = ref(0);
 // 定义 Emits
@@ -589,6 +619,8 @@ const TablePagesData = () => {
 
 // 下载 PDF (使用 dom-to-image)
 const DownloadPdf = async () => {
+  showReportLoading.value = true;
+  targetProgress.value = 0;
   // 关键:等分页校正循环(最多 12 轮)彻底收敛后再截图。
   // 切班级时 tableData 刚更新,correction 循环会反复重建 .print_page DOM,
   // 提前截图会截到已卸载的死节点(scrollWidth=0 → 空图 → jsPDF 报 UNKNOWN)
@@ -597,9 +629,14 @@ const DownloadPdf = async () => {
   const elements = rootRef.value?.querySelectorAll(".print_page") || [];
   if (elements.length === 0) {
     ElMessage.warning("未找到可导出的页面内容,请先加载数据!");
+    showReportLoading.value = false;
     emit("PdfLoadEnd");
     return;
   }
+  const pageCount = elements.length;
+  let oneProgress = Math.round((1 / pageCount) * 100);
+  StartProgress(0, oneProgress);
+
   const pdf = new jsPDF("p", "pt", "a4");
   const pdfWidth = pdf.internal.pageSize.getWidth();
   const pdfHeight = pdf.internal.pageSize.getHeight();
@@ -607,6 +644,11 @@ const DownloadPdf = async () => {
   for (const [pageIndex, element] of Array.from(elements).entries()) {
     await nextTick();
     if (element) {
+      // 更新进度
+      const progress = Math.floor((pageIndex / pageCount) * 100);
+      const lastProgressprogress = progress - oneProgress;
+      StartProgress(lastProgressprogress, progress);
+
       const htmlElement = element as HTMLElement;
       htmlElement.style.visibility = "visible";
       htmlElement.offsetHeight;
@@ -621,7 +663,7 @@ const DownloadPdf = async () => {
           await new Promise((r) => setTimeout(r, 200));
         }
         dataUrl = await domtoimage.toJpeg(htmlElement, {
-          quality: 0.7,
+          quality: 0.6,
           width: htmlElement.scrollWidth * 2,
           height: htmlElement.scrollHeight * 2,
           canvasWidth: htmlElement.scrollWidth * 2,
@@ -710,6 +752,8 @@ const DownloadPdf = async () => {
   const url = URL.createObjectURL(
     new File([blob], filename, { type: "application/pdf" }),
   );
+  // 生成完成,关闭弹窗
+  showReportLoading.value = false;
   // 此时已不在用户手势里,可能被弹窗拦截;被拦就退化为直接下载
   const win = window.open(url, "_blank");
   if (!win) {
@@ -726,6 +770,54 @@ const DownloadPdf = async () => {
   }
   emit("PdfLoadEnd");
 };
+// 开始进度条数值变化  最大增加进度值 maxIncrement
+const StartProgress = (currentValue, targetValue) => {
+  // 清除已存在的定时器
+  if (progressInterval.value) {
+    clearInterval(progressInterval.value);
+    progressInterval.value = null;
+  }
+
+  // 获取当前进度值
+  if (targetProgress.value < currentValue) {
+    targetProgress.value = currentValue;
+  }
+  // 注意:这里不能再叫 targetProgress,否则会把外面的 ref 影子掉
+  const targetVal = targetValue;
+  // 如果当前值大于等于目标值,则不需要动画(进度不能递减)
+  if (targetProgress.value >= targetVal) {
+    return;
+  }
+
+  // 计算差值
+  const difference = targetVal - currentValue;
+
+  // 根据差值计算时间间隔:差值1->500ms,差值10->50ms
+  const minInterval = 50;
+  const maxInterval = 500;
+  const clampedDifference = Math.max(1, Math.min(difference, 10));
+  let interval =
+    maxInterval - (clampedDifference - 1) * ((maxInterval - minInterval) / 9);
+  interval = Math.round(interval / 10) * 10;
+  interval = Math.max(minInterval, Math.min(interval, maxInterval));
+  // 计算每次增加的步长(差值越大,步长越大)
+  const step = Math.max(1, Math.floor(difference / 5)) || 1;
+
+  // 创建新的定时器
+  progressInterval.value = setInterval(() => {
+    // 只能增加,不能减少
+    targetProgress.value = Math.min(
+      targetProgress.value + step,
+      targetVal,
+    );
+    // 如果达到目标值,清除定时器
+    if (targetProgress.value >= targetVal) {
+      targetProgress.value = targetVal;
+      clearInterval(progressInterval.value);
+      progressInterval.value = null;
+    }
+  }, interval);
+};
 // 错题分析  合并单元格
 const SpanMethod = ({ row, column }: any) => {
   const props = [
@@ -780,7 +872,12 @@ watch(
   },
   { deep: true },
 );
-
+onUnmounted(() => { 
+  if (progressInterval.value) {
+      clearInterval(progressInterval.value);
+      progressInterval.value = null;
+    }
+});
 // 暴露方法供父组件调用
 defineExpose({
   DownloadPdf,

+ 108 - 14
src/components/ScorePdf.vue

@@ -3,7 +3,7 @@
   <div class="report_module score_pdf">
     <template v-for="(item, page) in state.tableData">
       <div class="area_page print_page">
-        <div class="area_title" v-if="item.isFirstPage">
+        <div class="area_title">
           <div class="page_num">
             第{{ page + 1 }}页(共{{ state.pageTotal }}页)
           </div>
@@ -12,7 +12,7 @@
           </div>
           <div class="print_time">打印时间:{{ getNowTime() }}</div>
         </div>
-        <div class="area_count" v-if="item.isFirstPage">
+        <div class="area_count">
           应考:{{ item?.fiveRateResult?.examAllNum || 0 }}人&nbsp;&nbsp;
           实考:{{ item?.fiveRateResult?.effectiveNum || 0 }}人&nbsp;&nbsp;
           缺考:{{
@@ -70,13 +70,37 @@
       </div>
     </template>
   </div>
+  <div class="page_dialog">
+    <el-dialog
+      title="下载PDF"
+      v-model="showReportLoading"
+      width="500px"
+      top="15%"
+    >
+      <div class="report_loading">
+        <div class="report_loading_icon">
+          <img src="@/assets/icon/report_loading.png" />
+        </div>
+        <div class="report_loading_title">正在努力生成PDF中,请稍等...</div>
+        <div class="report_loading_progress">
+          <el-progress
+            :text-inside="true"
+            color="#2E64FA"
+            text-color="#ffffff"
+            :stroke-width="16"
+            :percentage="targetProgress"
+          ></el-progress>
+        </div>
+      </div>
+    </el-dialog>
+  </div>
 </template>
 
 <script lang="ts" setup>
 import { studentTranscriptTitle, queryStudentTranscript } from "@/api/analysis";
 import { useAnalysisStore } from "@/store/analysis";
 import { getNowTime } from "@/utils/common";
-import { reactive, computed, nextTick } from "vue";
+import { reactive, computed,onUnmounted, nextTick, ref } from "vue";
 import { ElMessage } from "element-plus";
 import { jsPDF } from "jspdf";
 import domtoimage from "dom-to-image";
@@ -111,6 +135,9 @@ const analysisStore = useAnalysisStore();
 const examName = computed(() => {
   return analysisStore.analysisExamInfo.examName || "";
 });
+const showReportLoading = ref(false);
+const targetProgress = ref(0);
+const progressInterval = ref(null);
 const state = reactive<State>({
   keyWord: "",
   selectClassList: [],
@@ -176,14 +203,14 @@ const GetTableData = async () => {
     state.tableLoading = false;
   }
 };
-//分页:超过一页自动换页,后续页不包含标题行和应考/实考/缺考统计行
+//分页:超过一页自动换页,标题行+统计行每页都显示,表头只在第一页显示
 const tablePageData = (list: any[]) => {
   const trLineHeight = 21; //表格表头、tr行高
   const printPageHeight = 1255; //打印页面高度 减掉padding 30px
 
   const rowNum = Math.floor(printPageHeight / trLineHeight); //每页可容纳行数 向下取整
   const firstPageRows = rowNum - 3; //第一页数据行数:标题行+统计行+表头行占3行
-  const otherPageRows = rowNum; //后续页数据行数:无标题、无统计、无表头,数据行放满  原来是 rowNum - 1,后续页没有表头占位了,数据行放满
+  const otherPageRows = rowNum - 2; //后续页数据行数:标题行+统计行占2行,无表头
 
   const pageList: any[] = [];
   list.forEach((item) => {
@@ -224,6 +251,7 @@ const PageInit = async (
   state.selectClassList = selectClassList;
   state.sortType = sortType;
   state.filterType = filterType;
+  targetProgress.value = 0;
   await Promise.all([GetStudentTranscriptTitle(), GetTableData()]);
 };
 
@@ -355,8 +383,12 @@ const ExportPdf = async () => {
   );
   if (!elements.length) {
     ElMessage.warning("未找到可导出的页面内容,请先加载数据!");
+    showReportLoading.value = false;
     return;
   }
+  const pageCount = elements.length;
+  let oneProgress = Math.round((1 / pageCount) * 100);
+  StartProgress(0, oneProgress);
   // 1. 确保页面 DOM 渲染完成(只在最开始等一次,不再逐页等待)
   await nextTick();
 
@@ -397,17 +429,22 @@ const ExportPdf = async () => {
   );
 
   // 6. 并发截图:多页并行,限制并发数防止内存峰值过高
-  //    机器内存大、页面多时可以调大到 6-8;页面很大时可降到 2
-  const CONCURRENCY = 4;
+  //    999 条数据页数较多,并发 6 加快截图;页面很大时可降到 2-4
+  const CONCURRENCY = 6;
   const dataUrls: string[] = new Array(elements.length);
   let cursor = 0;
   const worker = async () => {
     while (cursor < elements.length) {
       const pageIndex = cursor++;
+      // 更新进度
+      const progress = Math.floor((pageIndex / pageCount) * 100);
+      const lastProgressprogress = progress - oneProgress;
+      StartProgress(lastProgressprogress, progress);
       const htmlElement = elements[pageIndex];
-      // 渲染参数与原来完全一致,保留 scale(2)
+      // 渲染参数与原来完全一致,保留 scale(2);quality 0.6 在表格类内容上肉眼
+      // 几乎无差,但单页 JPEG 体积明显变小,PDF 整体更小、打开/翻页更快
       dataUrls[pageIndex] = await domtoimage.toJpeg(htmlElement, {
-        quality: 0.7,
+        quality: 0.6,
         width: htmlElement.scrollWidth * 2,
         height: htmlElement.scrollHeight * 2,
         canvasWidth: htmlElement.scrollWidth * 2,
@@ -426,9 +463,8 @@ const ExportPdf = async () => {
     }
   };
   await Promise.all(
-    Array.from(
-      { length: Math.min(CONCURRENCY, elements.length) },
-      () => worker(),
+    Array.from({ length: Math.min(CONCURRENCY, elements.length) }, () =>
+      worker(),
     ),
   );
 
@@ -459,12 +495,13 @@ const ExportPdf = async () => {
   });
 
   // PDF 全部生成完后再开新标签,直接打开 PDF(不提前开窗、不写中转页、不用 iframe)
-  const filename = `${examName.value}_${analysisStore?.filterObject?.subjectName || ''}_${analysisStore?.filterObject?.classGroupName || ''}成绩单.pdf`;
+  const filename = `${examName.value}_${analysisStore?.filterObject?.subjectName || ""}_${analysisStore?.filterObject?.classGroupName || ""}成绩单.pdf`;
   pdf.setProperties({ title: filename.replace(/\.pdf$/, "") });
   const blob = pdf.output("blob");
   const url = URL.createObjectURL(
     new File([blob], filename, { type: "application/pdf" }),
   );
+  showReportLoading.value = false;
   // 此时已不在用户手势里,可能被弹窗拦截;被拦就退化为直接下载
   const win = window.open(url, "_blank");
   if (!win) {
@@ -480,6 +517,54 @@ const ExportPdf = async () => {
     window.focus();
   }
 };
+// 开始进度条数值变化  最大增加进度值 maxIncrement
+const StartProgress = (currentValue, targetValue) => {
+  // 清除已存在的定时器
+  if (progressInterval.value) {
+    clearInterval(progressInterval.value);
+    progressInterval.value = null;
+  }
+
+  // 获取当前进度值
+  if (targetProgress.value < currentValue) {
+    targetProgress.value = currentValue;
+  }
+  // 注意:这里不能再叫 targetProgress,否则会把外面的 ref 影子掉
+  const targetVal = targetValue;
+  // 如果当前值大于等于目标值,则不需要动画(进度不能递减)
+  if (targetProgress.value >= targetVal) {
+    return;
+  }
+
+  // 计算差值
+  const difference = targetVal - currentValue;
+
+  // 根据差值计算时间间隔:差值1->500ms,差值10->50ms
+  const minInterval = 50;
+  const maxInterval = 500;
+  const clampedDifference = Math.max(1, Math.min(difference, 10));
+  let interval =
+    maxInterval - (clampedDifference - 1) * ((maxInterval - minInterval) / 9);
+  interval = Math.round(interval / 10) * 10;
+  interval = Math.max(minInterval, Math.min(interval, maxInterval));
+  // 计算每次增加的步长(差值越大,步长越大)
+  const step = Math.max(1, Math.floor(difference / 5)) || 1;
+
+  // 创建新的定时器
+  progressInterval.value = setInterval(() => {
+    // 只能增加,不能减少
+    targetProgress.value = Math.min(
+      targetProgress.value + step,
+      targetVal,
+    );
+    // 如果达到目标值,清除定时器
+    if (targetProgress.value >= targetVal) {
+      targetProgress.value = targetVal;
+      clearInterval(progressInterval.value);
+      progressInterval.value = null;
+    }
+  }, interval);
+};
 // 加载数据并导出PDF(供父组件一步调用)
 const LoadAndExportPdf = async (
   keyWord: string,
@@ -487,11 +572,20 @@ const LoadAndExportPdf = async (
   sortType: number,
   filterType: number,
 ) => {
+  // 点按钮立刻弹框,不要等数据加载完再弹
+  showReportLoading.value = true;
+  targetProgress.value = 0;
+  await nextTick();
   await PageInit(keyWord, selectClassList, sortType, filterType);
   await nextTick();
   await ExportPdf();
 };
-
+onUnmounted(() => { 
+  if (progressInterval.value) {
+      clearInterval(progressInterval.value);
+      progressInterval.value = null;
+    }
+});
 // 暴露方法供父组件调用
 defineExpose({
   PageInit,

+ 33 - 0
src/styles/common.scss

@@ -6309,3 +6309,36 @@ body {
     }
 
 }
+.report_loading
+{
+  padding: 10px 40px;
+
+  .report_loading_icon
+  {
+    text-align: center;
+    img
+    {
+      width: 200px;
+      height: auto;
+    }
+  }
+  .report_loading_title
+  {
+    font-size: 14px;
+    color:#333;
+    font-weight: 400;
+    text-align: center;
+    display: flex;
+    justify-content: center;
+  }
+
+  .report_loading_progress
+  {
+    padding: 40px;
+
+    .el-progress-bar__innerText
+    {
+      margin-bottom: 3px;
+    }
+  }
+}

+ 47 - 33
src/views/analysis/errorAnalysis.vue

@@ -148,15 +148,15 @@
     <el-dialog title="选择班级" center v-model="showClassPop" width="480px">
       <div class="dialog_center padding_20 page_search">
         <div class="select_check_content score_class_popup">
-          <!-- <div class="item_option">
+          <div class="item_option">
             <el-checkbox
               :indeterminate="isIndeterminate"
               v-model="checkAll"
               @change="HandleCheckAllChange"
               >全部</el-checkbox
             >
-          </div> -->
-          <!-- <el-checkbox-group
+          </div>
+          <el-checkbox-group
             v-model="selectClassList"
             @change="HandleCheckedClassChange"
           >
@@ -166,15 +166,7 @@
               :title="item.className"
               >{{ TruncateMiddleText(item.className, 5, 3, 1) }}</el-checkbox
             >
-          </el-checkbox-group> -->
-          <el-radio-group v-model="radioSelectClassList">
-            <el-radio
-              :value="item.classIdCode"
-              v-for="item in classList"
-              :title="item.className"
-              >{{ TruncateMiddleText(item.className, 5, 3, 1) }}</el-radio
-            >
-          </el-radio-group>
+          </el-checkbox-group>
         </div>
       </div>
       <div slot="footer" class="el-dialog__footer dialog-footer">
@@ -250,7 +242,9 @@ const getExamName = computed(() => {
 });
 const buttonLoading = ref<boolean>(false); //按钮loading
 const showClassPop = ref<boolean>(false); //选择班级弹框
-const radioSelectClassList = ref<string>(""); //选中的班级
+const selectClassList = ref<string[]>([]); //选中的班级
+const isIndeterminate = ref<boolean>(false); //是否班级全选半选
+const checkAll = ref<boolean>(false); //班级全选
 const classList = computed(() => {
   //班级列表
   const classNameList =
@@ -258,6 +252,28 @@ const classList = computed(() => {
       ?.list || [];
   return classNameList.filter((item: any) => item.classLevel == 2);
 });
+//班级全选
+const HandleCheckAllChange = () => {
+  if (checkAll.value) {
+    selectClassList.value = classList.value.map((item: any) => item.classIdCode);
+  } else {
+    selectClassList.value = [];
+  }
+};
+//班级选择改变事件
+const HandleCheckedClassChange = () => {
+  if (selectClassList.value.length > 0) {
+    checkAll.value = true;
+    if (selectClassList.value.length == classList.value.length) {
+      isIndeterminate.value = false;
+    } else {
+      isIndeterminate.value = true;
+    }
+  } else {
+    checkAll.value = false;
+    isIndeterminate.value = false;
+  }
+};
 const TruncateMiddleText = (
   text: string,
   num: number,
@@ -352,7 +368,7 @@ const GetErrorQuestionAnalysis = async () => {
 const GetErrorQuestionAnalysisPdf = (className: string) => {
   state.pdfTableData = [];
   const tableData = state.allTableData.filter((item: any) => {
-    return item.className == className;
+    return className.indexOf(item.className) != -1;
   });
 
   if (tableData?.length) {
@@ -489,14 +505,14 @@ const ExportExcel = () => {
 
 // 导出PDF
 const PrintPdf = () => {
-  if (analysisStore?.filterObject?.classLevel === 0) {
-    //年级
-    radioSelectClassList.value = "";
-    showClassPop.value = true; //显示弹框
-  } else {
+  // if (analysisStore?.filterObject?.classLevel === 0) {
+  //   //年级
+  //   selectClassList.value = [];
+  //   showClassPop.value = true; //显示弹框
+  // } else {
     reportModuleRef.value?.SetPrintLoading?.(true);
     errPdfReport.value?.DownloadPdf?.();
-  }
+  // }
 };
 
 // 导出PDF  加载完成
@@ -505,28 +521,25 @@ const PdfLoadEnd = () => {
 };
 //确定选择班级
 const ConfirmEnter = async () => {
-  // if (selectClassList.value.length == 0) {
-  //   ElMessage.warning("请至少选择一个班级!");
-  //   return;
-  // }
-  if (radioSelectClassList.value == "") {
-    ElMessage.warning("请选择班级!");
+  if (selectClassList.value.length == 0) {
+    ElMessage.warning("请至少选择一个班级!");
     return;
   }
   buttonLoading.value = true;
-  const className =
-    classList.value.find(
-      (item) => item.classIdCode == radioSelectClassList.value,
-    )?.className || "";
-
+  reportModuleRef.value?.SetPrintLoading?.(true);
+  const classInfo = classList.value.filter(
+      (item) => selectClassList.value.indexOf(item.classIdCode) != -1
+    ).sort((a, b) => a.classCode - b.classCode);
+  const className = classInfo.map((item) => item.className);
   GetErrorQuestionAnalysisPdf(className);
+  console.log(classInfo,className,state.pdfTableData,1212122);
   // 关键:等子组件按新数据开始分页后再调导出。
   // DownloadPdf 内部会 await 分页校正循环(最多 12 轮)收敛后才截图,
   // 否则会截到分页重建中的死节点(scrollWidth=0 → 空图 → jsPDF 报 UNKNOWN)
   await nextTick();
-  setTimeout(() => {
+  // setTimeout(() => {
     showClassPop.value = false; //先关闭弹框,不等PDF生成完成
-  }, 500);
+  // }, 500);
   errPdfReport.value
     ?.DownloadPdf?.() //加载并导出PDF
     .then(() => {
@@ -538,6 +551,7 @@ const ConfirmEnter = async () => {
     })
     .finally(() => {
       buttonLoading.value = false;
+      reportModuleRef.value?.SetPrintLoading?.(false);
     });
 };
 // 初始化

+ 25 - 25
src/views/analysis/score.vue

@@ -151,15 +151,15 @@
     >
       <div class="dialog_center padding_20 page_search">
         <div class="select_check_content score_class_popup">
-          <!-- <div class="item_option">
+          <div class="item_option">
             <el-checkbox
               :indeterminate="isIndeterminate"
               v-model="checkAll"
               @change="HandleCheckAllChange"
               >全部</el-checkbox
             >
-          </div> -->
-          <!-- <el-checkbox-group
+          </div>
+          <el-checkbox-group
             v-model="selectClassList"
             @change="HandleCheckedClassChange"
           >
@@ -169,8 +169,8 @@
               :title="item.className"
               >{{ TruncateMiddleText(item.className, 5, 3, 1) }}</el-checkbox
             >
-          </el-checkbox-group> -->
-          <el-radio-group
+          </el-checkbox-group>
+          <!-- <el-radio-group
             v-model="radioSelectClassList"
             @change="HandleCheckedClassChange"
           >
@@ -180,7 +180,7 @@
               :title="item.className"
               >{{ TruncateMiddleText(item.className, 5, 3, 1) }}</el-radio
             >
-          </el-radio-group>
+          </el-radio-group> -->
         </div>
         <div class="item_option">
           <el-radio-group v-model="sortType">
@@ -315,7 +315,7 @@ const showClassPop = ref<boolean>(false); //选择班级弹框
 const isIndeterminate = ref<boolean>(false); //是否班级全选半选
 const checkAll = ref<boolean>(false); //班级全选
 const selectClassList = ref<string[]>([]); //选中的班级
-const radioSelectClassList = ref<string>(""); //选中的班级
+// const radioSelectClassList = ref<string>(""); //选中的班级
 const sortType = ref<number>(1); //排序类型
 const filterType = ref<number>(1); //是否打印缺考学生
 const buttonLoading = ref<boolean>(false); //按钮loading
@@ -450,7 +450,7 @@ const ExportExcel = () => {
 // 打印PDF
 const PrintPdf = () => {
   selectClassList.value = [];//清空选择的数据
-  radioSelectClassList.value = "";
+  // radioSelectClassList.value = "";
   isIndeterminate.value = false;//默认不半选
   buttonLoading.value = false;
   sortType.value = 1;
@@ -464,16 +464,16 @@ const PrintPdf = () => {
     showClassPop.value = false;//不显示弹框
     reportModuleRef.value?.SetPrintLoading?.(true);
     const classIdCode = analysisStore?.filterObject?.classIdCode;
-    // selectClassList.value = classIdCode? [classIdCode] : [];
-    // scorePdfRef.value?.LoadAndExportPdf(state.keyWord, selectClassList.value)
-    //   .finally(() => {
-    //     reportModuleRef.value?.SetPrintLoading?.(false);
-    //   });//加载并导出PDF
-    radioSelectClassList.value = classIdCode;
-    scorePdfRef.value?.LoadAndExportPdf(state.keyWord, [radioSelectClassList.value])
+    selectClassList.value = classIdCode? [classIdCode] : [];
+    scorePdfRef.value?.LoadAndExportPdf(state.keyWord, selectClassList.value)
       .finally(() => {
         reportModuleRef.value?.SetPrintLoading?.(false);
-      });//加载并导出PDF  
+      });//加载并导出PDF
+    // radioSelectClassList.value = classIdCode;
+    // scorePdfRef.value?.LoadAndExportPdf(state.keyWord, [radioSelectClassList.value])
+    //   .finally(() => {
+    //     reportModuleRef.value?.SetPrintLoading?.(false);
+    //   });//加载并导出PDF  
   }
 };
 //班级全选
@@ -508,19 +508,19 @@ const TruncateMiddleText = (
 };
 //确定选择班级
 const ConfirmEnter = () => {
-  // if (selectClassList.value.length == 0) {
-  //   ElMessage.warning("请至少选择一个班级!");
-  //   return;
-  // }
-  if (radioSelectClassList.value == "") {
-    ElMessage.warning("请选择班级!");
+  if (selectClassList.value.length == 0) {
+    ElMessage.warning("请至少选择一个班级!");
     return;
   }
+  // if (radioSelectClassList.value == "") {
+  //   ElMessage.warning("请选择班级!");
+  //   return;
+  // }
   buttonLoading.value = true;
-  setTimeout(() => {
+  // setTimeout(() => {
     showClassPop.value = false;//先关闭弹框,不等PDF生成完成
-  }, 500);
-  scorePdfRef.value?.LoadAndExportPdf(state.keyWord, [radioSelectClassList.value], sortType.value, filterType.value)//加载并导出PDF
+  // }, 500);
+  scorePdfRef.value?.LoadAndExportPdf(state.keyWord, selectClassList.value, sortType.value, filterType.value)//加载并导出PDF
     .then(() => {
       // ElMessage.success("成绩单已在新页面打开,请去下载或打印");
     })