Commit 795e75aa authored by Jennie Shi's avatar Jennie Shi

OCR识别

parent 173280dc
......@@ -11,7 +11,7 @@
"PACKAGE_NAME": "com.xcmg.app.dev"
},
"cordova-plugin-baidumaplocation": {
"ANDROID_KEY": "q4W0FynBkTd4v44ZM8m4MxUpuXBqGIqQ",
"ANDROID_KEY": "Y8gTWgN2GuDtvhBfiECaZiBtE6i0wQBG",
"IOS_KEY": "hhouKKwxALvC7MBZmnfwgSacHOfFOlNu",
"IOS_LOCATION_DESC": "请点击'好'以允许访问。",
"PACKAGE_NAME": "com.xcmg.app.dev"
......
......@@ -89,7 +89,7 @@
},
"is_top_level": true,
"variables": {
"ANDROID_KEY": "q4W0FynBkTd4v44ZM8m4MxUpuXBqGIqQ",
"ANDROID_KEY": "Y8gTWgN2GuDtvhBfiECaZiBtE6i0wQBG",
"IOS_KEY": "hhouKKwxALvC7MBZmnfwgSacHOfFOlNu",
"IOS_LOCATION_DESC": "请点击'好'以允许访问。"
}
......
......@@ -55,7 +55,7 @@
</item>
<item v-if="!isReadOnly" class="date-check" @click.native="showTime1('YYYY-MM-DD')">
<div slot="name" class="required">发车日期</div>
<input slot="content" v-model="rentInfo.departure_date" :readonly="isReadOnly" placeholder="请选择发车日期" >
<input slot="content" v-model="rentInfo.departure_date" readonly placeholder="请选择发车日期" >
</item>
<item v-if="isReadOnly" class="date-check">
<div slot="name" class="required">开票日期</div>
......@@ -63,7 +63,7 @@
</item>
<item v-if="!isReadOnly" class="date-check" @click.native="showTime2('YYYY-MM-DD')">
<div slot="name" class="required">开票日期</div>
<input slot="content" v-model="rentInfo.invoice_date" :readonly="isReadOnly" placeholder="请选择开票日期" >
<input slot="content" v-model="rentInfo.invoice_date" readonly placeholder="请选择开票日期" >
</item>
<button v-if="!isReadOnly" class="type-save" @click="saveRent()">保存</button>
</list-item>
......@@ -459,6 +459,7 @@ export default {
productLine: [], // 产品线
factory_ocr_type: '',
certificationType: '',
uploadList: [], // 附件上传
rentInfo: {
project_lease_item_id: '',
frame_number: '',
......@@ -635,7 +636,7 @@ export default {
title: '提示',
content: '您确认删除吗?',
onConfirm: (index2) => {
if (index2 == 1) {
if (index2 === 1) {
let url = process.env.basePath + 'prj_leases_info_delete'
let param = {
project_lease_item_id: project_lease_item_id,
......@@ -652,44 +653,6 @@ export default {
},
})
},
// 图片保存
save_picture (list) {
let vm = this
if (list.length) {
// hlsPopup.showLoading('图片上传请稍候')
var alreadyUploadNum = 0
var attLength = 0
var recordUploadInterval = setInterval(function () {
if (alreadyUploadNum === attLength) {
clearInterval(recordUploadInterval)
hlsPopup.hideLoading()
// hlsPopup.showLongCenter('图片上传成功')
}
}, 500)
for (var i = 0; i < list.length; i++) {
let uploadSuccess = function (res) {
if (res.result === 'S') {
alreadyUploadNum++
for (var j = 0; j < list.length; j++) {
if (list[j].filePath === res.response.filePath) {
list[j].attachment_id = res.response.attachment_id
vm.upload_list.push(list[j])
break
}
}
} else {
hlsPopup.hideLoading()
}
}
if (!list[i].attachment_id) {
attLength++
hlsUtil.fileUploadSvc(list[i], uploadSuccess)
}
}
} else {
hlsPopup.hideLoading()
}
},
// 查看大图
showBigPicture (pic) {
let vm = this
......@@ -729,17 +692,17 @@ export default {
},
saveRent () {
let url = process.env.basePath + 'prj_leases_info_save'
if (this.rentInfo.frame_number == '') {
if (this.rentInfo.frame_number === '') {
hlsPopup.showLongCenter('车架号不能为空!')
} else if (this.rentInfo.engine == '') {
} else if (this.rentInfo.engine === '') {
hlsPopup.showLongCenter('发动机号不能为空!')
} else if (this.rentInfo.vehicle_model == '') {
} else if (this.rentInfo.vehicle_model === '') {
hlsPopup.showLongCenter('车辆型号不能为空!')
} else if (this.rentInfo.certificate_number == '') {
} else if (this.rentInfo.certificate_number === '') {
hlsPopup.showLongCenter('合格证编号不能为空!')
} else if (this.rentInfo.departure_date == '') {
} else if (this.rentInfo.departure_date === '') {
hlsPopup.showLongCenter('发车日期不能为空!')
} else if (this.rentInfo.invoice_date == '') {
} else if (this.rentInfo.invoice_date === '') {
hlsPopup.showLongCenter('开票日期不能为空!')
} else {
let param = {
......@@ -760,9 +723,11 @@ export default {
hlsPopup.showLongCenter('保存成功')
this.downNum = false
this.rentInfo.project_lease_item_id = res.master.project_lease_item_id
this.uploadList[0].pkvalue = this.rentInfo.project_lease_item_id
this.savePicture(this.uploadList)
let ifPush = true
this.leaseList.forEach(item => {
if (item.project_lease_item_id == res.master.project_lease_item_id) {
if (item.project_lease_item_id === res.master.project_lease_item_id) {
ifPush = false
}
})
......@@ -817,6 +782,14 @@ export default {
width: 1843,
height: 1382,
}
let obj = {
pkvalue: '',
source_type: 'PRJ_PROJECT_LEASE_ITEM',
filePath: '',
attachment_id: '',
user_id: 1,
fileName: '合格证',
}
let success = function (imgdata) {
if (!imgdata) {
hlsPopup.showLongCenter('请拍照')
......@@ -824,6 +797,9 @@ export default {
vm.isUpload = true
vm.vehicleImg = hlsUtil.convertImageUrl(imgdata)
vm.vehicleIdentify(imgdata)
obj.filePath = imgdata
vm.uploadList = []
vm.uploadList.push(imgdata)
}
}
let error = function () {
......@@ -839,13 +815,24 @@ export default {
height: 1382,
maxCount: 1,
}
let obj = {
pkvalue: '',
source_type: 'PRJ_PROJECT_LEASE_ITEM',
filePath: '',
attachment_id: '',
user_id: 1,
fileName: '合格证',
}
let success = function (imgUrl) {
if (imgUrl.length === 0) {
hlsPopup.showLongCenter('请选择一张图片')
} else {
vm.isUpload = true
vm.vehicleImg = hlsUtil.convertImageUrl(imgUrl[0])
obj.filePath = imgUrl[0]
vm.vehicleIdentify(imgUrl[0])
vm.uploadList = []
vm.uploadList.push(obj)
}
}
let error = function () {
......@@ -858,27 +845,38 @@ export default {
let vm = this
hlsPopup.showLoading('正在识别...')
let url
if (this.certificationType == 'NORMAL') {
if (vm.certificationType === 'NORMAL') {
url = process.env.ocrPath + '/baidu/ocr/vehicle_certificate'
} else if (this.certificationType == 'CHANYUN') {
} else if (vm.certificationType === 'CHANYUN') {
url = process.env.ocrPath + '/baidu/ocr/chanyun'
} else if (this.certificationType == 'DAOLU') {
} else if (vm.certificationType === 'DAOLU') {
url = process.env.ocrPath + '/baidu/ocr/daolu'
}
console.log('OCR识别URL:' + url)
hlsUtil.baiduOcr(fileUrl, url, function (res) {
hlsPopup.hideLoading()
console.log('OCR识别结果:' + JSON.stringify(res))
let result = res.result.words_result
vm.rentInfo.frame_number = result.VinNo // 车架号
vm.rentInfo.engine = result.EngineNo // 发动机号
vm.rentInfo.vehicle_model = result.VinNo // 车辆型号
vm.rentInfo.certificate_number = result.CertificationNo // 合格证编号
if (vm.certificationType === 'NORMAL') {
let result = res.result.words_result
vm.rentInfo.frame_number = result.VinNo // 车架号
vm.rentInfo.engine = result.EngineNo // 发动机号
vm.rentInfo.vehicle_model = result.VinNo // 车辆型号
vm.rentInfo.certificate_number = result.CertificationNo // 合格证编号
} else if (vm.certificationType === 'DAOLU' || vm.certificationType === 'CHANYUN') {
let result = res.result.data
vm.rentInfo.frame_number = result.vehicle_number.word // 车架号
vm.rentInfo.engine = result.engine_number.word // 发动机号
vm.rentInfo.vehicle_model = result.car_model.word // 车辆型号
vm.rentInfo.certificate_number = ''
}
vm.rentInfo.project_lease_item_id = ''
vm.rentInfo.departure_date = ''
vm.rentInfo.invoice_date = ''
})
},
// 图片保存
save_picture (list) {
let vm = this
savePicture (list) {
// let vm = this
if (list.length) {
// hlsPopup.showLoading('图片上传请稍候')
var alreadyUploadNum = 0
......@@ -897,7 +895,6 @@ export default {
for (var j = 0; j < list.length; j++) {
if (list[j].filePath === res.response.filePath) {
list[j].attachment_id = res.response.attachment_id
vm.upload_list.push(list[j])
break
}
}
......
......@@ -9,7 +9,7 @@
</div>
<div class="down-content">
<span>请上传照片</span>
<div class="photo" @click="ocrShow()">
<div class="photo" @click="pickMethod()">
<img v-if="vehicleImg" :src="vehicleImg" alt="">
</div>
<list-item :item-height="44">
......@@ -333,6 +333,7 @@ export default {
},
equip: [],
vehicleImg: '',
vehicleImgUpload: '',
}
},
computed: {
......@@ -429,6 +430,26 @@ export default {
}
})
},
// 选择识别类型
pickMethod () {
let vm = this
hlsPopup.showActionSheet({
titleText: '请选择证件类型',
buttonArray: ['徐工重型合格证', '车辆登记证', '出厂合格证'],
callback: index => {
if (index === 0) {
vm.certificationType = 'NORMAL'
vm.ocrShow()
} else if (index === 1) {
vm.certificationType = 'DAOLU'
vm.ocrShow()
} else if (index === 2) {
vm.certificationType = 'CHANYUN'
vm.ocrShow()
}
},
})
},
// ocr识别入口
ocrShow () {
let vm = this
......@@ -457,6 +478,7 @@ export default {
} else {
vm.isUpload = true
vm.vehicleImg = hlsUtil.convertImageUrl(imgdata)
vm.vehicleImgUpload = imgdata
vm.vehicleIdentify(imgdata)
}
}
......@@ -479,8 +501,7 @@ export default {
} else {
vm.isUpload = true
vm.vehicleImg = hlsUtil.convertImageUrl(imgUrl[0])
console.log('$$$$$$$$$$$$$$$1' + imgUrl[0])
console.log('$$$$$$$$$$$$$$$2' + vm.vehicleImg)
vm.vehicleImgUpload = imgUrl[0]
vm.vehicleIdentify(imgUrl[0])
}
}
......@@ -493,15 +514,33 @@ export default {
vehicleIdentify (fileUrl) {
let vm = this
hlsPopup.showLoading('正在识别')
let url = process.env.ocrPath + '/baidu/ocr/vehicle_certificate'
let url
if (vm.certificationType === 'NORMAL') {
url = process.env.ocrPath + '/baidu/ocr/vehicle_certificate'
} else if (vm.certificationType === 'CHANYUN') {
url = process.env.ocrPath + '/baidu/ocr/chanyun'
} else if (vm.certificationType === 'DAOLU') {
url = process.env.ocrPath + '/baidu/ocr/daolu'
}
hlsUtil.baiduOcr(fileUrl, url, function (res) {
hlsPopup.hideLoading()
console.log('$$$$$$$$$$$$$$$' + JSON.stringify(res))
let result = res.result.words_result
vm.info.frame_number = result.VinNo // 车架号
vm.info.engine = result.EngineNo // 发动机号
vm.vehicle_model = result.VinNo // 车辆型号
vm.info.certificate_number = result.CertificationNo // 合格证编号
if (vm.certificationType === 'NORMAL') {
let result = res.result.words_result
vm.info.frame_number = result.VinNo // 车架号
vm.info.engine = result.EngineNo // 发动机号
vm.vehicle_model = result.VinNo // 车辆型号
vm.info.certificate_number = result.CertificationNo // 合格证编号
} else if (vm.certificationType === 'DAOLU' || vm.certificationType === 'CHANYUN') {
let result = res.result.data
vm.info.frame_number = result.vehicle_number.word // 车架号
vm.info.engine = result.engine_number.word // 发动机号
vm.info.vehicle_model = result.car_model.word // 车辆型号
vm.info.certificate_number = ''
}
vm.info.project_lease_item_id = ''
vm.info.departure_date = ''
vm.info.invoice_date = ''
})
},
// 图片保存
......@@ -589,7 +628,7 @@ export default {
source_type: 'CON_CONTRACT_LEASE_ITEM',
picture: '',
check_id: vm.contract_lease_item_id,
filePath: vm.vehicleImg,
filePath: vm.vehicleImgUpload,
attachment_id: '',
user_id: 1,
fileName: '合格证',
......
......@@ -496,17 +496,14 @@ export default {
options.fileName = name
options.mimeType = 'multipart/form-date'
let ft = new FileTransfer() // eslint-disable-line
function uploadSuccess (message) {
let res = JSON.parse(message.response)
console.log(JSON.stringify(res, '', 2))
success(res)
}
function error (e) {
this.hlsPopup.showLongCenter('识别失败')
}
ft.upload(path, url, uploadSuccess, error, options)
},
/**
......
<<<<<<< HEAD
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no,width=device-width,viewport-fit=cover"><meta name=format-detection content="telephone=no"><meta name=format-detection content="email=no"><meta name=apple-mobile-web-app-capable content=yes><meta name=apple-mobile-web-app-status-bar-style content=black><script type=text/javascript src=./static/vuePlatform.js></script><script type=text/javascript src=./static/prototype.js></script><script type=text/javascript src=./cordova.js></script><script type=text/javascript src="http://api.map.baidu.com/api?v=2.0&ak=Eoo0EtfjYCdAy7r8D19gZ0vMojdZpHqU"></script><title>徐工金服</title><link href=./static/css/app.21cb7156819074159aa9d1a495e4c824.css rel=stylesheet></head><body><div id=app-box></div><script type=text/javascript src=./static/js/manifest.6a178e8d77c32e3c385d.js></script><script type=text/javascript src=./static/js/vendor.0a4e11017ea45af58444.js></script><script type=text/javascript src=./static/js/app.d68c1669329a2605172e.js></script></body></html>
=======
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no,width=device-width,viewport-fit=cover"><meta name=format-detection content="telephone=no"><meta name=format-detection content="email=no"><meta name=apple-mobile-web-app-capable content=yes><meta name=apple-mobile-web-app-status-bar-style content=black><script type=text/javascript src=./static/vuePlatform.js></script><script type=text/javascript src=./static/prototype.js></script><script type=text/javascript src=./cordova.js></script><script type=text/javascript src="http://api.map.baidu.com/api?v=2.0&ak=Eoo0EtfjYCdAy7r8D19gZ0vMojdZpHqU"></script><title>徐工金服</title><link href=./static/css/app.78435f9c748840b587c68e5ff0674abe.css rel=stylesheet></head><body><div id=app-box></div><script type=text/javascript src=./static/js/manifest.6a178e8d77c32e3c385d.js></script><script type=text/javascript src=./static/js/vendor.d1d652612de8a132d4e5.js></script><script type=text/javascript src=./static/js/app.2f217eda99a2e9b0949d.js></script></body></html>
>>>>>>> bd6801eb470716e53e6e672ef73511511d752666
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no,width=device-width,viewport-fit=cover"><meta name=format-detection content="telephone=no"><meta name=format-detection content="email=no"><meta name=apple-mobile-web-app-capable content=yes><meta name=apple-mobile-web-app-status-bar-style content=black><script type=text/javascript src=./static/vuePlatform.js></script><script type=text/javascript src=./static/prototype.js></script><script type=text/javascript src=./cordova.js></script><script type=text/javascript src="http://api.map.baidu.com/api?v=2.0&ak=Eoo0EtfjYCdAy7r8D19gZ0vMojdZpHqU"></script><title>徐工金服</title><link href=./static/css/app.10e2a1c052ab479339a0d0d8b3e6c83f.css rel=stylesheet></head><body><div id=app-box></div><script type=text/javascript src=./static/js/manifest.6a178e8d77c32e3c385d.js></script><script type=text/javascript src=./static/js/vendor.0a4e11017ea45af58444.js></script><script type=text/javascript src=./static/js/app.52b46817f414a3e1002b.js></script></body></html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment