|
|
|
|
|
|
|
|
> |
|
|
> |
|
|
{{ file.fileName }} |
|
|
{{ file.fileName }} |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<span style="padding:0 20px;"></span> |
|
|
|
|
|
<span style="color:red">(备注:支持Word文档,execl,ppt,pdf)</span> |
|
|
</div> |
|
|
</div> |
|
|
<el-table |
|
|
<el-table |
|
|
height="calc(100vh - 220px)" |
|
|
height="calc(100vh - 220px)" |
|
|
|
|
|
|
|
|
dataList: [], |
|
|
dataList: [], |
|
|
loading: false, |
|
|
loading: false, |
|
|
file: {}, |
|
|
file: {}, |
|
|
uploading:false |
|
|
|
|
|
|
|
|
uploading: false, |
|
|
}; |
|
|
}; |
|
|
}, |
|
|
}, |
|
|
created() { |
|
|
created() { |
|
|
|
|
|
|
|
|
.finally(() => { |
|
|
.finally(() => { |
|
|
this.loading = false; |
|
|
this.loading = false; |
|
|
}); |
|
|
}); |
|
|
this.getFile() |
|
|
|
|
|
|
|
|
this.getFile(); |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
getFile() { |
|
|
getFile() { |
|
|
|
|
|
|
|
|
input.addEventListener( |
|
|
input.addEventListener( |
|
|
"change", |
|
|
"change", |
|
|
(upload = (e) => { |
|
|
(upload = (e) => { |
|
|
input.removeEventListener('change',upload) |
|
|
|
|
|
if(this.uploading){ |
|
|
|
|
|
|
|
|
input.removeEventListener("change", upload); |
|
|
|
|
|
if (this.uploading) { |
|
|
this.$message({ |
|
|
this.$message({ |
|
|
type:"warning", |
|
|
|
|
|
message:"正在上传" |
|
|
|
|
|
}) |
|
|
|
|
|
return |
|
|
|
|
|
|
|
|
type: "warning", |
|
|
|
|
|
message: "正在上传", |
|
|
|
|
|
}); |
|
|
|
|
|
return; |
|
|
} |
|
|
} |
|
|
this.uploading=true |
|
|
|
|
|
|
|
|
this.uploading = true; |
|
|
let file = e.target.files[0]; |
|
|
let file = e.target.files[0]; |
|
|
if(!file){ |
|
|
|
|
|
this.uploading=false |
|
|
|
|
|
return |
|
|
|
|
|
|
|
|
if (!file) { |
|
|
|
|
|
this.uploading = false; |
|
|
|
|
|
return; |
|
|
} |
|
|
} |
|
|
let MAXSIZE = 5 * 1024 * 1024; |
|
|
let MAXSIZE = 5 * 1024 * 1024; |
|
|
if (file.size > MAXSIZE) { |
|
|
if (file.size > MAXSIZE) { |
|
|
|
|
|
|
|
|
message: "上传文件成功", |
|
|
message: "上传文件成功", |
|
|
}); |
|
|
}); |
|
|
} else { |
|
|
} else { |
|
|
this.$message.error(data.code); |
|
|
|
|
|
|
|
|
this.$message.error(data.msg); |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
.catch((e) => { |
|
|
.catch((e) => { |
|
|
this.$message.error("上传文件失败"); |
|
|
|
|
|
}).finally(e=>{ |
|
|
|
|
|
this.uploading=false |
|
|
|
|
|
this.getFile() |
|
|
|
|
|
|
|
|
this.$message.error(e); |
|
|
|
|
|
}) |
|
|
|
|
|
.finally((e) => { |
|
|
|
|
|
this.uploading = false; |
|
|
|
|
|
this.getFile(); |
|
|
}); |
|
|
}); |
|
|
}) |
|
|
}) |
|
|
); |
|
|
); |