导入拆分文件类型修改

This commit is contained in:
caoyang
2022-04-18 10:07:23 +08:00
parent 808c3a4b44
commit 0564957ca1
4 changed files with 28 additions and 43 deletions
@@ -2,7 +2,7 @@
<div class="split-import-upload"> <div class="split-import-upload">
<!-- <a-modal v-model="visible" :maskClosable="false" :footer="[]" :title="title" class="ocr-upload-modal">--> <!-- <a-modal v-model="visible" :maskClosable="false" :footer="[]" :title="title" class="ocr-upload-modal">-->
<a-upload <a-upload
:accept='accept' accept='.zip'
:disabled="disabled" :disabled="disabled"
class="ant-upload-list" class="ant-upload-list"
name="file" name="file"
@@ -50,31 +50,21 @@
}, },
methods:{ methods:{
beforeUpload(file,fileList) { beforeUpload(file,fileList) {
// console.log('file',this.accept,file,fileList,this.myfileList) console.log('file',this.accept,file,fileList,this.myfileList)
this.fileTypeSatus=false this.fileTypeSatus=false
if(this.myfileList&&this.myfileList.length>=1){ if(this.myfileList&&this.myfileList.length>=1){
// console.log() // console.log()
this.$message.warning(this.$t('onlyOnefileUploaded')) this.$message.warning(this.$t('onlyOnefileUploaded'))
return false return false
}else{ }else{
// let thisFileType = this.thisFileType.replace(/\s+/g, ""); let suffix=file.name.split('.')
// console.log('accetptt',this.accept) let acceptSuffix=suffix[suffix.length-1]
let acceptFlag=false if(acceptSuffix.toLowerCase()=='zip'){
let accepts = this.accept.split(',') this.fileTypeSatus = true;
accepts.forEach((item,index)=>{ this.$message.destroy()
if(item==file.type){ // 207M.doc文件大小超出100MB限制, 请压缩或降低文件质量!
acceptFlag=true this.errorMessage = file.name + "文件大小超出100MB限制, 请压缩或降低文件质量!";
return // }
}else{
acceptFlag=false
}
})
if(acceptFlag){
// console.log('111111')
this.fileTypeSatus = true;
this.$message.destroy()
// 207M.doc文件大小超出100MB限制, 请压缩或降低文件质量!
this.errorMessage = file.name + "文件大小超出100MB限制, 请压缩或降低文件质量!";
} }
} }
}, },
@@ -127,7 +127,7 @@
], ],
}, },
spinning:false, //loading标识 spinning:false, //loading标识
type:'', type:'doc',
url:{ url:{
tableHeader: 'document/bussDocumentLibraryEO/getHeaderOrConditionForSplitResult', //表格头部字段 tableHeader: 'document/bussDocumentLibraryEO/getHeaderOrConditionForSplitResult', //表格头部字段
seachList: 'document/bussDocumentLibraryEO/getHeaderOrConditionForSplitResult', //搜索字段 seachList: 'document/bussDocumentLibraryEO/getHeaderOrConditionForSplitResult', //搜索字段
@@ -894,6 +894,7 @@
} }
eventBUs.$emit('searchQuery', JSON.parse(JSON.stringify(queryParam))) eventBUs.$emit('searchQuery', JSON.parse(JSON.stringify(queryParam)))
this.selectClear()
// eventBUs.$emit('searchReset') // eventBUs.$emit('searchReset')
}else{ }else{
this.$message.warning(this.$t('operationFailed')) this.$message.warning(this.$t('operationFailed'))
@@ -137,6 +137,7 @@
OperationList:[], OperationList:[],
token:Vue.ls.get(ACCESS_TOKEN), token:Vue.ls.get(ACCESS_TOKEN),
cut:'', cut:'',
submitFlag:false
} }
}, },
props:{ props:{
@@ -226,31 +227,24 @@
fileGroup: this.fileGroup, fileGroup: this.fileGroup,
fileType:file.text_info fileType:file.text_info
} }
if(!this.submitFlag){
this.submitFlag=true
postAction(`split/sarFileSplitInfo/add`, params).then(res => {
if (res.success) {
this.$message.success(this.$t('OperationSuccessful'))
eventBUs.$emit('searchReset')
this.visible = false;
this.$emit('visible', false)
} else {
this.$message.warning(res.message)
}
}).finally(()=>{
this.submitFlag =true
// if (file.text_info == '发布稿(必读)') {
// params.fileType = '1'
// } else if (file.text_info == '增补件(必读)') {
// params.fileType = '2'
// } else if (file.text_info == '报批稿') {
// params.fileType = '3'
// } else if (file.text_info == '征求意见稿') {
// params.fileType = '4'
// } else if (file.text_info == '测试程序') {
// params.fileType = '5'
// } else if (file.text_info == '相关资料') {
// params.fileType = '6'
// }
postAction(`split/sarFileSplitInfo/add`, params).then(res => {
if (res.success) {
this.$message.success(this.$t('OperationSuccessful'))
eventBUs.$emit('searchReset')
this.visible = false;
this.$emit('visible', false)
} else {
this.$message.warning(this.$t('operationFailed'))
}
}) })
this.$emit('exportVisible',true) this.$emit('exportVisible',true)
}
} else { } else {
this.$message.warning(this.$t('OnlyWord')) this.$message.warning(this.$t('OnlyWord'))
} }