ocr修改
This commit is contained in:
@@ -169,15 +169,33 @@
|
||||
<span class="title-text-text">{{item.db_field_txt}}</span>
|
||||
</div>
|
||||
<a-form-model-item class="itemModel" :prop="item.db_field_name">
|
||||
<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-upload
|
||||
name="file"
|
||||
:accept='accept'
|
||||
:list-type="listType"
|
||||
:file-list="myfileList"
|
||||
:multiple="false"
|
||||
:action="uploadAction+'?state='+state"
|
||||
:headers="headers"
|
||||
:before-upload="beforeUpload"
|
||||
@change="handleChange"
|
||||
>
|
||||
<a-button>
|
||||
<a-icon type="upload"/>
|
||||
{{$t('UploadFile')}}
|
||||
</a-button>
|
||||
</a-upload>
|
||||
|
||||
|
||||
<!-- <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>
|
||||
@@ -212,23 +230,25 @@
|
||||
</a-col>
|
||||
</div>
|
||||
</a-row>
|
||||
<uploadFile ref="uploadFile" :accept="accept" :disabled="disabled" @uploadSuccess="uploadSuccess"></uploadFile>
|
||||
<!-- <uploadFile ref="uploadFile" :accept="accept" :disabled="disabled" @uploadSuccess="uploadSuccess"></uploadFile>-->
|
||||
</a-form-model>
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import uploadFile from '@/components/OcrUpload/index'
|
||||
// import uploadFile from '@/components/OcrUpload/index'
|
||||
import PersonnelSelection from '@/components/PersonnelSelection/index'
|
||||
import Standardselection from '@/components/Standardselection/index'
|
||||
import { getAction, postAction } from '@/api/manage'
|
||||
import eventBUs from '../../common/event'
|
||||
import moment from 'moment'
|
||||
import Vue from 'vue'
|
||||
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||
|
||||
export default {
|
||||
name: 'ocrAddForm',
|
||||
components: {
|
||||
uploadFile,
|
||||
// uploadFile,
|
||||
Standardselection,
|
||||
PersonnelSelection
|
||||
},
|
||||
@@ -244,14 +264,17 @@
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
accept:{
|
||||
type:String,
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
uploadAction: window._CONFIG['domianURL'] + '/sys/common/upload',
|
||||
listType: 'text',
|
||||
accept: 'application/pdf',
|
||||
state: undefined,
|
||||
formInline: {},
|
||||
myfileList: [],
|
||||
headers: {},
|
||||
isFormInline: false,
|
||||
rules: {},
|
||||
labelCol: {
|
||||
@@ -267,16 +290,50 @@
|
||||
validatorRules: {},
|
||||
confirmLoading: false,
|
||||
uploadName: '',
|
||||
fileName:{},
|
||||
fileName: {}
|
||||
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const token = Vue.ls.get(ACCESS_TOKEN)
|
||||
this.headers = { 'X-Access-Token': token }
|
||||
this.getForm()
|
||||
},
|
||||
methods: {
|
||||
handleChange(info) {
|
||||
if (info.file.status !== 'uploading') {
|
||||
// console.log(info.file, info.fileList)
|
||||
}
|
||||
if (info.file.status === 'done') {
|
||||
console.log('info', info)
|
||||
this.fileList = []
|
||||
this.myfileList = info.fileList
|
||||
this.formInline.attId = info.file.response.result.id
|
||||
this.$message.success(`${info.file.name}上传成功`)
|
||||
}else if (info.file.status === 'error') {
|
||||
this.$message.error(`${info.file.name}上传失败`)
|
||||
} else if (info.file.status === 'uploading') {
|
||||
this.myfileList = info.fileList
|
||||
// console.log(info.file, info.fileList)
|
||||
}
|
||||
|
||||
},
|
||||
beforeUpload(file, fileList) {
|
||||
if (this.myfileList && this.myfileList.length >= 1) {
|
||||
this.$message.warning('只能上传一个文件')
|
||||
return false
|
||||
} else {
|
||||
// let thisFileType = this.thisFileType.replace(/\s+/g, "");
|
||||
if (file.type == this.accept) {
|
||||
this.fileTypeSatus = true
|
||||
this.$message.destroy()
|
||||
// 207M.doc文件大小超出100MB限制, 请压缩或降低文件质量!
|
||||
this.errorMessage = file.name + '文件大小超出100MB限制, 请压缩或降低文件质量!'
|
||||
}
|
||||
}
|
||||
},
|
||||
sumber() {
|
||||
console.log('vilidate',this.formInline)
|
||||
console.log('vilidate', this.formInline)
|
||||
this.$refs.ruleForm1.validate(valid => {
|
||||
if (valid) {
|
||||
let url = ''
|
||||
@@ -307,28 +364,28 @@
|
||||
uploadSuccess(data) {
|
||||
// console.log(data)
|
||||
let attIdList = []
|
||||
let attNameList=[]
|
||||
if(data && data.length>0){
|
||||
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.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]=''
|
||||
} else {
|
||||
this.formInline[this.uploadName] = ''
|
||||
this.fileName[this.uploadName] = ''
|
||||
this.formInline = { ...this.formInline }
|
||||
// console.log('form',this.formInline)
|
||||
|
||||
}
|
||||
},
|
||||
//关闭上传弹框
|
||||
closeUpload(){
|
||||
closeUpload() {
|
||||
// this.fileVisible = false
|
||||
},
|
||||
handleInput(value) {
|
||||
@@ -349,13 +406,13 @@
|
||||
message: res.db_field_txt + '不能为空',
|
||||
trigger: 'blur'
|
||||
})
|
||||
if(res.db_field_name=='standNumber'){
|
||||
if (res.db_field_name == 'standNumber') {
|
||||
rule.push(
|
||||
{ min:1, max: 200, message: this.$t('cantExeed')+'200'+this.$t('characters'), trigger: 'blur' },
|
||||
{ min: 1, max: 200, message: this.$t('cantExeed') + '200' + this.$t('characters'), trigger: 'blur' }
|
||||
)
|
||||
}else if(res.db_field_name=='standName'){
|
||||
} else if (res.db_field_name == 'standName') {
|
||||
rule.push(
|
||||
{ min:1, max: 200, message: this.$t('cantExeed')+'200'+this.$t('characters'), trigger: 'blur' },
|
||||
{ min: 1, max: 200, message: this.$t('cantExeed') + '200' + this.$t('characters'), trigger: 'blur' }
|
||||
)
|
||||
}
|
||||
|
||||
@@ -384,7 +441,7 @@
|
||||
message: res.db_field_txt + '不能为空',
|
||||
trigger: 'change'
|
||||
})
|
||||
}else if (res.field_show_type === '7') {
|
||||
} else if (res.field_show_type === '7') {
|
||||
rule.push({
|
||||
required: true,
|
||||
message: res.db_field_txt + '不能为空',
|
||||
@@ -429,7 +486,7 @@
|
||||
}
|
||||
})
|
||||
},
|
||||
add(){
|
||||
add() {
|
||||
this.formInline = {}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user