Commit 99d1d646 authored by 华国豪's avatar 华国豪 🙄

上传失败1

parent 21bc5ae9
...@@ -311,6 +311,7 @@ ...@@ -311,6 +311,7 @@
<div style="margin-bottom:10px;width: 29%;"> <div style="margin-bottom:10px;width: 29%;">
附件上传: 附件上传:
<el-upload <el-upload
ref="my-upload"
class="upload-demo" class="upload-demo"
drag drag
:http-request="uploadFileBtn" :http-request="uploadFileBtn"
...@@ -399,6 +400,8 @@ export default { ...@@ -399,6 +400,8 @@ export default {
this.attach = ""; this.attach = "";
}, },
previewFile(e) { previewFile(e) {
window.open(this.attach, "_blank");
return
const link = document.createElement("a"); const link = document.createElement("a");
let _loadUrl = this.domainManager().DomainUrl; let _loadUrl = this.domainManager().DomainUrl;
let str = window.location.href; let str = window.location.href;
...@@ -407,6 +410,11 @@ export default { ...@@ -407,6 +410,11 @@ export default {
link.click(); link.click();
}, },
uploadFileBtn(file) { uploadFileBtn(file) {
if (file.file.size > 1024 * 1024 * 100) {
this.$message.warning('上传文件不能大于100M');
this.$refs['my-upload'].clearFiles();
return;
}
//上传 //上传
let newArr = []; let newArr = [];
newArr.push(file.file); newArr.push(file.file);
...@@ -415,6 +423,8 @@ export default { ...@@ -415,6 +423,8 @@ export default {
this.UploadSelfFileT(path, newArr, x => { this.UploadSelfFileT(path, newArr, x => {
this.attach = this.domainManager().ViittoFileUrl + x.data.FilePath; this.attach = this.domainManager().ViittoFileUrl + x.data.FilePath;
this.$message.success(this.$t("tips.scchenggong")); this.$message.success(this.$t("tips.scchenggong"));
}, err=>{
}); });
}, },
init(id) { init(id) {
......
...@@ -753,10 +753,15 @@ export default { ...@@ -753,10 +753,15 @@ export default {
that.$http.post(uploadUrl, formData, {}) that.$http.post(uploadUrl, formData, {})
.then(res => { .then(res => {
successCall(res); successCall(res);
}) }).catch(function(reason){
that.$refs['my-upload'].clearFiles();
that.$message.error('上传失败!');
});
} }
}).catch(function (err) { }).catch(function (err) {
that.$refs['my-upload'].clearFiles();
that.$message.error('上传失败!');
}); });
} }
} }
......
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