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} 文件上传成功。`);
}
@@ -78,7 +78,7 @@
</div>
<doc-table v-if="drawVisible" :drawVisible="drawVisible" :drawTableSorce="drawTableSorce" @visible="docVisible" @exportVisible="exportVisible"></doc-table>
<ocr-upload ref="uploadFile1" :disabled="disabled" :accept="accept" :title="title" :listType='listType' @uploadSuccess="uploadSuccess"></ocr-upload>
<ocr-upload ref="uploadFile1" :disabled="disabled" :accept="accept" :listType='listType' @uploadSuccess="uploadSuccess"></ocr-upload>
</a-card>
</div>
@@ -156,7 +156,7 @@
accept:'application/pdf',
today:'',
timer:'',
title:this.$t('UploadFile'),
uploadTitle:this.$t('UploadFile'),
listType:'text',
token:Vue.ls.get(ACCESS_TOKEN),
websock: null,
@@ -355,13 +355,18 @@
},
//上传文件
uploadSuccess(data) {
console.log('data11',data)
let attIdList = []
let attNameList = []
if(data && data.length > 0){
data.forEach(item => {
attIdList.push(item.id || data.name)
attNameList.push(itme.fileName)
})
this.form.attId = attIdList.join(',')
this.form.fileName=attNameList.join(',')
}
this.$refs.uploadFile1.visible=false
},
fileUpload(){
@@ -411,6 +416,7 @@
addFormClick() {
this.fileVisible = false
},
},
beforeDestroy(){
},
@@ -182,7 +182,7 @@
},
//导入按钮
tableExport(){
console.log('rows',this.rows)
// console.log('rows',this.rows)
if(this.rows&&this.rows.length>1){
this.$message.warning(this.$t('OnlyOneSelected'))
}else if(this.rows==undefined||this.rows.length===0){
@@ -216,6 +216,8 @@
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'))
}
@@ -42,9 +42,9 @@
<a-form-model-item :label="$t('name')" prop="name" v-if="dictVal=='tree'">
<a-input v-model="form.name" :placeholder="$t('enterName')" />
</a-form-model-item>
<a-form-model-item :label="$t('DataValue')" prop="itemValue">
<a-input v-model="form.itemValue" :placeholder="$t('enterDataValue')" />
</a-form-model-item>
<!-- <a-form-model-item :label="$t('DataValue')" prop="itemValue">-->
<!-- <a-input v-model="form.itemValue" :placeholder="$t('enterDataValue')" />-->
<!-- </a-form-model-item>-->
<a-form-model-item :label="$t('enName')" prop="enName">
<a-input v-model="form.enName" :placeholder="$t('PleaseEnterYourEnglishName')" />
</a-form-model-item>
@@ -103,10 +103,10 @@
{ required: true, message: this.$t('enterName'), trigger: 'blur' },
{ min:1, max: 30, message: this.$t('cantExeed')+'30'+this.$t('characters'), trigger: 'blur' },
],
itemValue:[
{ required: true, message: this.$t('enterDataValue'), trigger: 'blur' },
{ min:1, max: 30, message: this.$t('cantExeed')+'30'+this.$t('characters'), trigger: 'blur' },
],
// itemValue:[
// { required: true, message: this.$t('enterDataValue'), trigger: 'blur' },
// { min:1, max: 30, message: this.$t('cantExeed')+'30'+this.$t('characters'), trigger: 'blur' },
// ],
enName:[
{ required: true, message: this.$t('PleaseEnterYourEnglishName'), trigger: 'blur' },
{ min:1, max: 50, message: this.$t('cantExeed')+'50'+this.$t('characters'), trigger: 'blur' },