|
|
@@ -0,0 +1,38 @@
|
|
|
+<template>
|
|
|
+ <el-button type="primary" size="small" @click="exportData" plain>导 出</el-button>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+export default {
|
|
|
+ props:['param','type','columns','columnsIndex','fileName','dataid'],
|
|
|
+ data(){
|
|
|
+ return{
|
|
|
+ columnsData:[]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods:{
|
|
|
+ async exportData(){
|
|
|
+ this.param.content.isExport = 1
|
|
|
+ /*导出数据*/
|
|
|
+ const res = await this.$api.requested(this.param)
|
|
|
+ this.downFile(res.data,this.fileName)
|
|
|
+ this.param.content.isExport = 0
|
|
|
+ },
|
|
|
+ downFile(url, fileName) {
|
|
|
+ const x = new XMLHttpRequest()
|
|
|
+ x.open('GET', url, true)
|
|
|
+ x.responseType = 'blob'
|
|
|
+ x.onload = function() {
|
|
|
+ const url = window.URL.createObjectURL(x.response)
|
|
|
+ const a = document.createElement('a')
|
|
|
+ a.href = url
|
|
|
+ a.download = fileName
|
|
|
+ a.click()
|
|
|
+ }
|
|
|
+ x.send()
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+<style>
|
|
|
+</style>
|