Merge branch 'zcwy_0806_paihangb' into dev0515

This commit is contained in:
zhangsir
2024-10-28 17:35:14 +08:00
2 changed files with 26 additions and 4 deletions

View File

@@ -12,6 +12,7 @@
:show-file-list="showList"
:data="data"
:headers="headers"
:on-remove="handleRemove"
class="upload-file-uploader"
ref="upload"
>
@@ -142,6 +143,9 @@ export default {
},
},
methods: {
handleRemove(file, fileList){
this.$emit('isTrue',false)
},
// 上传前校检格式和大小
handleBeforeUpload(file) {
if(this.beforeMsg){
@@ -186,6 +190,8 @@ export default {
if(this.loading) {
this.isLoading = true;
}
this.$emit('isTrue',true)
this.$emit('isFalse',true)
return true;
},
// 文件个数超出
@@ -195,6 +201,7 @@ export default {
// 上传失败
handleUploadError(err) {
this.isLoading = false;
this.$emit('isTrue',false)
this.$message({message:"上传失败, 请重试",type:'error',offset:100});
},
// 上传成功回调

View File

@@ -149,7 +149,7 @@
<el-checkbox v-model="deviceMobile" @change="isVisible(1)" label="移动端可见" border></el-checkbox>
<el-checkbox v-model="devicePc" @change="isVisible(2)" label="pc端可见" border></el-checkbox>
</div>
<file-upload scorm="zip" dir="files" :beforeMsg="needOrg" :showList="true" :value="imageShowUrl" :limit="5" @success="handleUploadSuccess" @remove="handleRemoveSuccess"></file-upload>
<file-upload scorm="zip" dir="files" @isFalse="isFalseChange" @isTrue="isTrueChange" :beforeMsg="needOrg" :showList="true" :value="imageShowUrl" :limit="5" @success="handleUploadSuccess" @remove="handleRemoveSuccess"></file-upload>
</div>
</div>
@@ -281,6 +281,7 @@ export default {
data() {
return {
isTrue: false,
isFalse: false,
resOwnerListMap: [],
//fileBaseUrl: process.env.VUE_APP_FILE_BASE_URL,
fileBaseUrl:this.$xpage.constants.fileBaseUrl, //获成动态获取的处理
@@ -393,6 +394,12 @@ export default {
this.search();
},
methods: {
isTrueChange(val){
this.isTrue = val
},
isFalseChange(val){
this.isFalse = val
},
beforeCheck(){
if(!this.upload.orgId ||!this.upload.orgName){
return false;
@@ -535,7 +542,6 @@ export default {
// }
},
handleUploadSuccess(rs) {
this.isTrue = true;
if (rs.status === 200) {
let type = toContentType(rs.result.fileType);
// ["doc", "xls", "ppt","docx", "xlsx", "pptx","png","txt", "pdf","jpg","gif","bmp","mp4","mp3"]
@@ -573,11 +579,11 @@ export default {
this.isTrue = false;
}else{
this.$message.error(res.message);
this.isTrue = true
this.isFalse = false
}
}).catch (error=>{
console.log(error,'error')
this.isTrue = true
this.isFalse = false
//this.$message.error(error);
});
// const { result, status } = coueseFile.saveUpload(data);
@@ -606,17 +612,26 @@ export default {
},
handleCloseCheck(done){
//console.log('关闭的处理aaaaa');
if(this.isTrue&&this.isFalse){
this.$message.error('文件正在上传中,请耐心等待');
return false;
}
if(this.fileList.length>0){
this.$message.error('有待保存的上传文件,请执行保存操作');
return false;
}else{
this.isTrue = false
this.isFalse = false
return done(true);
}
},
// 文件上传保存
saveUpload() {
if(this.fileList.length<=0){
this.$message.error('请上传文件');
return;
}
if(!this.upload.orgName){
this.$message.success('请选择资源归属');
return;