From a660db06773007b1be690e0674829c00a57aeb7b Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期三, 24 十二月 2025 16:21:23 +0800
Subject: [PATCH] 订单首页流程卡新增楼层编号显示
---
north-glass-erp/northglass-erp/src/hook/exportExcel.js | 36 ++++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/north-glass-erp/northglass-erp/src/hook/exportExcel.js b/north-glass-erp/northglass-erp/src/hook/exportExcel.js
new file mode 100644
index 0000000..05e52f9
--- /dev/null
+++ b/north-glass-erp/northglass-erp/src/hook/exportExcel.js
@@ -0,0 +1,36 @@
+import request from "@/utils/request"
+import {ElMessage} from "element-plus"
+
+
+export default function exportExcel(url, fileName,date) {
+ if(date===null){
+ ElMessage.warning("璇峰厛閫夋嫨鏃ユ湡")
+ return
+ }
+
+ const date1 = new Date(date[0]);
+ const date2 = new Date(date[1]);
+ const timeDiff = Math.abs(date2.getTime() - date1.getTime());
+ const daysDiff = timeDiff / (1000 * 3600 * 24);
+ if(Math.floor(daysDiff)>180){
+ ElMessage.warning("瀵煎嚭鐨勭瓫閫夋椂闂翠笉鑳借秴杩�180澶�")
+ return
+ }
+ request.post(url,date,{responseType :'blob'}).then(res => {
+ const blob = new Blob([res])
+ if ('download' in document.createElement('a')) { // 闈濱E涓嬭浇
+ const elink = document.createElement('a')
+ elink.download = `${fileName}.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)
+ } else { // IE10+涓嬭浇
+ navigator.msSaveBlob(blob, fileName)
+ }
+
+ })
+}
+
--
Gitblit v1.8.0