导出excel数据
Posted antyhouse
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了导出excel数据相关的知识,希望对你有一定的参考价值。
<el-form-item>
<el-button type="info" @click="exportOrderList"><i class="el-icon-upload2"></i>导出excel</el-button>
</el-form-item>
import Fetch from '@/api/statistics'
exportOrderList() {
this.loading = true
setTimeout(() => {
this.loading = false
}, 20000)
let {beginDate, endDate} = this.search
let params = {beginDate, endDate}
Fetch.exportOrderList(params) //exportOrderList这里是调接口,从statistics进入的
this.loading = false
},
function exportOrderList(searchData) {
let data = Object.assign({}, searchData)
let params = ''
for (var key in data) {
if (data[key]) {
params += (params ? '&' : '?') + key + '=' + data[key]
}
}
params += (params ? '&' : '?') + 'Authorization=' + localStorage.getItem('jwt')
let url = process.env.GATEWAY_API + '/admin-api/statistic/enterprise/exportStatisticList' + params
console.log(url, 'url')
// window.open(url)
}
export default {
queryStatistics,
exportOrderList
}
以上是关于导出excel数据的主要内容,如果未能解决你的问题,请参考以下文章