import { axios } from '@/utils/request'

//  下载中心  有分页
export const taskList = (params) => {
  const url = `report/exportTask/queryPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}

// 下载文件
export const dowloadFile = (url, label) => {
  axios.get(url, { responseType: "blob" }).then(response => {
     const blob = new Blob([response.data]);
     const link = document.createElement("a");
     link.href = URL.createObjectURL(blob);
     link.download = label;
     link.click();
     URL.revokeObjectURL(link.href);
   }).catch(console.error);
}