|
@@ -11,3 +11,15 @@ export const taskList = (params) => {
|
|
method: 'post'
|
|
method: 'post'
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+// 下载文件
|
|
|
|
+export const dowloadFile = (url, label) => {
|
|
|
|
+ axios.get(url, { responseType: "blob" }).then(response => {
|
|
|
|
+ const blob = new Blob([response.data]);
|
|
|
|
+ const link = document.createElement("a");
|
|
|
|
+ link.href = URL.createObjectURL(blob);
|
|
|
|
+ link.download = label;
|
|
|
|
+ link.click();
|
|
|
|
+ URL.revokeObjectURL(link.href);
|
|
|
|
+ }).catch(console.error);
|
|
|
|
+}
|