ocr修改

This commit is contained in:
caoyang
2022-03-23 22:54:26 +08:00
parent 99a1971b1d
commit 89dfabd61a
5 changed files with 40 additions and 14 deletions
+17 -3
View File
@@ -169,12 +169,15 @@
<span class="title-text-text">{{item.db_field_txt}}</span>
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<a-button type="primary" class="button-text"
<a-button v-if="formInline[item.db_field_name] === 'null' || formInline[item.db_field_name] === '' ||
formInline[item.db_field_name] == null" type="primary" class="button-text"
@click="clickButtonToUpload(item.db_field_name)">
{{ (formInline[item.db_field_name] === 'null' || formInline[item.db_field_name] === '' ||
formInline[item.db_field_name] == null) ? $t('clickUpload') : $t('viewUploadedFiles')
}}
</a-button>
<span v-if="!(formInline[item.db_field_name] === 'null' || formInline[item.db_field_name] === '' ||
formInline[item.db_field_name] == null)">{{fileName[item.db_field_name]}}</span>
</a-form-model-item>
</div>
</a-col>
@@ -263,7 +266,9 @@
ruleList: [],
validatorRules: {},
confirmLoading: false,
uploadName: ''
uploadName: '',
fileName:{},
}
},
mounted() {
@@ -271,7 +276,7 @@
},
methods: {
sumber() {
// console.log('vilidate',this.formInline)
console.log('vilidate',this.formInline)
this.$refs.ruleForm1.validate(valid => {
if (valid) {
let url = ''
@@ -302,21 +307,30 @@
uploadSuccess(data) {
// console.log(data)
let attIdList = []
let attNameList=[]
if(data && data.length>0){
data.map(item => {
attIdList.push(item.id || data.name)
attNameList.push(item.fileName)
})
/** 赋值给当前对应的表单文件 */
this.formInline[this.uploadName] = attIdList.join(',')
this.fileName[this.uploadName]=attNameList.join(',')
this.formInline = { ...this.formInline }
this.$refs.uploadFile.visible = false
// console.log('form',this.formInline)
}else{
this.formInline[this.uploadName]=''
this.fileName[this.uploadName]=''
this.formInline = { ...this.formInline }
// console.log('form',this.formInline)
}
},
//关闭上传弹框
closeUpload(){
// this.fileVisible = false
},
handleInput(value) {
this.$nextTick(() => {
this.formInline = { ...this.formInline }
+5 -1
View File
@@ -26,7 +26,7 @@
import { ACCESS_TOKEN } from "@/store/mutation-types"
export default {
name: 'ocrUpload',
props:['disableds','disabled','thisFileUploadUrl','readonly','thisFileType','accept','title','listType'],
props:['disableds','disabled','thisFileUploadUrl','readonly','thisFileType','accept','listType'],
data(){
return{
visible:false,
@@ -36,12 +36,14 @@
fileList:[],
fileTypeSatus:false,
headers:{},
title:this.$t('UploadFile'),
}
},
created(){
const token = Vue.ls.get(ACCESS_TOKEN);
this.headers = {"X-Access-Token":token};
this.containerId = 'container-ty-'+new Date().getTime();
// console.log('title',this.title)
},
mounted(){
// console.log(this.thisFileType,this.thisFileSize,this.thisFileUploadUrl);
@@ -115,6 +117,7 @@
})
// console.log('file1111',this.fileList)
this.$emit('uploadSuccess', this.fileList)
this.$message.destroy()
this.$message.error('最多只能上传一个文件');
return
@@ -131,6 +134,7 @@
if(this.myfileList.length > 0){
this.$emit('uploadSuccess', this.fileList)
// console.log('fileList111',this.fileList)
this.$message.destroy()
this.$message.success(`${info.file.name} 文件上传成功。`);
}