fix(测试用例): 导出-修复下载文件错误的缺陷

This commit is contained in:
teukkk 2024-09-04 18:37:17 +08:00 committed by Craftsman
parent 19f5cb2d27
commit 73a011985c
1 changed files with 5 additions and 5 deletions

View File

@ -1153,9 +1153,9 @@
const taskId = ref(''); const taskId = ref('');
// //
async function downloadFile() { async function downloadFile(id: string) {
try { try {
const response = await getCaseDownloadFile(currentProjectId.value, reportId.value); const response = await getCaseDownloadFile(currentProjectId.value, id);
const fileName = response?.headers.get('content-disposition').split('filename=')[1]; const fileName = response?.headers.get('content-disposition').split('filename=')[1];
downloadByteFile(response.data, decodeURIComponent(fileName)); downloadByteFile(response.data, decodeURIComponent(fileName));
} catch (error) { } catch (error) {
@ -1164,7 +1164,7 @@
} }
} }
// //
function showExportSuccessfulMessage(count: number) { function showExportSuccessfulMessage(id: string, count: number) {
Message.success({ Message.success({
content: () => content: () =>
h('div', { class: 'flex flex-col gap-[8px] items-start' }, [ h('div', { class: 'flex flex-col gap-[8px] items-start' }, [
@ -1176,7 +1176,7 @@
{ {
type: 'text', type: 'text',
onClick() { onClick() {
downloadFile(); downloadFile(id);
}, },
}, },
{ default: () => t('common.downloadFile') } { default: () => t('common.downloadFile') }
@ -1237,7 +1237,7 @@
reportId.value = data.fileId; reportId.value = data.fileId;
taskId.value = data.taskId; taskId.value = data.taskId;
if (data.isSuccessful) { if (data.isSuccessful) {
showExportSuccessfulMessage(data.count); showExportSuccessfulMessage(reportId.value, data.count);
} else { } else {
Message.error({ Message.error({
content: t('common.exportFailed'), content: t('common.exportFailed'),