Commit 171b157a by caoyanzhi

上传表格时,添加文件格式限制

parent 2de1dac5
......@@ -483,7 +483,17 @@ export default {
// 处理上传的表格
handleFileChange(e) {
const files = e.target.files[0];
// .xlsx, .xls, .csv
const reg = /(\.(xlsx|xls|csv))$/;
if (!files) return;
if (!reg.test(files.name)) {
this.$message.warning({
duration: 1000,
message: '仅支持上传xlsx、xls、csv格式的文件'
});
e.target.value = '';
return;
}
this.importPop.excelName = files.name;
const reader = new FileReader();
reader.onload = e => {
......@@ -558,6 +568,7 @@ export default {
});
return;
}
this.$refs.upload.value = '';
const para = {
tagItemId: this.importPop.tagItemId,
data: JSON.stringify(this.importPop.excelData)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment