|
@@ -530,6 +530,32 @@ const getList = async () => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+const downloadFile = (response: any) => {
|
|
|
|
|
+ const blob = new Blob([response], {
|
|
|
|
|
+ type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ let fileName = '排查治理记录.xlsx'
|
|
|
|
|
+ const disposition = response.headers ? response.headers['content-disposition'] : ''
|
|
|
|
|
+ if (disposition) {
|
|
|
|
|
+ const filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/
|
|
|
|
|
+ const matches = filenameRegex.exec(disposition)
|
|
|
|
|
+ if (matches != null && matches[1]) {
|
|
|
|
|
+ fileName = matches[1].replace(/['"]/g, '')
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const url = window.URL.createObjectURL(blob)
|
|
|
|
|
+ const link = document.createElement('a')
|
|
|
|
|
+ link.href = url
|
|
|
|
|
+ link.setAttribute('download', fileName)
|
|
|
|
|
+
|
|
|
|
|
+ document.body.appendChild(link)
|
|
|
|
|
+ link.click()
|
|
|
|
|
+
|
|
|
|
|
+ document.body.removeChild(link)
|
|
|
|
|
+ window.URL.revokeObjectURL(url)
|
|
|
|
|
+}
|
|
|
const handleExport = async () => {
|
|
const handleExport = async () => {
|
|
|
try {
|
|
try {
|
|
|
exportLoading.value = true
|
|
exportLoading.value = true
|