feat(数据集): 数据集导出Excel

This commit is contained in:
junjun 2022-11-08 15:07:32 +08:00
parent 31d304122b
commit 0947155d75

View File

@ -462,21 +462,27 @@ export default {
this.showExport = false this.showExport = false
}, },
exportDatasetRequest() { exportDatasetRequest() {
if (this.table.id) { this.$refs['exportForm'].validate((valid) => {
this.table.row = 100000 if (valid) {
this.table.filename = this.exportForm.name if (this.table.id) {
this.table.expressionTree = this.exportForm.expressionTree this.table.row = 100000
exportDataset(this.table).then((res) => { this.table.filename = this.exportForm.name
const blob = new Blob([res], { type: 'application/vnd.ms-excel' }) this.table.expressionTree = this.exportForm.expressionTree
const link = document.createElement('a') exportDataset(this.table).then((res) => {
link.style.display = 'none' const blob = new Blob([res], { type: 'application/vnd.ms-excel' })
link.href = URL.createObjectURL(blob) const link = document.createElement('a')
link.download = this.exportForm.name + '.xlsx' // link.style.display = 'none'
document.body.appendChild(link) link.href = URL.createObjectURL(blob)
link.click() link.download = this.exportForm.name + '.xlsx' //
document.body.removeChild(link) document.body.appendChild(link)
}) link.click()
} document.body.removeChild(link)
})
}
} else {
return false
}
})
} }
} }
} }