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> <span class="title-text-text">{{item.db_field_txt}}</span>
</div> </div>
<a-form-model-item class="itemModel" :prop="item.db_field_name"> <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)"> @click="clickButtonToUpload(item.db_field_name)">
{{ (formInline[item.db_field_name] === 'null' || formInline[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') formInline[item.db_field_name] == null) ? $t('clickUpload') : $t('viewUploadedFiles')
}} }}
</a-button> </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> </a-form-model-item>
</div> </div>
</a-col> </a-col>
@@ -263,7 +266,9 @@
ruleList: [], ruleList: [],
validatorRules: {}, validatorRules: {},
confirmLoading: false, confirmLoading: false,
uploadName: '' uploadName: '',
fileName:{},
} }
}, },
mounted() { mounted() {
@@ -271,7 +276,7 @@
}, },
methods: { methods: {
sumber() { sumber() {
// console.log('vilidate',this.formInline) console.log('vilidate',this.formInline)
this.$refs.ruleForm1.validate(valid => { this.$refs.ruleForm1.validate(valid => {
if (valid) { if (valid) {
let url = '' let url = ''
@@ -302,21 +307,30 @@
uploadSuccess(data) { uploadSuccess(data) {
// console.log(data) // console.log(data)
let attIdList = [] let attIdList = []
let attNameList=[]
if(data && data.length>0){ if(data && data.length>0){
data.map(item => { data.map(item => {
attIdList.push(item.id || data.name) attIdList.push(item.id || data.name)
attNameList.push(item.fileName)
}) })
/** 赋值给当前对应的表单文件 */ /** 赋值给当前对应的表单文件 */
this.formInline[this.uploadName] = attIdList.join(',') this.formInline[this.uploadName] = attIdList.join(',')
this.fileName[this.uploadName]=attNameList.join(',')
this.formInline = { ...this.formInline } this.formInline = { ...this.formInline }
this.$refs.uploadFile.visible = false
// console.log('form',this.formInline) // console.log('form',this.formInline)
}else{ }else{
this.formInline[this.uploadName]='' this.formInline[this.uploadName]=''
this.fileName[this.uploadName]=''
this.formInline = { ...this.formInline } this.formInline = { ...this.formInline }
// console.log('form',this.formInline) // console.log('form',this.formInline)
} }
}, },
//关闭上传弹框
closeUpload(){
// this.fileVisible = false
},
handleInput(value) { handleInput(value) {
this.$nextTick(() => { this.$nextTick(() => {
this.formInline = { ...this.formInline } this.formInline = { ...this.formInline }
+5 -1
View File
@@ -26,7 +26,7 @@
import { ACCESS_TOKEN } from "@/store/mutation-types" import { ACCESS_TOKEN } from "@/store/mutation-types"
export default { export default {
name: 'ocrUpload', name: 'ocrUpload',
props:['disableds','disabled','thisFileUploadUrl','readonly','thisFileType','accept','title','listType'], props:['disableds','disabled','thisFileUploadUrl','readonly','thisFileType','accept','listType'],
data(){ data(){
return{ return{
visible:false, visible:false,
@@ -36,12 +36,14 @@
fileList:[], fileList:[],
fileTypeSatus:false, fileTypeSatus:false,
headers:{}, headers:{},
title:this.$t('UploadFile'),
} }
}, },
created(){ created(){
const token = Vue.ls.get(ACCESS_TOKEN); const token = Vue.ls.get(ACCESS_TOKEN);
this.headers = {"X-Access-Token":token}; this.headers = {"X-Access-Token":token};
this.containerId = 'container-ty-'+new Date().getTime(); this.containerId = 'container-ty-'+new Date().getTime();
// console.log('title',this.title)
}, },
mounted(){ mounted(){
// console.log(this.thisFileType,this.thisFileSize,this.thisFileUploadUrl); // console.log(this.thisFileType,this.thisFileSize,this.thisFileUploadUrl);
@@ -115,6 +117,7 @@
}) })
// console.log('file1111',this.fileList) // console.log('file1111',this.fileList)
this.$emit('uploadSuccess', this.fileList) this.$emit('uploadSuccess', this.fileList)
this.$message.destroy() this.$message.destroy()
this.$message.error('最多只能上传一个文件'); this.$message.error('最多只能上传一个文件');
return return
@@ -131,6 +134,7 @@
if(this.myfileList.length > 0){ if(this.myfileList.length > 0){
this.$emit('uploadSuccess', this.fileList) this.$emit('uploadSuccess', this.fileList)
// console.log('fileList111',this.fileList)
this.$message.destroy() this.$message.destroy()
this.$message.success(`${info.file.name} 文件上传成功。`); this.$message.success(`${info.file.name} 文件上传成功。`);
} }
@@ -78,7 +78,7 @@
</div> </div>
<doc-table v-if="drawVisible" :drawVisible="drawVisible" :drawTableSorce="drawTableSorce" @visible="docVisible" @exportVisible="exportVisible"></doc-table> <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> </a-card>
</div> </div>
@@ -156,7 +156,7 @@
accept:'application/pdf', accept:'application/pdf',
today:'', today:'',
timer:'', timer:'',
title:this.$t('UploadFile'), uploadTitle:this.$t('UploadFile'),
listType:'text', listType:'text',
token:Vue.ls.get(ACCESS_TOKEN), token:Vue.ls.get(ACCESS_TOKEN),
websock: null, websock: null,
@@ -355,13 +355,18 @@
}, },
//上传文件 //上传文件
uploadSuccess(data) { uploadSuccess(data) {
console.log('data11',data)
let attIdList = [] let attIdList = []
let attNameList = []
if(data && data.length > 0){ if(data && data.length > 0){
data.forEach(item => { data.forEach(item => {
attIdList.push(item.id || data.name) attIdList.push(item.id || data.name)
attNameList.push(itme.fileName)
}) })
this.form.attId = attIdList.join(',') this.form.attId = attIdList.join(',')
this.form.fileName=attNameList.join(',')
} }
this.$refs.uploadFile1.visible=false
}, },
fileUpload(){ fileUpload(){
@@ -411,6 +416,7 @@
addFormClick() { addFormClick() {
this.fileVisible = false this.fileVisible = false
}, },
}, },
beforeDestroy(){ beforeDestroy(){
}, },
@@ -182,7 +182,7 @@
}, },
//导入按钮 //导入按钮
tableExport(){ tableExport(){
console.log('rows',this.rows) // console.log('rows',this.rows)
if(this.rows&&this.rows.length>1){ if(this.rows&&this.rows.length>1){
this.$message.warning(this.$t('OnlyOneSelected')) this.$message.warning(this.$t('OnlyOneSelected'))
}else if(this.rows==undefined||this.rows.length===0){ }else if(this.rows==undefined||this.rows.length===0){
@@ -216,6 +216,8 @@
if (res.success) { if (res.success) {
this.$message.success(this.$t('OperationSuccessful')) this.$message.success(this.$t('OperationSuccessful'))
eventBUs.$emit('searchReset') eventBUs.$emit('searchReset')
this.visible = false;
this.$emit('visible',false)
} else { } else {
this.$message.warning(this.$t('operationFailed')) this.$message.warning(this.$t('operationFailed'))
} }
@@ -42,9 +42,9 @@
<a-form-model-item :label="$t('name')" prop="name" v-if="dictVal=='tree'"> <a-form-model-item :label="$t('name')" prop="name" v-if="dictVal=='tree'">
<a-input v-model="form.name" :placeholder="$t('enterName')" /> <a-input v-model="form.name" :placeholder="$t('enterName')" />
</a-form-model-item> </a-form-model-item>
<a-form-model-item :label="$t('DataValue')" prop="itemValue"> <!-- <a-form-model-item :label="$t('DataValue')" prop="itemValue">-->
<a-input v-model="form.itemValue" :placeholder="$t('enterDataValue')" /> <!-- <a-input v-model="form.itemValue" :placeholder="$t('enterDataValue')" />-->
</a-form-model-item> <!-- </a-form-model-item>-->
<a-form-model-item :label="$t('enName')" prop="enName"> <a-form-model-item :label="$t('enName')" prop="enName">
<a-input v-model="form.enName" :placeholder="$t('PleaseEnterYourEnglishName')" /> <a-input v-model="form.enName" :placeholder="$t('PleaseEnterYourEnglishName')" />
</a-form-model-item> </a-form-model-item>
@@ -103,10 +103,10 @@
{ required: true, message: this.$t('enterName'), trigger: 'blur' }, { required: true, message: this.$t('enterName'), trigger: 'blur' },
{ min:1, max: 30, message: this.$t('cantExeed')+'30'+this.$t('characters'), trigger: 'blur' }, { min:1, max: 30, message: this.$t('cantExeed')+'30'+this.$t('characters'), trigger: 'blur' },
], ],
itemValue:[ // itemValue:[
{ required: true, message: this.$t('enterDataValue'), trigger: 'blur' }, // { required: true, message: this.$t('enterDataValue'), trigger: 'blur' },
{ min:1, max: 30, message: this.$t('cantExeed')+'30'+this.$t('characters'), trigger: 'blur' }, // { min:1, max: 30, message: this.$t('cantExeed')+'30'+this.$t('characters'), trigger: 'blur' },
], // ],
enName:[ enName:[
{ required: true, message: this.$t('PleaseEnterYourEnglishName'), trigger: 'blur' }, { required: true, message: this.$t('PleaseEnterYourEnglishName'), trigger: 'blur' },
{ min:1, max: 50, message: this.$t('cantExeed')+'50'+this.$t('characters'), trigger: 'blur' }, { min:1, max: 50, message: this.$t('cantExeed')+'50'+this.$t('characters'), trigger: 'blur' },