From 4afb944c92aed7287cc4691fc9019f3b9faea1c0 Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期二, 03 十一月 2026 16:04:37 +0800
Subject: [PATCH] 增加对pdf预览支持,统计分析对时间范围的限定要求

---
 src/views/project/unitCost/particulars/index.vue |   35 ++++++++++++-----------------------
 1 files changed, 12 insertions(+), 23 deletions(-)

diff --git a/src/views/project/unitCost/particulars/index.vue b/src/views/project/unitCost/particulars/index.vue
index b3e2771..4cbc82a 100644
--- a/src/views/project/unitCost/particulars/index.vue
+++ b/src/views/project/unitCost/particulars/index.vue
@@ -489,6 +489,7 @@
         :title="pdftitle"
         :visible.sync="pdfVisible"
         width="60%"
+        custom-class="pdf-resize-dialog"
       >
         <div class="pdfimg">
           <div class="box-pdf">
@@ -981,14 +982,8 @@
     },
     // 鑾峰彇璇锋眰澶�
     Getnetworkheader() {
-      let string = window.location.href;
-      if (string.includes("9091")) {
-        const index = string.indexOf("9091");
-        this.Networkheader = string.slice(0, index + 4); // 鎴彇9091鍙婂叾鍓嶉儴瀛楃
-      } else {
-        const index = string.indexOf("8032");
-        this.Networkheader = string.slice(0, index + 4); // 鎴彇8032鍙婂叾鍓嶉儴瀛楃
-      }
+      // 浠ュ綋鍓嶉〉闈� origin 涓哄噯锛屽吋瀹� 80/8032/9091 鍙婂悗缁鍙h皟鏁�
+      this.Networkheader = window.location.origin;
     },
     // 琛ㄥ崟閲嶇疆
     reset() {
@@ -1255,7 +1250,7 @@
       const config = {
         headers: { Authorization: "Bearer " + this.ICDtoken }
       };
-      const pdfimg = this.Networkheader + "/prod-api" + response.fileName;
+      const pdfimg = this.Networkheader + process.env.VUE_APP_BASE_API + response.fileName;
       //鑾峰彇绁ㄦ嵁淇℃伅浣嶇疆
       if (response.code == 200) {
         this.previewpdf = true;
@@ -1311,7 +1306,7 @@
       if (this.donorchargeorgans[index].annexFilesList) {
         const fetchPromises = this.donorchargeorgans[index].annexFilesList.map(
           (value, indexson) => {
-            const pdfimg = this.Networkheader + "/prod-api" + value.url;
+            const pdfimg = this.Networkheader + process.env.VUE_APP_BASE_API + value.url;
             return fetch(pdfimg, config)
               .then(response => response.blob())
               .then(blob => {
@@ -1354,19 +1349,13 @@
     downFile(item) {
       this.pdftitle =
         "鍏�" + this.pdfimgsrcList.length + "椤癸紝褰撳墠閫変腑" + item.name;
-      let name = item.name.split(".");
-      if (name[1] == "pdf") {
-        this.$modal.msgWarning("褰撳墠鏂囦欢鏆備笉鏀寔棰勮");
-        this.previewpdf = false;
-        this.hintitle = "褰撳墠鏂囦欢鏆備笉鏀寔棰勮";
-      } else if (name[1] == "jpg" || "png") {
-        console.log(item, "灞曠ず");
-        this.previewpdf = true;
-        if (item.url) {
-          this.pdfimg = item.url;
-        } else {
-          this.pdfimg = "";
-        }
+      const ext = String(item.name || "pdf").toLowerCase().split(".").pop();
+      if (ext === "pdf") {
+        this.$previewFile([{ name: item.name, url: item.url }]);
+        return;
+      } else if (["jpg", "jpeg", "png", "gif", "bmp", "webp"].includes(ext)) {
+        this.$previewFile([{ name: item.name, url: item.url }]);
+        return;
       } else {
         this.hintitle = "褰撳墠鏂囦欢鏆備笉鏀寔棰勮";
         this.$modal.msgWarning("褰撳墠鏂囦欢鏆備笉鏀寔棰勮");

--
Gitblit v1.9.3