Commit 3e1dfc0e authored by Asjoker's avatar Asjoker

异常日志-导出

parent 3bb08ee1
......@@ -336,21 +336,33 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
const queryParams = Object.assign({}, this.queryParams)
// queryParams.operTime = queryParams.operTime ? this.$parseDate(new Date(queryParams.operTime), 'YYYYMM') : ''
delete queryParams.page
delete queryParams.rows
queryParams.ids = this.ids.join(',') || null
exportErrLog(queryParams).then(response => {
this.download(response.msg)
}).catch(function() {})
// this.$confirm('是否确认导出所有日志异常数据项?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(function() {
// return exportErrLog(queryParams)
// })
// const queryParams = Object.assign({}, this.queryParams)
// // queryParams.operTime = queryParams.operTime ? this.$parseDate(new Date(queryParams.operTime), 'YYYYMM') : ''
// delete queryParams.page
// delete queryParams.rows
// queryParams.ids = this.ids.join(',') || null
// exportErrLog(queryParams).then(response => {
// this.download(response.msg)
// }).catch(function() {})
const queryParams = this.queryParams
this.$confirm('是否确认导出所有日志异常数据项?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
return exportErrLog(queryParams).then(response => {
const blob = new Blob([response])
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)// 创建下载的链接
downloadElement.href = href
downloadElement.download = '异常日志' + '.xls' // 下载后文件名
document.body.appendChild(downloadElement)
downloadElement.click()// 点击下载
document.body.removeChild(downloadElement)// 下载完成移除元素
window.URL.revokeObjectURL(href)// 释放掉blob对象
// this.download(response.msg)
})
})
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment