1、新增结算模块

2、调整业务模块
3、调整客商模块
This commit is contained in:
2026-08-20 06:33:01 +08:00
parent 4199255186
commit fd5b1484e6
59 changed files with 11745 additions and 1104 deletions
+179 -17
View File
@@ -400,7 +400,7 @@
:readonly="readonly"
:headers="uploadHeaders"
large
@success="url => setImage('qualificationFront', url)"
@success="url => handleQualificationUploadSuccess('qualificationFront', url)"
/>
</el-col>
<el-col :span="12">
@@ -411,7 +411,7 @@
:readonly="readonly"
:headers="uploadHeaders"
large
@success="url => setImage('qualificationBack', url)"
@success="url => handleQualificationUploadSuccess('qualificationBack', url)"
/>
</el-col>
</el-row>
@@ -504,6 +504,7 @@ import {
getExpiryStat,
recognitionIDCard,
recognitionTransportCertificates,
recognizeBaiduOcr,
} from '@/api/transportCapacity/driver';
import { getDeptTree } from '@/api/system/dept';
import { getDictionary } from '@/api/system/dictbiz';
@@ -754,6 +755,10 @@ export default {
this.qualificationTypeOptions = (res.data.data || [])
.map(item => item.dictValue)
.filter(Boolean);
const matchedType = this.matchQualificationType(this.driverForm.qualificationType);
if (matchedType) {
this.driverForm.qualificationType = matchedType;
}
});
},
formatDeptOptions(tree = [], level = 0) {
@@ -953,12 +958,53 @@ export default {
},
handleIdCardUploadSuccess(prop, url) {
this.setImage(prop, url);
this.recognizeIdCard(url);
if (prop !== 'idCardFront') {
return;
}
this.recognizeBaiduOcr(url, 'id_card', 'front', '身份证', data => {
this.applyIdCardRecognition(data);
});
},
handleDrivingLicenseUploadSuccess(prop, url) {
this.setImage(prop, url);
this.drivingLicenseUploads[prop] = url;
this.recognizeDrivingLicense();
this.recognizeBaiduOcr(
url,
'driving_license',
prop === 'drivingLicenseBack' ? 'back' : 'front',
'驾驶证',
data => {
this.applyDrivingLicenseRecognition(data);
}
);
},
handleQualificationUploadSuccess(prop, url) {
this.setImage(prop, url);
this.recognizeBaiduOcr(url, 'general', '', '从业资格证', data => {
this.applyQualificationRecognition(data);
});
},
recognizeBaiduOcr(url, type, side, documentName, applyRecognition) {
if (!url) {
this.$message.warning(`${documentName}图片上传成功,未获取到图片地址,无法自动识别`);
return;
}
const loading = ElLoading.service({
lock: true,
text: `${documentName}识别中`,
background: 'rgba(255, 255, 255, 0.7)',
});
recognizeBaiduOcr(url, type, side)
.then(res => {
applyRecognition(res.data.data?.result || {});
this.$message.success(`${documentName}识别完成`);
})
.catch(() => {
this.$message.warning(`${documentName}图片上传成功,自动识别失败,请手动填写相关信息`);
})
.finally(() => {
loading.close();
});
},
recognizeIdCard(url = '') {
if (!url) {
@@ -1040,11 +1086,11 @@ export default {
const validDateStart =
data.driverLicenseValidDateStart ||
data.drivingLicenseStartDate ||
this.getOcrValue(data, ['date_vaild_start', '有效期限(起始时间)']);
this.getOcrValue(data, ['date_vaild_start', '有效期限(起始时间)', '有效起始日期']);
const validDateEnd =
data.driverLicenseValidDateEnd ||
data.drivingLicenseEndDate ||
this.getOcrValue(data, ['date_vaild_end', '有效期限(终止时间)', '有效期限(终⽌时间)']);
this.getOcrValue(data, ['date_vaild_end', '有效期限(终止时间)', '有效期限(终⽌时间)', '有效截止日期']);
if (driverName && !this.driverForm.driverName) {
this.driverForm.driverName = driverName;
}
@@ -1067,6 +1113,7 @@ export default {
this.driverForm.drivingLicenseEndDate = this.normalizeBirthday(validDateEnd);
this.driverForm.drivingLicenseLongTerm = 0;
}
this.applyDrivingLicenseValidity(data);
this.$nextTick(() => {
[
'driverName',
@@ -1080,6 +1127,21 @@ export default {
});
});
},
applyDrivingLicenseValidity(data = {}) {
const validity = this.getOcrValue(data, ['有效期限', '有效期']);
if (!validity) return;
const dateList = validity.match(/\d{4}[-/.年]\d{1,2}[-/.月]\d{1,2}日?/g) || [];
if (!this.driverForm.drivingLicenseStartDate && dateList[0]) {
this.driverForm.drivingLicenseStartDate = this.normalizeBirthday(dateList[0]);
}
if (/(长期|永久)/.test(validity)) {
this.driverForm.drivingLicenseLongTerm = 1;
this.driverForm.drivingLicenseEndDate = '';
} else if (!this.driverForm.drivingLicenseEndDate && dateList[1]) {
this.driverForm.drivingLicenseEndDate = this.normalizeBirthday(dateList[1]);
this.driverForm.drivingLicenseLongTerm = 0;
}
},
applyIdCardRecognition(data = {}) {
const driverName = data.name || data.driverName || this.getOcrValue(data, ['name', '姓名']);
const idCardNo = String(
@@ -1093,8 +1155,7 @@ export default {
data.nation ||
data.ethnicGroup ||
this.getOcrValue(data, ['ethnic_group', 'nation', '民族']);
const ocrBirthday =
data.birthday || data.birthDate || this.getOcrValue(data, ['date', '出生']);
const ocrAddress = data.address || this.getOcrValue(data, ['address', '住址', '地址']);
if (driverName) {
this.driverForm.driverName = driverName;
}
@@ -1104,8 +1165,8 @@ export default {
if (ocrNation) {
this.driverForm.nation = this.normalizeNation(ocrNation);
}
if (ocrBirthday) {
this.driverForm.birthday = this.normalizeBirthday(ocrBirthday);
if (ocrAddress) {
this.driverForm.address = String(ocrAddress).trim();
}
if (idCardNo) {
this.driverForm.idCardNo = idCardNo;
@@ -1113,7 +1174,7 @@ export default {
this.driverForm.qualificationNo = idCardNo;
}
const idCardInfo = this.parseIdCardInfo(idCardNo);
if (!this.driverForm.birthday && idCardInfo.birthday) {
if (idCardInfo.birthday) {
this.driverForm.birthday = idCardInfo.birthday;
}
if (!this.driverForm.gender && idCardInfo.gender) {
@@ -1121,11 +1182,17 @@ export default {
}
}
this.$nextTick(() => {
['driverName', 'idCardNo', 'birthday', 'gender', 'nation', 'qualificationNo'].forEach(
prop => {
this.$refs.driverForm?.validateField(prop);
}
);
[
'driverName',
'idCardNo',
'birthday',
'gender',
'nation',
'qualificationNo',
'address',
].forEach(prop => {
this.$refs.driverForm?.validateField(prop);
});
});
},
getOcrValue(data = {}, keys = []) {
@@ -1136,7 +1203,102 @@ export default {
const description = String(info.description || '');
return keys.some(value => key === String(value).toLowerCase() || description === value);
});
return item ? item.value || '' : '';
if (item) return item.value || '';
const wordsResult = data.words_result || data.wordsResult || {};
const normalizedKeys = keys.map(key => String(key).toLowerCase());
if (Array.isArray(wordsResult)) {
const wordItem = wordsResult.find(info =>
normalizedKeys.includes(String(info.key || info.name || '').toLowerCase())
);
return wordItem?.words || wordItem?.value || '';
}
const wordEntry = Object.entries(wordsResult).find(([key]) =>
normalizedKeys.includes(String(key).toLowerCase())
);
if (!wordEntry) return '';
const value = wordEntry[1];
return typeof value === 'object' ? value.words || value.value || '' : value || '';
},
applyQualificationRecognition(data = {}) {
const qualificationType = this.getQualificationType(data);
const qualificationNo = this.getQualificationNo(data);
const matchedType = this.matchQualificationType(qualificationType);
if (matchedType) {
this.driverForm.qualificationType = matchedType;
} else if (qualificationType && !this.qualificationTypeOptions.length) {
this.driverForm.qualificationType = qualificationType;
}
if (qualificationNo && !this.driverForm.qualificationNo) {
this.driverForm.qualificationNo = String(qualificationNo).replace(/\s/g, '');
}
const words = this.getBaiduOcrWords(data).join(' ');
const dateList = words.match(/\d{4}[-/.年]\d{1,2}[-/.月]\d{1,2}日?/g) || [];
if (/(长期|永久有效)/.test(words)) {
this.driverForm.qualificationLongTerm = 1;
this.driverForm.qualificationEndDate = '';
} else if (dateList.length) {
this.driverForm.qualificationEndDate = this.normalizeBirthday(dateList[dateList.length - 1]);
this.driverForm.qualificationLongTerm = 0;
}
this.$nextTick(() => {
['qualificationType', 'qualificationNo', 'qualificationEndDate'].forEach(prop => {
this.$refs.driverForm?.validateField(prop);
});
});
},
getQualificationType(data = {}) {
const fieldValue = this.getOcrValue(data, ['从业资格类别', '从业资格类型']);
if (fieldValue) return String(fieldValue).trim();
const words = this.getBaiduOcrWords(data);
const labelIndex = words.findIndex(word => /从业资格类别|从业资格类型/.test(word));
if (labelIndex < 0) return '';
const firstValue = words[labelIndex].replace(/^.*?(?:从业资格类别|从业资格类型)\s*[::]?/, '').trim();
const values = firstValue ? [firstValue] : [];
for (let index = labelIndex + 1; index < words.length; index += 1) {
const word = String(words[index] || '').trim();
if (!word || /^(有效起始日期|有效期限|核发机关|继续教育信息|诚信考核信息)/.test(word)) {
break;
}
values.push(word);
}
return values.join('').replace(/[,;]+$/, '').trim();
},
matchQualificationType(value = '') {
const text = String(value || '').replace(/\s/g, '');
if (!text) return '';
const options = this.qualificationTypeOptions || [];
const normalizedOptions = options.map(option => ({
value: option,
text: String(option).replace(/\s/g, ''),
}));
const exact = normalizedOptions.find(option => option.text === text);
if (exact) return exact.value;
const candidates = text.split(/[,;]/).filter(Boolean);
const matched = normalizedOptions.find(option =>
candidates.some(candidate => candidate.includes(option.text) || option.text.includes(candidate))
);
return matched?.value || '';
},
getQualificationNo(data = {}) {
const fieldValue = this.getOcrValue(data, ['从业资格证号', '资格证号', '证书编号']);
if (fieldValue) return fieldValue;
const words = this.getBaiduOcrWords(data);
const labelIndex = words.findIndex(word => /^(?:(?:从业)?资格证号?|证书编号)[:]?$/.test(word));
if (labelIndex >= 0 && words[labelIndex + 1]) {
return words[labelIndex + 1];
}
const certificateLine = words.find(word => /(?:从业)?资格证号?|证书编号/.test(word));
const match = certificateLine?.match(/(?:(?:从业)?资格证号?|证书编号)\s*[:]?\s*([A-Z0-9-]{6,})/i);
return match?.[1] || '';
},
getBaiduOcrWords(data = {}) {
const wordsResult = data.words_result || data.wordsResult || {};
if (Array.isArray(wordsResult)) {
return wordsResult.map(item => item.words || item.value || '').filter(Boolean);
}
return Object.values(wordsResult)
.map(item => (typeof item === 'object' ? item.words || item.value || '' : item || ''))
.filter(Boolean);
},
normalizeNation(value = '') {
const nation = String(value || '').trim();