Skip to content

Commit 59caf22

Browse files
committed
fix: 修改下载函数
1 parent 4584819 commit 59caf22

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

ui/src/components/DownloadModal.tsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { attachment, job } from '@/api';
2+
import { download } from '@/utils/export';
23
import { LoadingOutlined } from '@ant-design/icons';
34
import { findByValue } from '@oceanbase/util';
45
import { useRequest } from 'ahooks';
@@ -35,17 +36,7 @@ export default function DownloadModal({
3536
manual: true,
3637
onSuccess: (data) => {
3738
if (data) {
38-
// 将File对象转换为Blob进行下载
39-
const blob = new Blob([data], { type: 'application/octet-stream' });
40-
const url = window.URL.createObjectURL(blob);
41-
const link = document.createElement('a');
42-
link.href = url;
43-
link.download =
44-
attachmentValue || `cluster_log_${new Date().getTime()}`;
45-
document.body.appendChild(link);
46-
link.click();
47-
document.body.removeChild(link);
48-
window.URL.revokeObjectURL(url);
39+
download(data, attachmentValue);
4940
message.success('文件下载成功');
5041
} else {
5142
message.error('下载数据为空');

0 commit comments

Comments
 (0)