Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Fedex
/
EcomWeb
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
zhanbo.xu
2026-02-07 11:22:30 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6138ad2de8799edfee8311fd689a785855ec485a
6138ad2d
1 parent
9de8413f
feat: 优化导出配置10103的情况
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
11 deletions
src/utils/zipdownload.js
src/views/exportListQuery/index.vue
src/utils/zipdownload.js
View file @
6138ad2
...
...
@@ -69,6 +69,7 @@ export function downLoadZip(urlStatus, str, filename, type, method, data) {
},
})
.
then
((
res
)
=>
{
console
.
log
(
res
);
if
(
filename
==
null
)
{
if
(
res
.
headers
[
"content-disposition"
])
{
var
patt
=
new
RegExp
(
"filename=([^;]+\\.[^\\.;]+);*"
);
...
...
@@ -84,8 +85,9 @@ export function downLoadZip(urlStatus, str, filename, type, method, data) {
resolveBlob
(
res
,
mimeMap
[
type
],
filename
);
resolve
();
})
.
catch
(()
=>
{
reject
();
.
catch
((
err
)
=>
{
debugger
;
reject
(
err
);
});
});
}
...
...
src/views/exportListQuery/index.vue
View file @
6138ad2
...
...
@@ -291,6 +291,8 @@ import {
} from "@/api/exportList-api.js";
import CustomDialog from "./custom-dialog.vue";
import { formatDateNew } from "../../utils";
import axios from "axios";
import { getToken } from "@/utils/auth";
export default {
name: "ExportListQuery",
...
...
@@ -512,18 +514,80 @@ export default {
};
},
// 查询成功后调用的其他接口
async callOtherApi() {
try {
downLoadZip() {
const baseUrl = process.env.VUE_APP_BASE_API;
console.log(this.currentTaskId);
axios({
method: "get",
url: `${baseUrl}/bus-customer/asyncExport/download/${this.currentTaskId}`,
responseType: "blob",
headers: {
Authorization: "Bearer " + getToken(),
Ver: process.env.VUE_APP_APIVERSION,
},
})
.then((res) => {
debugger;
console.log(res);
const mimeType =
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
const aLink = document.createElement("a");
var blob = new Blob([res.data], { type: mimeType });
if (blob.size < 500) {
var reader = new FileReader();
reader.readAsText(blob, "utf-8");
reader.onloadend = () => {
// 获取文本内容并将其转换为JSON格式
if (
reader.result &&
reader.result != null &&
reader.result != ""
) {
if (JSON.parse(reader.result)) {
debugger;
let jsonData = JSON.parse(reader.result);
if (jsonData.code == "10103") {
this.startPolling();
return;
}
this.alertWarningMsg(jsonData.message);
} else {
this.alertWarningMsg("文件无法下载,请重新生成后再试!");
}
} else {
this.alertWarningMsg("文件无法下载,请重新生成后再试!");
}
};
} else {
const fileName = `${formatDateNew(new Date())}.xlsx`;
this.fileDownload
.downLoadZip("task", "customDownloadXls", fileName, "xlsx", "get", {
taskId: this.currentTaskId,
aLink.href = URL.createObjectURL(blob);
aLink.setAttribute("download", fileName); // 设置下载文件名称
document.body.appendChild(aLink);
aLink.click();
document.body.removeChild(aLink);
this.exportLoading = false;
}
})
.finally((
) => {
// this.cancelDownload(
);
.catch((error
) => {
console.log("失败", error
);
this.exportLoading = false;
});
},
// 查询成功后调用的其他接口
async callOtherApi() {
try {
this.downLoadZip();
// const fileName = `${formatDateNew(new Date())}.xlsx`;
// this.fileDownload
// .downLoadZip("task", "customDownloadXls", fileName, "xlsx", "get", {
// taskId: this.currentTaskId,
// })
// .finally(() => {
// // this.cancelDownload();
// this.exportLoading = false;
// });
} catch (error) {
console.error("后续接口调用失败:", error);
}
...
...
@@ -532,7 +596,6 @@ export default {
async pollStatus() {
try {
const result = await getTaskStatus({ taskId: this.currentTaskId });
if (+result.code === 200) {
// PENDING, PROCESSING, COMPLETED, FAILED
if (result.data.status === "COMPLETED") {
...
...
Please
register
or
login
to post a comment