export const useExport = (response: any) => {
  try {
    const downloadUrl = window.URL.createObjectURL(new Blob([response.data]))
    const link = document.createElement('a')
    link.href = downloadUrl
    const name = response.name.split('=')[1]
    link.setAttribute('download', decodeURI(name))
    document.body.appendChild(link)
    link.click()
    link.remove()
    window.URL.revokeObjectURL(downloadUrl)
    ElMessage.success('导出成功')
    return {
      success: true
    }
  } catch (error) {
    console.error('导出失败:', error)
    ElMessage.error('导出失败')
    return {
      success: false
    }
  }
}
