cz 1 жил өмнө
parent
commit
1538cdc880

+ 22 - 7
src/components/PDF/contractPDFOne.vue

@@ -271,12 +271,14 @@
 
 <script setup>
 import { NumberToChinese } from "@/utils/util.js";
+import { async } from "@antv/x6/lib/registry/marker/main";
 import { watch } from "vue";
 const { proxy } = getCurrentInstance();
 const pdfData = ref({});
 const props = defineProps({
   rowData: Object,
 });
+
 const getPdfData = (query) => {
   proxy.post("/contract/getContractPdfInfo", query).then((res) => {
     pdfData.value = res;
@@ -296,8 +298,11 @@ const getPdfData = (query) => {
           fileType: 1,
         })
         .then((fileObj) => {
-          pdfData.value.companyPic =
-            fileObj[pdfData.value.sellCorporationId][0].fileUrl;
+          proxy
+            .getImgBase64(fileObj[pdfData.value.sellCorporationId][0].fileUrl)
+            .then((res) => {
+              pdfData.value.companyPic = res;
+            });
         });
       proxy
         .post("/fileInfo/getList", {
@@ -305,8 +310,11 @@ const getPdfData = (query) => {
           fileType: 4,
         })
         .then((fileObj) => {
-          pdfData.value.companySeal =
-            fileObj[pdfData.value.sellCorporationId][0].fileUrl;
+          proxy
+            .getImgBase64(fileObj[pdfData.value.sellCorporationId][0].fileUrl)
+            .then((res) => {
+              pdfData.value.companySeal = res;
+            });
         });
     }
     // 拿取产品图
@@ -319,12 +327,16 @@ const getPdfData = (query) => {
         .post("/fileInfo/getList", {
           businessIdList: arr,
         })
-        .then((fileObj) => {
+        .then(async (fileObj) => {
           for (let i = 0; i < pdfData.value.productInfoList.length; i++) {
             const e = pdfData.value.productInfoList[i];
             for (const key in fileObj) {
               if (e.productId === key) {
-                e.fileList = fileObj[key];
+                if (fileObj[key] && fileObj[key].length > 0) {
+                  const res = await proxy.getImgBase64(fileObj[key][0].fileUrl);
+                  fileObj[key][0].fileUrl = res;
+                  e.fileList = fileObj[key];
+                }
               }
             }
           }
@@ -354,7 +366,10 @@ const getDict = () => {
 getDict();
 const getBalance = (val) => {
   if (val) {
-    return parseFloat(pdfData.value.totalAmount * (val / 100)).toFixed(2);
+    return proxy.moneyFormat(
+      parseFloat(pdfData.value.totalAmount * (val / 100)).toFixed(2),
+      2
+    );
   }
 };
 watch(

+ 11 - 4
src/components/PDF/purchasePDFOne.vue

@@ -287,8 +287,11 @@ const handlePrintPdf = (row) => {
           fileType: 1,
         })
         .then((fileObj) => {
-          pdfData.value.companyPic =
-            fileObj[pdfData.value.buyCorporationId][0].fileUrl;
+          proxy
+            .getImgBase64(fileObj[pdfData.value.buyCorporationId][0].fileUrl)
+            .then((res) => {
+              pdfData.value.companyPic = res;
+            });
         });
     }
     // 拿取产品图
@@ -312,7 +315,7 @@ const handlePrintPdf = (row) => {
         .post("/fileInfo/getList", {
           businessIdList: arr,
         })
-        .then((fileObj) => {
+        .then(async (fileObj) => {
           for (
             let i = 0;
             i < pdfData.value.ehsdPurchaseProductList.length;
@@ -321,7 +324,11 @@ const handlePrintPdf = (row) => {
             const e = pdfData.value.ehsdPurchaseProductList[i];
             for (const key in fileObj) {
               if (e.productId === key) {
-                e.fileList = fileObj[key];
+                if (fileObj[key] && fileObj[key].length > 0) {
+                  const res = await proxy.getImgBase64(fileObj[key][0].fileUrl);
+                  fileObj[key][0].fileUrl = res;
+                  e.fileList = fileObj[key];
+                }
               }
             }
           }

+ 36 - 4
src/components/PDF/samplePDF.vue

@@ -123,6 +123,31 @@
             {{ pdfData.currency }} {{ moneyFormat(item.amount, 2) }}
           </td>
         </tr>
+        <template
+          v-if="
+            pdfData.sampleProjectList && pdfData.sampleProjectList.length > 0
+          "
+        >
+          <tr>
+            <td colspan="5" style="text-align: right">
+              <div
+                v-for="(item, index) in pdfData.sampleProjectList"
+                :key="item.id"
+              >
+                {{ item.payName }}:
+              </div>
+            </td>
+            <td class="center-class">
+              <div
+                v-for="(item, index) in pdfData.sampleProjectList"
+                :key="item.id"
+              >
+                {{ pdfData.currency }}
+                {{ moneyFormat(item.amount, 2) }}
+              </div>
+            </td>
+          </tr>
+        </template>
         <tr>
           <td colspan="5" style="text-align: right">Total Amount:</td>
           <td style="width: 10%">
@@ -174,8 +199,11 @@ const getPdfData = (query) => {
           fileType: 1,
         })
         .then((fileObj) => {
-          pdfData.value.companyPic =
-            fileObj[pdfData.value.sellCorporationId][0].fileUrl;
+          proxy
+            .getImgBase64(fileObj[pdfData.value.sellCorporationId][0].fileUrl)
+            .then((res) => {
+              pdfData.value.companyPic = res;
+            });
         });
     }
     // 拿取产品图
@@ -188,12 +216,16 @@ const getPdfData = (query) => {
         .post("/fileInfo/getList", {
           businessIdList: arr,
         })
-        .then((fileObj) => {
+        .then(async (fileObj) => {
           for (let i = 0; i < pdfData.value.productInfoList.length; i++) {
             const e = pdfData.value.productInfoList[i];
             for (const key in fileObj) {
               if (e.productId === key) {
-                e.fileList = fileObj[key];
+                if (fileObj[key] && fileObj[key].length > 0) {
+                  const res = await proxy.getImgBase64(fileObj[key][0].fileUrl);
+                  fileObj[key][0].fileUrl = res;
+                  e.fileList = fileObj[key];
+                }
               }
             }
           }

+ 2 - 2
src/components/contractCom/contractDetails.vue

@@ -223,7 +223,7 @@ getDetailsData();
 .content-box {
   display: flex;
   .left {
-    width: 100px;
+    width: 120px;
     // background: #ccc;
     .left-item {
       height: 36px;
@@ -233,7 +233,7 @@ getDetailsData();
     }
   }
   .right {
-    width: calc(100% - 100px);
+    width: calc(100% - 120px);
     padding-left: 10px;
   }
 }

+ 2 - 2
src/components/contractCom/contractDetailsOne.vue

@@ -239,7 +239,7 @@ const getDetailsData = () => {
 .content-box {
   display: flex;
   .left {
-    width: 100px;
+    width: 120px;
     // background: #ccc;
     .left-item {
       height: 36px;
@@ -249,7 +249,7 @@ const getDetailsData = () => {
     }
   }
   .right {
-    width: calc(100% - 100px);
+    width: calc(100% - 120px);
     padding-left: 10px;
   }
 }

+ 10 - 0
src/components/process/EHSD/Purchase.vue

@@ -99,6 +99,10 @@
                 :loading="loadingSearch"
                 @input="remoteMethod"
                 @change="changeSupplier"
+                v-if="
+                  [30].includes(route.query.processType) ||
+                  !route.query.processType
+                "
               >
                 <el-option
                   v-for="item in supplierList"
@@ -107,6 +111,12 @@
                   :value="item.value"
                 />
               </el-select>
+              <el-select
+                v-model="formData.data.sellCorporationName"
+                disabled
+                v-else
+              >
+              </el-select>
             </el-form-item>
             <el-row style="margin-top: 20px; width: 100%">
               <el-col :span="6">

+ 5 - 1
src/main.js

@@ -58,7 +58,8 @@ import {
   random,
   deepClone,
   timeInterval,
-  compareTime
+  compareTime,
+  getImgBase64
 } from '@/utils/util'
 
 // 分页组件
@@ -108,6 +109,9 @@ app.config.globalProperties.random = random
 app.config.globalProperties.deepClone = deepClone
 app.config.globalProperties.timeInterval = timeInterval
 app.config.globalProperties.compareTime = compareTime
+app.config.globalProperties.getImgBase64 = getImgBase64
+
+
 
 
 // 全局组件挂载

+ 27 - 1
src/utils/util.js

@@ -1,5 +1,8 @@
 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";
@@ -425,3 +428,26 @@ export function NumberToChinese(m) {
   result += result.charAt(result.length - 1) == "元" ? "整" : "";
   return result;
 }
+
+// 图片url转base64
+export function getImgBase64(url) {
+  return new Promise((resolve, reject) => {
+    let Img = new Image(),
+      dataURL = "";
+    Img.setAttribute("crossOrigin", "Anonymous");
+    Img.src = url + "?v=" + Math.random();
+    Img.onload = function () {
+      let canvas = document.createElement("canvas"),
+        width = Img.width,
+        height = Img.height;
+      canvas.width = width;
+      canvas.height = height;
+      canvas.getContext("2d").drawImage(Img, 0, 0, width, height);
+      dataURL = canvas.toDataURL("image/png");
+      resolve(dataURL);
+    };
+    Img.onerror = function () {
+      reject("图片加载失败");
+    };
+  });
+};

+ 3 - 0
src/views/EHSD/saleContract/sampleEHSD/index.vue

@@ -768,6 +768,9 @@ const printObj = ref({
     "https://cdn.bootcdn.net/ajax/libs/animate.css/4.1.1/animate.compat.css, https://cdn.bootcdn.net/ajax/libs/hover.css/2.3.1/css/hover-min.css",
   extraHead: '<meta http-equiv="Content-Language"content="zh-cn"/>',
 });
+const clickDownload = () => {
+  proxy.getPdf("样品单PDF文件");
+};
 </script>
 
 <style lang="scss" scoped>