|
|
@@ -162,6 +162,8 @@
|
|
|
return '{{ url("maintenance/ownerMaterial/downFile?file=")}}'+ownerMaterial.file.url+'&name='+ownerMaterial.file.file_name;
|
|
|
},
|
|
|
uploadFile(){
|
|
|
+ tempTip.setDuration(3000);
|
|
|
+ tempTip.setIndex(1099);
|
|
|
let url = '{{url('apiLocal/ownerMaterial/uploadFile')}}';
|
|
|
let data = new FormData();
|
|
|
let file = this.$refs.file.files[0];
|
|
|
@@ -169,21 +171,27 @@
|
|
|
if (!confirm('请选择上传文件')) return;
|
|
|
}
|
|
|
if (file.size >=10485760){
|
|
|
- tempTip.setDuration(3000);
|
|
|
- tempTip.setDuration(1099);
|
|
|
tempTip.show("图片大小不能超过10MB!");
|
|
|
return;
|
|
|
}
|
|
|
data.append('file',file);
|
|
|
data.append('id',this.editOwnerMaterial.id);
|
|
|
- window.tempTip.postBasicRequest(url,data,res=>{
|
|
|
- this.fileType(res);
|
|
|
- this.$set(this.ownerMaterials,this.index,res);
|
|
|
- this.editOwnerMaterial = {};
|
|
|
- this.index = '';
|
|
|
- $("#uploadFile").modal('hide');
|
|
|
- return "上传成功";
|
|
|
- },true);
|
|
|
+ window.axios.post(url,data,{
|
|
|
+ 'Content-Type':'multipart/form-data'
|
|
|
+ }).then(res=>{
|
|
|
+ if(res.data.success){
|
|
|
+ this.fileType(res.data.data);
|
|
|
+ this.$set(this.ownerMaterials,this.index,res.data.data);
|
|
|
+ this.editOwnerMaterial = {};
|
|
|
+ this.index = '';
|
|
|
+ tempTip.showSuccess('文件上传成功');
|
|
|
+ $("#uploadFile").modal('hide');
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ tempTip.show(res.data.message ?? '文件上传失败');
|
|
|
+ }).catch(err=>{
|
|
|
+ tempTip.show('文件上传失败'+err);
|
|
|
+ })
|
|
|
},
|
|
|
filterMaterial(e,type){
|
|
|
let value = $(e.target).val();
|