<a-buttontype="primary"class="search-btn"@click="downLoadClick">下载导出结果</a-button>
// 下载导出结果
const downLoadClick = async () => {try {const response = await axios({url: `${getBaseUrl()}/gpt/admin/messageExport/download`,method: "GET",responseType: "blob", // 指定响应类型为 blobheaders: {"iam-auth": localStorage.getItem(`access_token`) || "",token: localStorage.getItem(`admin-token`) || "",},});console.log(response, "response");const url = window.URL.createObjectURL(new Blob([response.data]));const link = document.createElement("a");link.href = url;link.download = `对话消息${startTime.value ? startTime.value?.format("YYYY-MM-DD HH:mm:ss") : ""}-${endTime.value ? endTime.value?.format("YYYY-MM-DD HH:mm:ss") : ""}.xlsx`;link.click();window.URL.revokeObjectURL(url);} catch (error) {console.error("导出文件时出现错误:", error);}
};