车辆添加ocr识别,添加牌照
This commit is contained in:
@ -110,6 +110,28 @@
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
||||
</div>
|
||||
<div class="itemContent">
|
||||
<div class="titleType">
|
||||
<span>牌照</span>
|
||||
</div>
|
||||
<el-select
|
||||
v-model="vehicleLicense"
|
||||
disabled
|
||||
value-key="name"
|
||||
class="elSelect"
|
||||
collapse-tags="collapse-tags"
|
||||
placeholder="请选择" style="width: 55%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in vehicleLicenseOptions"
|
||||
:key="item.name"
|
||||
:label="item.name"
|
||||
:value="item.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
||||
</div>
|
||||
<div class="lineBot"></div>
|
||||
<div class="itemContent">
|
||||
@ -203,6 +225,7 @@ export default {
|
||||
vehicleLicenseInfo: {},
|
||||
vehicleLicenseBackOcrFlag: false, // 行驶证副页 修改时默认不需要 ocr识别
|
||||
isMultiple: false, // 是否支持多选
|
||||
vehicleLicense:'',//牌照
|
||||
vehicleTypes:[{
|
||||
name: '小修车',
|
||||
value: 1
|
||||
@ -236,6 +259,22 @@ export default {
|
||||
value: 10 },
|
||||
|
||||
],
|
||||
vehicleLicenseOptions: [{
|
||||
name: '蓝牌',
|
||||
value: 1
|
||||
}, {
|
||||
name: '黄牌',
|
||||
value: 2
|
||||
}, {
|
||||
name: '新能源',
|
||||
value: 3
|
||||
}, {
|
||||
name: '临牌',
|
||||
value: 4
|
||||
}, {
|
||||
name: '其他',
|
||||
value: 5
|
||||
}]
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
@ -281,6 +320,19 @@ export default {
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
getVehicleLicense(color) {
|
||||
if( color == '蓝' ) {
|
||||
this.vehicleLicense = 1
|
||||
} else if(color == '黄') {
|
||||
this.vehicleLicense = 2
|
||||
} else if(color == '临牌') {
|
||||
this.vehicleLicense = 4
|
||||
} else if(color.includes('绿')) {
|
||||
this.vehicleLicense = 3
|
||||
} else {
|
||||
this.vehicleLicense = 5
|
||||
}
|
||||
},
|
||||
async vehicleLicenseFrontHandler(file) { // 上传 行驶证首页
|
||||
const formData = new FormData();
|
||||
formData.append("file" , file.file);
|
||||
@ -307,6 +359,16 @@ export default {
|
||||
formData.append("file" , file.file);
|
||||
let res = await uploadImage(formData);
|
||||
this.vehicleFrontPhoto = res.data;
|
||||
await this.ocrCarFrontHandler()
|
||||
},
|
||||
async ocrCarFrontHandler() { // 车辆正面 orc 识别
|
||||
let res = await ocrHandler({
|
||||
ocrType: 10,
|
||||
imageUrl: this.vehicleFrontPhoto,
|
||||
cardSide: 'FRONT'
|
||||
});
|
||||
console.log('rerere', res.data.color)
|
||||
this.getVehicleLicense(res.data.color)
|
||||
},
|
||||
async vehicleOcrHandler() { // 行驶证首页 ocr 识别
|
||||
this.vehicleLicenseInfo.licensePlateNumber = '';
|
||||
@ -417,6 +479,7 @@ export default {
|
||||
this.vehicleFrontPhoto = result.vehicleFrontPhoto;
|
||||
this.vehicleLicenseInfo = result.vehicleLicenseInfo;
|
||||
this.vehicleLicenseCarPhoto = result.vehicleLicenseCarPhoto;
|
||||
this.vehicleLicense = result.vehicleLicense;
|
||||
if( this.vehicleLicenseFront ) {
|
||||
this.vehicleLicenseFrontList = [{ url : this.vehicleLicenseFront }];
|
||||
}
|
||||
@ -446,7 +509,7 @@ export default {
|
||||
this.$toast('行驶证车辆照片页不能为空')
|
||||
return
|
||||
}
|
||||
if( !this.vehicleLicenseBack ) {
|
||||
if( !this.vehicleFrontPhoto ) {
|
||||
this.$toast('车头照片不能为空')
|
||||
return
|
||||
}
|
||||
@ -477,6 +540,7 @@ export default {
|
||||
vehicleFrontPhoto: this.vehicleFrontPhoto,
|
||||
vehicleLicenseInfo: this.vehicleLicenseInfo,
|
||||
vehicleLicenseCarPhoto: this.vehicleLicenseCarPhoto,
|
||||
vehicleLicense: this.vehicleLicense,
|
||||
})
|
||||
if(this.id){
|
||||
this.$toast('修改成功')
|
||||
|
Reference in New Issue
Block a user