Commit 7d7342b1 by zhangquan

交互优化

1 parent a70b5861
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
</el-popover> </el-popover>
</div> </div>
</div> </div>
<div class="file_name" v-if="errorFileInfo.fileName">{{errorFileInfo.fileName}}</div> <div class="file_name" v-if="fileData && fileData.name">{{fileData.name}}</div>
</div> </div>
<div class="file_info"> <div class="file_info">
<div class="file_num"> <div class="file_num">
...@@ -82,6 +82,7 @@ ...@@ -82,6 +82,7 @@
return { return {
size: 'small', size: 'small',
exampleImg, exampleImg,
uploaded: false,
isVisible: false, isVisible: false,
requestTip: false, requestTip: false,
contractNoStr: '', contractNoStr: '',
...@@ -89,6 +90,7 @@ ...@@ -89,6 +90,7 @@
contractNoList: [], contractNoList: [],
errorNoList: [], errorNoList: [],
errorFileInfo:{}, errorFileInfo:{},
fileData: {},
getListApi: this.$apis.addCode.getcodeList, getListApi: this.$apis.addCode.getcodeList,
pageConf: { pageSize: 'pageSize', pageNum: 'pageCount', totalCount: 'total' }, pageConf: { pageSize: 'pageSize', pageNum: 'pageCount', totalCount: 'total' },
pageSizes: [5, 10, 20, 30, 40], pageSizes: [5, 10, 20, 30, 40],
...@@ -216,6 +218,30 @@ ...@@ -216,6 +218,30 @@
this.$refs.file.value = '' this.$refs.file.value = ''
return false return false
} }
this.uploaded = false
this.fileData = file
},
handleUploadFile(){
if(!this.fileData.size) return this.$message({
message:'请上传文件',
type: 'error',
customClass: 'msgHierarchy'
});
if(this.uploaded){
if(this.errorFileInfo.effectiveSize<=0){
this.$message({
message:'有效合同号为0',
type: 'error',
customClass: 'msgHierarchy'
})
this.fileData = {}
}else{
this.clearData()
}
this.uploaded = false
return false
}
const file = this.fileData
const reader = new FileReader() const reader = new FileReader()
reader.readAsDataURL(file) reader.readAsDataURL(file)
reader.onload = event => { reader.onload = event => {
...@@ -233,8 +259,8 @@ ...@@ -233,8 +259,8 @@
this.$apis.addCode.uploadCodeFile({ file: fileUrl }).then(res => { this.$apis.addCode.uploadCodeFile({ file: fileUrl }).then(res => {
loading.close() loading.close()
if(res?.batchNo) { if(res?.batchNo) {
res.fileName = file?.name
this.errorFileInfo = res this.errorFileInfo = res
this.uploaded = true
} }
this.$refs.file.value = '' this.$refs.file.value = ''
}).catch(err =>{ }).catch(err =>{
...@@ -262,6 +288,7 @@ ...@@ -262,6 +288,7 @@
}) })
}, },
createCode() { createCode() {
this.uploaded = false
this.isVisible = true this.isVisible = true
}, },
onOk(){ onOk(){
...@@ -309,14 +336,7 @@ ...@@ -309,14 +336,7 @@
loading.close() loading.close()
}) })
}else{ }else{
if(this.errorFileInfo.effectiveSize<=0){ this.handleUploadFile()
return this.$message({
message:'有效合同号为0',
type: 'error',
customClass: 'msgHierarchy'
})
}
this.clearData()
} }
}, },
clearData(){ clearData(){
...@@ -327,6 +347,7 @@ ...@@ -327,6 +347,7 @@
this.contractNoList = [], this.contractNoList = [],
this.errorNoList = [] this.errorNoList = []
this.errorFileInfo = {} this.errorFileInfo = {}
this.fileData = {}
this.handleRest() this.handleRest()
}, },
handleClose() { handleClose() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!