fix
This commit is contained in:
@@ -101,9 +101,9 @@
|
|||||||
<div class="admin_search_item" @click="searchHistoryList">
|
<div class="admin_search_item" @click="searchHistoryList">
|
||||||
Search
|
Search
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="admin_search_item" @click="downloadTransaction">
|
<div class="admin_search_item" @click="downloadTransaction">
|
||||||
Export
|
Export
|
||||||
</div> -->
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="admin_state_list">
|
<div class="admin_state_list">
|
||||||
<div
|
<div
|
||||||
@@ -459,48 +459,26 @@ export default defineComponent({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
//导出报表
|
//导出报表
|
||||||
let downloadTransaction = async () => {
|
let downloadTransaction = () => {
|
||||||
return
|
|
||||||
filter.tableLoading = true;
|
filter.tableLoading = true;
|
||||||
let data = setHistoryListData();
|
let data = setHistoryListData();
|
||||||
// ?uniqueId=5956dc1e-3ae6-48bb-8c19-b7d9b4ba2332-1-83&userId=83&timeZone=Asia%2FShanghai&type=Generate
|
Https.axiosPost(Https.httpUrls.queryTransactionDownload, data).then(
|
||||||
|
(rv: any) => {
|
||||||
let jsonData:any = setHistoryListData()
|
if (rv) {
|
||||||
|
fetch(rv)
|
||||||
let str = JSON.stringify(jsonData)
|
.then(response => response.blob()) // 将响应转换为 Blob 对象
|
||||||
let url = 'https://develop.api.aida.com.hk/api/inquiry/queryTransaction/download' + `?params=${encodeURIComponent(str)}`
|
.then(blob => {
|
||||||
// const response:any = await axios.get(Https.httpUrls.queryTransactionDownload, {
|
// 创建一个指向 Blob 对象的 URL
|
||||||
// responseType: 'blob', // 重要:确保设置响应类型为 'blob'
|
const link = document.createElement('a');
|
||||||
// params:{params:str}
|
link.href = URL.createObjectURL(blob); // 将 Blob 对象转换为可下载的 URL
|
||||||
// }).then((rv)=>{
|
link.download = 'transaction'; // 设置文件名
|
||||||
// console.log(rv);
|
filter.tableLoading = false;
|
||||||
// })
|
link.click(); // 触发下载
|
||||||
fetch(url,{
|
URL.revokeObjectURL(link.href); // 释放 URL 对象
|
||||||
headers: {
|
})
|
||||||
'Authorization': `${getCookie('token')}`, // 添加 Bearer token 验证
|
}
|
||||||
}
|
}
|
||||||
})
|
);
|
||||||
.then(response => {
|
|
||||||
console.log(response);
|
|
||||||
|
|
||||||
// return response.blob(); // 将响应转为 Blob 类型
|
|
||||||
})
|
|
||||||
.then((blob:any) => {
|
|
||||||
// 创建一个 URL 对象链接 Blob 数据
|
|
||||||
console.log(blob);
|
|
||||||
|
|
||||||
const objectURL = URL.createObjectURL(blob);
|
|
||||||
// 创建一个临时的 <a> 标签
|
|
||||||
const link = document.createElement('a');
|
|
||||||
link.href = objectURL;
|
|
||||||
link.download = 'download'; // 设置下载的文件名
|
|
||||||
// 触发点击事件,下载文件
|
|
||||||
link.click();
|
|
||||||
// 清理
|
|
||||||
URL.revokeObjectURL(objectURL); // 释放 objectURL
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
let lastGeTrialList = (str: string) => {
|
let lastGeTrialList = (str: string) => {
|
||||||
clearHistoryList();
|
clearHistoryList();
|
||||||
|
|||||||
Reference in New Issue
Block a user