tangning 5 horas atrás
pai
commit
05e770e814

+ 5 - 2
src/view/case/photos/canvas-photo-editor.js

@@ -1180,13 +1180,12 @@ if (this.isPageDragging && this.selectedPageIndex !== -1) {
 
 
 
-  exportPagesToPDF(paperType = "a4", name) {
+  async exportPagesToPDF(paperType = "a4", name) {
     const loading = ElLoading.service({
       lock: true,
       text: "正在导出超清PDF,请稍候...",
       background: "rgba(0, 0, 0, 0.7)",
     });
-
     const originalState = {
       scale: this.scale,
       drawOffsetX: this.drawOffsetX,
@@ -1359,9 +1358,11 @@ if (this.isPageDragging && this.selectedPageIndex !== -1) {
       let fileName = name || "完整导出_" + Date.now();
       pdf.save(fileName + `.pdf`);
       ElMessage.success("PDF导出成功!");
+      return true
     } catch (err) {
       console.error(err);
       ElMessage.error("导出失败");
+      return false
     } finally {
       Object.assign(this, originalState);
       // this.drawAllPages();
@@ -1542,9 +1543,11 @@ async exportPagesAsImages(paperType = "a4", name, fileType = 'pdf') {
     const blob = await zip.generateAsync({ type: "blob" });
     saveAs(blob, `${filename}.zip`);
     ElMessage.success("导出成功!");
+    return true
   } catch (err) {
     console.error(err);
     ElMessage.error("导出失败");
+    return false
   } finally {
     loading.close();
   }

+ 4 - 4
src/view/case/photos/index.vue

@@ -80,15 +80,15 @@
           </span>
           <template #dropdown>
             <el-dropdown-menu>
+              <el-dropdown-item command="double">
+                <i class="iconfont icon-layout_two"></i>
+                一页两张</el-dropdown-item
+              >
               <el-dropdown-item command="single">
                 <i class="iconfont icon-layout_h"></i>
                 一页一张
               </el-dropdown-item
               >
-              <el-dropdown-item command="double">
-                <i class="iconfont icon-layout_two"></i>
-                一页两张</el-dropdown-item
-              >
               <el-dropdown-item command="landscape"
                 >
                 <i class="iconfont icon-layout_h"></i>竖版</el-dropdown-item

+ 1 - 1
src/view/material/exportPhotos.vue

@@ -47,7 +47,7 @@ defineExpose<QuiskExpose>({
       ElMessage.error("加载异常,请刷新浏览器");
       throw "加载异常,请刷新浏览器";
     }else{
-      props.showPagesRef.exportToPDF(exportInfo.value.paperType,props.title, exportInfo.value.fileType)
+      await props.showPagesRef.exportToPDF(exportInfo.value.paperType,props.title, exportInfo.value.fileType)
     }
   },
 });

+ 8 - 2
src/view/material/sceneImg.vue

@@ -521,7 +521,7 @@ import {
   overviewAdd,
   TabulationAdd,
 } from "@/store/case";
-import { ElMessage, ElMessageBox } from "element-plus";
+import { ElMessage, ElMessageBox, ElLoading } from "element-plus";
 import { delCaseFile } from "@/store/caseFile";
 import {
   uploadNewFile,
@@ -1159,7 +1159,14 @@ const handleConfirm = async () => {
       await getList()
 }
 const exportToPDF = async (isAll) => {
+  if(isAll === true){
+    await handleOpen(true)
+  }
   await exportCasePhotos({showPagesRef: showPagesRef.value})
+  console.log("exportToPDF完毕");
+  if(isAll){
+    await handleOpen(false)
+  }
   // showPagesRef.value.exportToPDF(paperType, childrenList.value?.item?.name);
 }
 const handleOpen = (val) => {
@@ -1187,7 +1194,6 @@ const handleOpen = (val) => {
     })
     childrenList.value.src = Alllist;
     childrenList.value.value = -1;
-    
     console.log("handleOpen", Alllist);
   }
 }

+ 4 - 3
src/view/material/showpages.vue

@@ -78,11 +78,12 @@ onMounted(() => {
     // scale.value = editor.value.scale;
   }
 });
-const exportToPDF = (paperType, name, fileType = 'pdf') => {
+const exportToPDF = async (paperType, name, fileType = 'pdf') => {
+
   if(fileType == 'pdf'){
-    editor.value.exportPagesToPDF(paperType, name);
+    await editor.value.exportPagesToPDF(paperType, name);
   }else{
-    editor.value.exportPagesAsImages(paperType, name);
+    await editor.value.exportPagesAsImages(paperType, name);
   }
 }
 defineExpose({