|
@@ -129,7 +129,7 @@ import {
|
|
|
} from "@/constants/enumerate";
|
|
|
import { dataTaskList, removeDataTask } from "../api";
|
|
|
import { attachmentDownload } from "../../login/api";
|
|
|
-import { downloadBlob } from "@/plugins/utils";
|
|
|
+import { downloadFileURL } from "@/plugins/utils";
|
|
|
|
|
|
export default {
|
|
|
name: "data-task-manage",
|
|
@@ -207,13 +207,25 @@ export default {
|
|
|
if (this.loading) return;
|
|
|
|
|
|
this.loading = true;
|
|
|
- const res = await downloadBlob(() => {
|
|
|
- return attachmentDownload({ id: row.id, type: "REPORT" });
|
|
|
- }, `${row.printPlanName}-日志文件.txt`).catch(() => {});
|
|
|
+ const res = await attachmentDownload({
|
|
|
+ id: row.id,
|
|
|
+ type: "REPORT"
|
|
|
+ }).catch(() => {});
|
|
|
|
|
|
+ if (!res) {
|
|
|
+ this.loading = false;
|
|
|
+ this.$message.error("文件下载失败,请重新尝试!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const url = res.url;
|
|
|
+ let result = true;
|
|
|
+ await downloadFileURL(url).catch(() => {
|
|
|
+ result = false;
|
|
|
+ });
|
|
|
this.loading = false;
|
|
|
|
|
|
- if (res) {
|
|
|
+ if (result) {
|
|
|
this.$message.success("文件下载成功!");
|
|
|
} else {
|
|
|
this.$message.error("文件下载失败,请重新尝试!");
|
|
@@ -224,14 +236,25 @@ export default {
|
|
|
|
|
|
this.loading = true;
|
|
|
const type = row.hasResultFile ? "RESULT" : "IMPORT_FILE";
|
|
|
- const typeName = row.hasResultFile ? "导出文件" : "导入文件";
|
|
|
- const res = await downloadBlob(() => {
|
|
|
- return attachmentDownload({ id: row.id, type });
|
|
|
- }, `${row.printPlanName}-${typeName}.txt`).catch(() => {});
|
|
|
+ const res = await attachmentDownload({
|
|
|
+ id: row.id,
|
|
|
+ type
|
|
|
+ }).catch(() => {});
|
|
|
+
|
|
|
+ if (!res) {
|
|
|
+ this.loading = false;
|
|
|
+ this.$message.error("文件下载失败,请重新尝试!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
+ const url = res.url;
|
|
|
+ let result = true;
|
|
|
+ await downloadFileURL(url).catch(() => {
|
|
|
+ result = false;
|
|
|
+ });
|
|
|
this.loading = false;
|
|
|
|
|
|
- if (res) {
|
|
|
+ if (result) {
|
|
|
this.$message.success("文件下载成功!");
|
|
|
} else {
|
|
|
this.$message.error("文件下载失败,请重新尝试!");
|