码迷,mamicode.com
首页 > 其他好文 > 详细

vue导入excel表格

时间:2019-09-05 18:24:46      阅读:143      评论:0      收藏:0      [点我收藏+]

标签:ios   for   als   excel   cep   url   app   导入   tab   

<Upload ref="upload" :show-upload-list="false" accept=".xls, .xlsx" :before-upload="templateToImport"
type="drag" action="/chenfan_refuse/otherRecord/otherRecordExcelImport"
style="display:inline-block;width:100px;float:left"><Button> Excel模板导入</Button></Upload>
 
// Excel模板导入
templateToImport(file) {
if (!this.lenderName) {
this.$Message.warning(‘请选择借出人!‘);
return
}
let formData = new FormData();
formData.append("file", file);
this.$axios({
url: "/chenfan_refuse/otherRecord/otherRecordExcelImport",
method: "post",
data: formData
}).then((data) => {
if (data.obj.length) {
let lenderName = data.obj[0].lenderName
if (lenderName === this.lenderName) {
data.obj.forEach((ele, index) => {
this.tableData.push(ele)
})
// this.tableData = data.obj
} else {
this.$Message.warning(‘请选择与模板相同的借出人!‘);
}
// this.getDetailInfo()
} else {
this.$Message.warning(‘Excel导入的模板不正确!‘);
}
});
},
 

vue导入excel表格

标签:ios   for   als   excel   cep   url   app   导入   tab   

原文地址:https://www.cnblogs.com/wssdx/p/11468652.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!