lxf 2 weeks ago
parent
commit
9fefce4182
2 changed files with 11 additions and 10 deletions
  1. 3 7
      src/utils/util.js
  2. 8 3
      src/views/finance/fundManage/accountStatement/index.vue

+ 3 - 7
src/utils/util.js

@@ -1,8 +1,5 @@
 import moment from "moment";
-import {
-  post,
-  get
-} from "@/utils/request";
+import { post, get } from "@/utils/request";
 import Cookies from "js-cookie";
 import html2Canvas from "html2canvas";
 import JsPDF from "jspdf";
@@ -131,8 +128,7 @@ export function calculationWeek(val, format) {
   return week;
 }
 
-
-export function getPdf(title, num, domId = 'pdfDom') {
+export function getPdf(title, num, domId = "pdfDom") {
   const element = document.getElementById(domId);
   // var doc = new JsPDF("", "pt", "a4");
   // //导出pdf的中文有乱码
@@ -445,4 +441,4 @@ export function NumberToChinese(m) {
   }
   result += result.charAt(result.length - 1) == "元" ? "整" : "";
   return result;
-}
+}

+ 8 - 3
src/views/finance/fundManage/accountStatement/index.vue

@@ -269,8 +269,8 @@
 
     <el-dialog title="打印" v-if="openMorePrint" v-model="openMorePrint" width="860">
       <div id="printMe">
-        <div id="pdfDom" style="padding: 16px; font-size: 12px !important; font-family: 'msyh'">
-          <div v-for="(item, index) in checkList.filter((item, index) => checkList.indexOf(item) === index)" :key="index">
+        <div style="padding: 16px; font-size: 12px !important; font-family: 'msyh'">
+          <div v-for="(item, index) in checkList.filter((item, index) => checkList.indexOf(item) === index)" :key="index" :id="'pdfDom' + index">
             <ContractPDF :rowData="{ code: item }"></ContractPDF>
           </div>
         </div>
@@ -278,7 +278,7 @@
       <template #footer>
         <el-button @click="openMorePrint = false" size="large">取消</el-button>
         <el-button v-print="printObj" size="large">打印</el-button>
-        <el-button type="primary" @click="clickDownload()" size="large">下载PDF</el-button>
+        <el-button type="primary" @click="clickMoreDownload()" size="large">下载PDF</el-button>
       </template>
     </el-dialog>
 
@@ -1569,6 +1569,11 @@ const printObj = ref({
 const clickDownload = () => {
   proxy.getPdf("外销合同PDF文件");
 };
+const clickMoreDownload = () => {
+  for (let i = 0; i < checkList.value.length; i++) {
+    proxy.getPdf(checkList.value[i], "", "pdfDom" + i);
+  }
+};
 
 const loanRules = ref({
   corporationId: [{ required: true, message: "请选择归属公司", trigger: "change" }],