From ecb306c5612f474a5911af20a567f3f4d4db33d1 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期三, 24 九月 2025 15:02:23 +0800
Subject: [PATCH] 原材料订单拆分功能v1
---
src/utils/file.js | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/src/utils/file.js b/src/utils/file.js
index 9c7e99e..ac6ad7b 100644
--- a/src/utils/file.js
+++ b/src/utils/file.js
@@ -80,3 +80,26 @@
});
},
};
+
+export function transformExcel(response, tempName) {
+ const relType = ['application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.ms-excel;charset=UTF-8']
+ let type = response.type
+ if (relType.includes(type)) {
+ const blob = new Blob([response], {type: 'application/vnd.ms-excel'})
+ let temp = tempName
+ if(response.headers){
+ const disposition = response.headers["Content-Disposition"]
+ temp = disposition.substring(disposition.lastIndexOf('=') + 1)
+ }
+ let filename = decodeURI(temp)
+ // 鍒涘缓涓�涓秴閾炬帴锛屽皢鏂囦欢娴佽祴杩涘幓锛岀劧鍚庡疄鐜拌繖涓秴閾炬帴鐨勫崟鍑讳簨浠�
+ const elink = document.createElement('a')
+ elink.download = filename
+ elink.style.display = 'none'
+ elink.href = URL.createObjectURL(blob)
+ document.body.appendChild(elink)
+ elink.click()
+ URL.revokeObjectURL(elink.href) // 閲婃斁URL 瀵硅薄
+ document.body.removeChild(elink)
+ }
+}
--
Gitblit v1.9.3