招标一览审核

This commit is contained in:
Teo
2025-08-22 22:57:45 +08:00
parent 9584ab4baa
commit ea56d292ec
6 changed files with 93 additions and 47 deletions

View File

@ -176,22 +176,26 @@ service.interceptors.response.use(
}
);
// 通用下载方法
export function download(url: string, params: any, fileName: string, isHeader) {
export function download(url: string, params: any, fileName: string, isHeader?: boolean) {
downloadLoadingInstance = ElLoading.service({ text: '正在下载数据,请稍候', background: 'rgba(0, 0, 0, 0.7)' });
// prettier-ignore
return service.post(url, params, {
let data={
transformRequest: [
(params: any) => {
return tansParams(params);
}
],
headers: isHeader?{}:{ 'Content-Type': 'application/x-www-form-urlencoded' },
headers: isHeader?{'Content-Type': 'application/json'}:{ 'Content-Type': 'application/x-www-form-urlencoded' },
responseType: 'blob'
}).then(async (resp: any) => {
}
if (isHeader) delete data.transformRequest;
return service
.post(url, params, data as any)
.then(async (resp: any) => {
const isLogin = blobValidate(resp);
if (isLogin) {
console.log("🚀 ~ download ~ resp:", resp)
console.log('🚀 ~ download ~ resp:', resp);
const blob = new Blob([resp]);
FileSaver.saveAs(blob, fileName);
} else {
@ -201,7 +205,8 @@ export function download(url: string, params: any, fileName: string, isHeader) {
ElMessage.error(errMsg);
}
downloadLoadingInstance.close();
}).catch((r: any) => {
})
.catch((r: any) => {
console.error(r);
ElMessage.error('下载文件出现错误,请联系管理员!');
downloadLoadingInstance.close();