<el-button
class="filter-item"
size="small"
@click="batchExport"
type="primary"
icon="edit"
>表格导出</el-button>
<el-upload
class="upload-demo"
action="/operation/commentPool/importExcel"
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
:on-success="handleSuccess"
multiple
:show-file-list="true"
>
<el-button size="small" type="primary">表格导入</el-button>
</el-upload>
methods:{
//导出表格
batchExport: function() {
axios({
url: "/operation/commentPool/export",//接口地址
method: "get",
responseType: "blob",
params: {
timeType: timeType,
}
})
.then(response => {
let blob = new Blob([response.data], {
type:
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
});
let url = window.URL.createObjectURL(blob);
let a = document.createElement("a");
a.href = url;
a.download = "用户注册表.xlsx";
a.click();
window.URL.revokeObjectURL(url);
})
.catch(err => {
console.log(err);
});
},
}