vue导入excel表格


<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导入的模板不正确!');
}
});
},
 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM