From b52c08544fd4ab1e8ff0f09efaac160608fd90ce Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 27 四月 2026 11:59:06 +0800
Subject: [PATCH] 天津宝东 1.修改生产流程
---
src/utils/request.js | 25 +++++++++++++++++--------
1 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/src/utils/request.js b/src/utils/request.js
index fe926f6..ba31649 100644
--- a/src/utils/request.js
+++ b/src/utils/request.js
@@ -17,7 +17,7 @@
// axios涓姹傞厤缃湁baseURL閫夐」锛岃〃绀鸿姹俇RL鍏叡閮ㄥ垎
baseURL: import.meta.env.VITE_APP_BASE_API,
// 瓒呮椂
- timeout: 10000
+ timeout: 160000
})
// request鎷︽埅鍣�
@@ -125,16 +125,25 @@
// 閫氱敤涓嬭浇鏂规硶
export function download(url, params, filename, config) {
downloadLoadingInstance = ElLoading.service({ text: "姝e湪涓嬭浇鏁版嵁锛岃绋嶅��", background: "rgba(0, 0, 0, 0.7)", })
- return service.post(url, params, {
- transformRequest: [(params) => { return tansParams(params) }],
- headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
- responseType: 'blob',
- ...config
- }).then(async (data) => {
+ const downloadName = config?.filename || filename
+ const requestMethod = (config?.method || 'post').toLowerCase()
+ const requestPromise = requestMethod === 'get'
+ ? service.get(url, {
+ params,
+ responseType: 'blob',
+ ...config
+ })
+ : service.post(url, params, {
+ transformRequest: [(params) => { return tansParams(params) }],
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
+ responseType: 'blob',
+ ...config
+ })
+ return requestPromise.then(async (data) => {
const isBlob = blobValidate(data)
if (isBlob) {
const blob = new Blob([data])
- saveAs(blob, filename)
+ saveAs(blob, downloadName)
} else {
const resText = await data.text()
const rspObj = JSON.parse(resText)
--
Gitblit v1.9.3