Compare commits

...
4 changed files with 167 additions and 23 deletions
+8
View File
@@ -18,6 +18,14 @@ export function saveVehicle(data){
data data
}) })
} }
//车辆属性预判(行驶证OCR识别出车辆所有人后调用,命中服务商信息则锁定为自有车辆)
export function preJudgeVirtualVehicle(data){
return request({
url:'/supplierAppV2/dispatchApp/user/preJudgeVirtualVehicle',
method:'POST',
data
})
}
//提交审批车辆信息 //提交审批车辆信息
export function saveSupplierApproval(data){ export function saveSupplierApproval(data){
return request({ return request({
+2 -2
View File
@@ -75,10 +75,10 @@
let res = await getContactQrCodeResult({ configId: this.configId, name: this.name }); let res = await getContactQrCodeResult({ configId: this.configId, name: this.name });
this.wechatId = res?.data?.wechatId; this.wechatId = res?.data?.wechatId;
} }
if (!this.wechatId) { /*if (!this.wechatId) {
Toast('请先添加企微再继续'); Toast('请先添加企微再继续');
return; return;
} }*/
try { try {
this.clickFlag = false; this.clickFlag = false;
const res = await saveSupplier({ const res = await saveSupplier({
+119 -6
View File
@@ -131,12 +131,13 @@
<img class="startImg" src="@/assets/start.png" /> <img class="startImg" src="@/assets/start.png" />
<span>车辆属性</span> <span>车辆属性</span>
</div> </div>
<div class="virtualVehicleField">
<el-select <el-select
v-model="virtualVehicle" v-model="virtualVehicle"
value-key="name" value-key="name"
class="elSelect" class="elSelect"
collapse-tags="collapse-tags" collapse-tags="collapse-tags"
:disabled="vehicleInfoDisabled" :disabled="vehicleInfoDisabled || virtualVehicleLocked"
placeholder="请选择" style="width: 55%" placeholder="请选择" style="width: 55%"
> >
<el-option <el-option
@@ -144,10 +145,16 @@
:key="item.name" :key="item.name"
:label="item.name" :label="item.name"
:value="item.value" :value="item.value"
:disabled="item.value == 1 && !virtualVehicleLocked"
> >
</el-option> </el-option>
</el-select> </el-select>
<span class="matchRoleArrow" :class="{expanded: matchRoleExpand}"
@click="matchRoleExpand = !matchRoleExpand"></span>
</div>
</div>
<div v-if="matchRoleExpand" class="matchRolePanel">
匹配角色{{ virtualVehicleMatchRole || '' }}
</div> </div>
<div class="lineBot"></div> <div class="lineBot"></div>
<div class="itemContent"> <div class="itemContent">
@@ -463,7 +470,7 @@
import {formatDate1} from "@/utils/common" import {formatDate1} from "@/utils/common"
import {myMixins} from "@/utils/myMixins" import {myMixins} from "@/utils/myMixins"
import {vehicleTypeList,saveVehicle,getInfoById,supplierServiceTree, uploadImage, ocrHandler, import {vehicleTypeList,saveVehicle,getInfoById,supplierServiceTree, uploadImage, ocrHandler,
userOperationPermissions,saveSupplierApproval} from "@/api/mine" userOperationPermissions,saveSupplierApproval,preJudgeVirtualVehicle as preJudgeVirtualVehicleApi} from "@/api/mine"
import TwoCommonBtn from "@/components/twoBtnCommon.vue" import TwoCommonBtn from "@/components/twoBtnCommon.vue"
import CellGroup from "@/components/cellGroup.vue"; import CellGroup from "@/components/cellGroup.vue";
export default { export default {
@@ -515,6 +522,9 @@ export default {
vehicleLicenseInfo: {}, vehicleLicenseInfo: {},
vehicleLicenseBackOcrFlag: false, // 行驶证副页 修改时默认不需要 ocr识别 vehicleLicenseBackOcrFlag: false, // 行驶证副页 修改时默认不需要 ocr识别
isMultiple: false, // 是否支持多选 isMultiple: false, // 是否支持多选
virtualVehicleLocked: false, // 车辆属性锁定(OCR所有人命中服务商信息时锁定为自有车辆)
virtualVehicleMatchRole: '', // 车辆属性自动判定命中的匹配角色
matchRoleExpand: false, // 匹配角色面板展开状态
vehicleLicense:'',//牌照 vehicleLicense:'',//牌照
vehicleFrontLicensePlate:'',//车头照车牌号码 vehicleFrontLicensePlate:'',//车头照车牌号码
insuranceCorp: '', insuranceCorp: '',
@@ -527,7 +537,7 @@ export default {
name: '一般平板车', name: '一般平板车',
value: 2 value: 2
},{ },{
name: '落地平板车', name: '落地平板车',
value: 3 value: 3
},{ },{
name: '地库车', name: '地库车',
@@ -551,6 +561,9 @@ export default {
{ {
name:'箱式拖车', name:'箱式拖车',
value: 10 }, value: 10 },
{
name:'斜落一体平板车',
value: 11 },
], ],
vehicleLicenseOptions: [{ vehicleLicenseOptions: [{
@@ -560,7 +573,7 @@ export default {
name: '黄牌', name: '黄牌',
value: 2 value: 2
}, { }, {
name: '新能源', name: '绿牌',
value: 3 value: 3
}, { }, {
name: '临牌', name: '临牌',
@@ -568,6 +581,9 @@ export default {
}, { }, {
name: '其他', name: '其他',
value: 5 value: 5
}, {
name: '黄绿牌',
value: 6
}], }],
virtualVehicleOptions: [{ virtualVehicleOptions: [{
name: '自有车辆', name: '自有车辆',
@@ -674,6 +690,7 @@ export default {
this.vehicleTypes[7].disabled=true this.vehicleTypes[7].disabled=true
this.vehicleTypes[8].disabled=true this.vehicleTypes[8].disabled=true
this.vehicleTypes[9].disabled=true this.vehicleTypes[9].disabled=true
this.vehicleTypes[10].disabled=true
}else{ }else{
this.isMultiple = false this.isMultiple = false
this.vehicleTypes[2].disabled=false this.vehicleTypes[2].disabled=false
@@ -682,6 +699,7 @@ export default {
this.vehicleTypes[7].disabled=false this.vehicleTypes[7].disabled=false
this.vehicleTypes[8].disabled=false this.vehicleTypes[8].disabled=false
this.vehicleTypes[9].disabled=false this.vehicleTypes[9].disabled=false
this.vehicleTypes[10].disabled=false
} }
if (newVal == 1 || newVal == 7 || newVal == 9){ if (newVal == 1 || newVal == 7 || newVal == 9){
let arr = [] let arr = []
@@ -750,8 +768,37 @@ export default {
liabilityInsuranceEndTime:'', liabilityInsuranceEndTime:'',
insurancePicturePhoto:'' insurancePicturePhoto:''
} }
// 复制新增:从 query 预填类别/属性/服务种类(id 为空,提交仍走新增分支)
this.prefillFromQuery()
} }
}, },
// 复制新增:从 query 解析并回填车辆类别/属性/服务种类 3 项,不调任何接口;
// 字段缺失或为空时等价普通新增兜底;其余字段(照片/OCR/责任险/保单/车辆状态)保持重置后的空值
// 注意:SPA 内 $router.push 跳转时 $route.query 保留原始类型(copyFlag 为数字 1),
// 整页加载/刷新时则为字符串 "1",此处统一 String() 兼容两种来源
prefillFromQuery() {
const urlParams = new URLSearchParams(window.location.search);
const copyFlag = this.$route.query.copyFlag || urlParams.get('copyFlag');
if (String(copyFlag) !== '1') {
return
}
const vehicleType = this.$route.query.vehicleType || urlParams.get('vehicleType');
const virtualVehicle = this.$route.query.virtualVehicle || urlParams.get('virtualVehicle');
const serviceIds = this.$route.query.serviceIds || urlParams.get('serviceIds');
if (vehicleType) {
this.selectedOption = String(vehicleType).split(',').map(Number)
}
if (virtualVehicle) {
this.virtualVehicle = Number(virtualVehicle)
}
// selectedOption 赋值触发 watch(类别 disabled 重置、小修车过滤拖车服务节点、setDefault),
// 服务树勾选必须在 watch 过滤之后执行,$nextTick 回调注册顺序保证清空勾选 → watch 过滤 → 预填勾选
this.$nextTick(() => {
if (serviceIds) {
this.$refs.tree && this.$refs.tree.setCheckedKeys(String(serviceIds).split(',').map(Number))
}
})
},
showDateHandler() { showDateHandler() {
if( this.id ) { // 修改 if( this.id ) { // 修改
if( this.permissonList.includes('hasInsuranceAudit') ) { if( this.permissonList.includes('hasInsuranceAudit') ) {
@@ -823,12 +870,15 @@ export default {
} }
}, },
getVehicleLicense(color) { getVehicleLicense(color) {
color = color || ''
if( color == '蓝' ) { if( color == '蓝' ) {
this.vehicleLicense = 1 this.vehicleLicense = 1
} else if(color == '黄') { } else if(color == '黄') {
this.vehicleLicense = 2 this.vehicleLicense = 2
} else if(color == '临牌') { } else if(color == '临牌') {
this.vehicleLicense = 4 this.vehicleLicense = 4
} else if(color.includes('黄绿')) {
this.vehicleLicense = 6
} else if(color.includes('绿')) { } else if(color.includes('绿')) {
this.vehicleLicense = 3 this.vehicleLicense = 3
} else { } else {
@@ -1162,7 +1212,7 @@ export default {
cardSide: 'FRONT' cardSide: 'FRONT'
}); });
this.vehicleFrontLicensePlate=res.data?.number this.vehicleFrontLicensePlate=res.data?.number
this.getVehicleLicense(res.data.color) this.getVehicleLicense(res.data?.color)
}, },
async vehicleOcrHandler() { // 行驶证首页 ocr 识别 async vehicleOcrHandler() { // 行驶证首页 ocr 识别
this.vehicleLicenseInfo.licensePlateNumber = ''; this.vehicleLicenseInfo.licensePlateNumber = '';
@@ -1187,6 +1237,8 @@ export default {
this.vehicleLicenseInfo.licensePlateNumber = frontInfo?.plateNo; this.vehicleLicenseInfo.licensePlateNumber = frontInfo?.plateNo;
this.vehicleLicenseInfo.vehicleType = frontInfo?.vehicleType; this.vehicleLicenseInfo.vehicleType = frontInfo?.vehicleType;
this.vehicleLicenseInfo.owner = frontInfo?.owner; this.vehicleLicenseInfo.owner = frontInfo?.owner;
// 行驶证所有人识别成功后,预判车辆属性(命中服务商信息则锁定为自有车辆)
this.preJudgeVirtualVehicle();
this.vehicleLicenseInfo.address = frontInfo?.address; this.vehicleLicenseInfo.address = frontInfo?.address;
this.vehicleLicenseInfo.useNature = frontInfo?.useCharacter; this.vehicleLicenseInfo.useNature = frontInfo?.useCharacter;
this.vehicleLicenseInfo.model = frontInfo?.model; this.vehicleLicenseInfo.model = frontInfo?.model;
@@ -1211,6 +1263,33 @@ export default {
} }
return true return true
}, },
// 车辆属性预判:行驶证所有人与车辆归属服务商的名称/法人/关联人员比对,命中自有则锁定选择器
async preJudgeVirtualVehicle() {
const wasLocked = this.virtualVehicleLocked;
this.virtualVehicleLocked = false;
this.virtualVehicleMatchRole = '';
// 之前命中自有自动填入的值,本次未命中/识别失败则清空(自有车辆不可手动选),由操作人员手动选择 2/3/4
if (wasLocked && this.virtualVehicle === 1) {
this.virtualVehicle = '';
}
const owner = (this.vehicleLicenseInfo.owner || '').trim();
if (!owner) {
return;
}
try {
const res = await preJudgeVirtualVehicleApi({
owner,
supplierId: this.supplierId || undefined // 车辆归属服务商ID,自录场景为空由后端取当前用户服务商
});
if (res?.data?.locked) {
this.virtualVehicleLocked = true;
this.virtualVehicleMatchRole = res.data.matchRole || '';
this.virtualVehicle = 1;
}
} catch (e) {
// 预判失败不影响保存,选择器保持可编辑
}
},
async vehicleBackOcrHandler() { // 行驶证副页 ocr 识别 async vehicleBackOcrHandler() { // 行驶证副页 ocr 识别
this.vehicleLicenseInfo.recordNumber = ''; this.vehicleLicenseInfo.recordNumber = '';
this.vehicleLicenseInfo.passengerCapacity = ''; this.vehicleLicenseInfo.passengerCapacity = '';
@@ -1289,6 +1368,9 @@ export default {
}); });
this.auditStatus = result.auditStatus; this.auditStatus = result.auditStatus;
this.virtualVehicle = result.virtualVehicle; this.virtualVehicle = result.virtualVehicle;
// 车辆属性溯源:编辑场景初始化匹配角色,已是自有车辆且命中角色时锁定选择器
this.virtualVehicleMatchRole = result.virtualVehicleMatchRole || '';
this.virtualVehicleLocked = !!(result.virtualVehicleMatchRole && result.virtualVehicle === 1);
this.$refs.tree.setCheckedKeys(result.serviceIds) this.$refs.tree.setCheckedKeys(result.serviceIds)
this.vehicleStatus = result.vehicleStatus this.vehicleStatus = result.vehicleStatus
this.vehicleLicenseFront = result.vehicleLicenseFront; this.vehicleLicenseFront = result.vehicleLicenseFront;
@@ -1860,6 +1942,37 @@ export default {
pointer-events: none; pointer-events: none;
opacity: 0.6; opacity: 0.6;
} }
/* 车辆属性-匹配角色溯源 */
.virtualVehicleField {
display: flex;
align-items: center;
justify-content: flex-end;
.matchRoleArrow {
margin-left: 6px;
cursor: pointer;
color: #909399;
user-select: none;
display: inline-block;
font-size: 22px;
line-height: 1;
padding: 4px;
transition: transform .2s;
&.expanded {
transform: rotate(180deg);
color: #354D93;
}
}
}
.matchRolePanel {
margin: 0 25px 6px 0;
padding: 4px 10px;
font-size: 12px;
color: #606266;
background: #f4f4f5;
border-radius: 4px;
line-height: 1.6;
text-align: right;
}
.pop_wrap { .pop_wrap {
width: 340px; width: 340px;
box-sizing: border-box; box-sizing: border-box;
+23
View File
@@ -82,8 +82,11 @@
<div class="codeLeft">{{item.plateNumber}} / {{item.vehicleTypeString}} <div class="codeLeft">{{item.plateNumber}} / {{item.vehicleTypeString}}
<span class="ml10" :class="{'insuranceSuccess': item.vehicleStatus == 1, 'insuranceDanger': item.vehicleStatus == 2 ,'insuranceGray': !item.vehicleStatus }">{{ item.vehicleStatus == 1 ? '启用' :( item.vehicleStatus == 2 ? '停用' : ( item.vehicleStatus == 12 ? '否-服务商停用' : '无状态')) }} </span> <span class="ml10" :class="{'insuranceSuccess': item.vehicleStatus == 1, 'insuranceDanger': item.vehicleStatus == 2 ,'insuranceGray': !item.vehicleStatus }">{{ item.vehicleStatus == 1 ? '启用' :( item.vehicleStatus == 2 ? '停用' : ( item.vehicleStatus == 12 ? '否-服务商停用' : '无状态')) }} </span>
</div> </div>
<div class="btnWrap">
<div class="codeRight" v-if="permissonList.includes('vehicleAddBtn') || supplierId" @click.stop="copyAddVehicle(item)">复制新增</div>
<div class="codeRight" v-if="item.vehicleStatus == 1" @click.stop="updateStatus(item)">停用</div> <div class="codeRight" v-if="item.vehicleStatus == 1" @click.stop="updateStatus(item)">停用</div>
</div> </div>
</div>
<div class="juhe flex-between"> <div class="juhe flex-between">
<span class="zdJuhe">核验认证</span> <span class="zdJuhe">核验认证</span>
<span class="flex-right"> <span class="flex-right">
@@ -360,6 +363,19 @@ export default {
// on cancel // on cancel
}); });
}, },
copyAddVehicle(item){//复制新增:把源车的类别/属性/服务种类通过 query 带入新增页(后端未返回新字段时为空,新增页按普通新增兜底)
const query = {
copyFlag: 1,
vehicleType: item.vehicleType || '',
virtualVehicle: item.virtualVehicle || '',
serviceIds: (item.serviceIds || []).join(','),
}
if (this.supplierId) {//潜在服务商流程,与「添加」按钮保持一致
query.supplierId = this.supplierId
query.potentialFlag = this.potentialFlag
}
this.goPage('vehicleAdd', query)
},
updateVehicle(item){//修改 updateVehicle(item){//修改
if( this.permissonList.includes('vehicleModifyBtn') ) { if( this.permissonList.includes('vehicleModifyBtn') ) {
this.$router.push({ this.$router.push({
@@ -445,6 +461,13 @@ export default {
.codeLeft{ .codeLeft{
@include fontWeightSize(bold,14px) @include fontWeightSize(bold,14px)
} }
.btnWrap{
display: flex;
align-items: center;
.codeRight + .codeRight{
margin-left: 8px;
}
}
.codeRight{ .codeRight{
padding: 2px 8px; padding: 2px 8px;
border: 1px solid #DDDDDD; border: 1px solid #DDDDDD;