From 6914d3d6ab1f76e6f1b85fdb547b016707ae0179 Mon Sep 17 00:00:00 2001
From: WXL <1785969728@qq.com>
Date: 星期四, 01 八月 2024 17:34:30 +0800
Subject: [PATCH] 11

---
 src/views/project/fundstatistics/index.vue |   78 +++++++++++++++++++++++++-------------
 1 files changed, 51 insertions(+), 27 deletions(-)

diff --git a/src/views/project/fundstatistics/index.vue b/src/views/project/fundstatistics/index.vue
index d8ae804..334c2ea 100644
--- a/src/views/project/fundstatistics/index.vue
+++ b/src/views/project/fundstatistics/index.vue
@@ -52,7 +52,7 @@
           :data="donationCaseTableData"
         >
           <el-table-column
-            label="鎶ュ憡鏃堕棿"
+            label="妗堜緥鏃堕棿"
             align="center"
             prop="reporttime"
             width="150"
@@ -77,15 +77,21 @@
             </template>
           </el-table-column>
           <el-table-column
-            label="鍖荤枟鏈烘瀯"
+            label="涓撹亴浜哄憳"
+            align="center"
+            prop="reportername"
+            width="100"
+          />
+          <el-table-column
+            label="涓氬姟缁�"
             align="center"
             prop="treatmenthospitalname"
           />
           <el-table-column label="鎹愮尞杩涘害" align="center" prop="recordstate">
             <template slot-scope="scope">
               <dict-tag
-                :options="dict.type.sys_DonationStatus"
-                :value="scope.row.recordstate"
+                :options="dict.type.sys_donornode"
+                :value="scope.row.workflow"
               />
             </template>
           </el-table-column>
@@ -160,10 +166,12 @@
 import { listDonatebaseinfo } from "@/api/project/donatebaseinfo";
 import { getDonationCost, exportFundCost } from "@/api/project/financesubject";
 import FundSummary from "@/views/project/components/fundsummary";
+import { getToken } from "@/utils/auth";
+
 export default {
   //import寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
   components: {
-    FundSummary,
+    FundSummary
   },
   dicts: [
     "sys_Organ",
@@ -172,6 +180,7 @@
     "sys_IDType",
     "sys_AgeUnit",
     "sys_DonationStatus",
+    "sys_donornode"
   ],
   data() {
     //杩欓噷瀛樻斁鏁版嵁
@@ -190,15 +199,18 @@
         name: "",
         pageSize: 10,
         name: null,
-        donorno: null,
+        donorno: null
       },
       curdonorno: null,
       showType: "list",
       curCaseInfo: {
         donorno: null,
         name: null,
-        id: null,
+        id: null
       },
+      headers: {
+        Authorization: "Bearer " + getToken()
+      }
     };
   },
   //鐩戝惉灞炴�� 绫讳技浜巇ata姒傚康
@@ -213,7 +225,7 @@
       if (this.queryParams.recordstate == "") {
         this.queryParams.recordstate = null;
       }
-      listDonatebaseinfo(this.queryParams).then((response) => {
+      listDonatebaseinfo(this.queryParams).then(response => {
         this.donationCaseTableData = response.rows;
         this.total = response.total;
         this.loading = false;
@@ -243,26 +255,38 @@
     },
     //瀵煎嚭姹囨�昏〃
     exportSummary(id) {
-      exportFundCost(id).then((res) => {
-        debugger;
-        if (res.downloadUrl) {
-          var fileUrl = res;
-          //鑾峰彇褰撳墠缃戝潃
-          var urlBase = process.env.VUE_APP_BASE_API;
-          var curWWWPath = window.document.location.href;
-          var pos = curWWWPath.indexOf(window.document.location.pathname);
-          // 鍒涘缓a鏍囩
-          var aEle = document.createElement("a");
-          aEle.href =
-            curWWWPath.substring(0, pos) + urlBase + fileUrl["downloadUrl"];
-          aEle.click();
-          this.$alert("涓嬭浇鎴愬姛", "鎻愮ず", {
-            confirmButtonText: "纭畾",
-            type: "success",
+      exportFundCost(id).then(res => {
+        var fileUrl = res;
+        //鑾峰彇褰撳墠缃戝潃
+        var urlBase = process.env.VUE_APP_BASE_API;
+        var curWWWPath = window.document.location.href;
+        var pos = curWWWPath.indexOf(window.document.location.pathname);
+        // 鍒涘缓a鏍囩
+        var aEle = document.createElement("a");
+        aEle.href =
+          curWWWPath.substring(0, pos) + urlBase + fileUrl["downloadUrl"];
+        console.log(aEle.href);
+        // 娣诲姞Authorization澶撮儴
+        fetch(aEle.href, {
+          headers: this.headers
+        })
+          .then(response => {
+            // 灏嗘枃浠朵笅杞介摼鎺ヤ綔涓篵lob瀵硅薄杩涜涓嬭浇
+            return response.blob();
+          })
+          .then(blob => {
+            const url = window.URL.createObjectURL(new Blob([blob]));
+            console.log(url);
+            const link = document.createElement("a");
+            link.href = url;
+            const name = fileUrl["downloadName"];
+            link.setAttribute("download", name); // 鏇挎崲file.pdf涓哄疄闄呯殑鏂囦欢鍚�
+            document.body.appendChild(link);
+            link.click();
+            link.parentNode.removeChild(link);
           });
-        }
       });
-    },
+    }
   },
   //鐢熷懡鍛ㄦ湡 - 鍒涘缓瀹屾垚锛堝彲浠ヨ闂綋鍓峵his瀹炰緥锛�
   created() {
@@ -276,7 +300,7 @@
   updated() {}, //鐢熷懡鍛ㄦ湡 - 鏇存柊涔嬪悗
   beforeDestroy() {}, //鐢熷懡鍛ㄦ湡 - 閿�姣佷箣鍓�
   destroyed() {}, //鐢熷懡鍛ㄦ湡 - 閿�姣佸畬鎴�
-  activated() {}, //濡傛灉椤甸潰鏈塳eep-alive缂撳瓨鍔熻兘锛岃繖涓嚱鏁颁細瑙﹀彂
+  activated() {} //濡傛灉椤甸潰鏈塳eep-alive缂撳瓨鍔熻兘锛岃繖涓嚱鏁颁細瑙﹀彂
 };
 </script>
 <style scoped>

--
Gitblit v1.9.3