优化页面UI,修改测试bug
This commit is contained in:
@@ -68,8 +68,8 @@
|
||||
const orgId = ref('');
|
||||
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
|
||||
orgId.value = result;
|
||||
const fetch = (api, params = { orgId }) => {
|
||||
return http.post(api, params);
|
||||
const fetch = (api, params = { orgId }, config) => {
|
||||
return http.post(api, params, config);
|
||||
};
|
||||
// 判断展示哪个页面
|
||||
const isMainPage = ref(true);
|
||||
@@ -205,7 +205,30 @@
|
||||
{
|
||||
label: '下载',
|
||||
name: 'download',
|
||||
handle: (record: any) => {},
|
||||
handle: (record: any) => {
|
||||
const deleteId = ref(new FormData());
|
||||
deleteId.value.append('id', record.id);
|
||||
const config = {
|
||||
responseType: 'blob',
|
||||
};
|
||||
fetch(carbonInventoryCheck.downloadZip, deleteId.value, config)
|
||||
.then((res) => {
|
||||
// 创建一个 URL 对象,指向图片数据的 blob
|
||||
const url = window.URL.createObjectURL(new Blob([res]));
|
||||
// 创建一个 <a> 标签,用于触发下载
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.setAttribute('download', '碳盘查凭证.zip'); // 设置下载的文件名
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
|
||||
// 清理 URL 对象
|
||||
window.URL.revokeObjectURL(url);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('下载图片失败:', error);
|
||||
});
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
|
Reference in New Issue
Block a user