From e4bb381c896015c4b87faa002ba6875c06a2fd16 Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期四, 26 十二月 2024 14:33:10 +0800
Subject: [PATCH] 同步检测中心cnas修改

---
 src/components/do/a6-personnel/reward-punishment-record.vue |   43 ++++++++++++++++++++++++++++++++++---------
 1 files changed, 34 insertions(+), 9 deletions(-)

diff --git a/src/components/do/a6-personnel/reward-punishment-record.vue b/src/components/do/a6-personnel/reward-punishment-record.vue
index 9bac57a..6e5dbaa 100644
--- a/src/components/do/a6-personnel/reward-punishment-record.vue
+++ b/src/components/do/a6-personnel/reward-punishment-record.vue
@@ -250,15 +250,40 @@
         const blob = new Blob([res], {
           type: 'application/force-download'
         })
-        // 鍒涘缓涓�涓秴閾炬帴锛屽皢鏂囦欢娴佽祴杩涘幓锛岀劧鍚庡疄鐜拌繖涓秴閾炬帴鐨勫崟鍑讳簨浠�
-        const elink = document.createElement('a')
-        elink.download = decodeURI('濂栨儵璁板綍'+'.xlsx')
-        elink.style.display = 'none'
-        elink.href = URL.createObjectURL(blob)
-        document.body.appendChild(elink)
-        elink.click();
-        URL.revokeObjectURL(elink.href) // 閲婃斁URL 瀵硅薄
-        document.body.removeChild(elink)
+        //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆
+        let reader = new FileReader();
+        reader.readAsText(blob, 'utf-8');
+        reader.onload = () => {
+          try {
+            let result = JSON.parse(reader.result);
+            if (result.message) {
+              this.$message.error(result.message);
+            } else {
+              // 鍒涘缓涓�涓秴閾炬帴锛屽皢鏂囦欢娴佽祴杩涘幓锛岀劧鍚庡疄鐜拌繖涓秴閾炬帴鐨勫崟鍑讳簨浠�
+              const elink = document.createElement('a')
+              elink.download = decodeURI('濂栨儵璁板綍'+'.xlsx')
+              elink.style.display = 'none'
+              elink.href = URL.createObjectURL(blob)
+              document.body.appendChild(elink)
+              elink.click();
+              URL.revokeObjectURL(elink.href) // 閲婃斁URL 瀵硅薄
+              document.body.removeChild(elink)
+              this.$message.success('瀵煎嚭鎴愬姛')
+            }
+          } catch (err) {
+            console.log(err);
+            // 鍒涘缓涓�涓秴閾炬帴锛屽皢鏂囦欢娴佽祴杩涘幓锛岀劧鍚庡疄鐜拌繖涓秴閾炬帴鐨勫崟鍑讳簨浠�
+            const elink = document.createElement('a')
+            elink.download = decodeURI('濂栨儵璁板綍'+'.xlsx')
+            elink.style.display = 'none'
+            elink.href = URL.createObjectURL(blob)
+            document.body.appendChild(elink)
+            elink.click();
+            URL.revokeObjectURL(elink.href) // 閲婃斁URL 瀵硅薄
+            document.body.removeChild(elink)
+            this.$message.success('瀵煎嚭鎴愬姛')
+          }
+        }
       })
     },
     // 鑾峰彇璐熻矗浜轰俊鎭帴鍙�

--
Gitblit v1.9.3