Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 79e903bcd8 | |||
| 119d71b4f5 | |||
| d57d3f86da |
@@ -91,14 +91,3 @@ export const recognizeBaiduOcr = (imageUrl, type, side = '') => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const recognizeQualificationCertificateOcr = imageUrl => {
|
|
||||||
return request({
|
|
||||||
url: '/blade-transport/baidu-ocr/qualification-certificate',
|
|
||||||
method: 'post',
|
|
||||||
timeout: 60000,
|
|
||||||
params: {
|
|
||||||
imageUrl,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog v-model="visible" :title="title" width="92%" append-to-body destroy-on-close @open="handleOpen">
|
<el-dialog v-model="visible" :title="title" width="92%" append-to-body align-center destroy-on-close @open="handleOpen">
|
||||||
<el-form :model="query" inline label-width="130px" @submit.prevent>
|
<el-form class="kingdee-pool-dialog__form" :model="query" inline label-position="right" label-width="120px" @submit.prevent>
|
||||||
<el-form-item label="发票号码">
|
<el-form-item label="发票号码">
|
||||||
<el-input v-model="query.invoiceNo" clearable @keyup.enter="handleQuery" />
|
<el-input v-model="query.invoiceNo" clearable placeholder="请输入" @keyup.enter="handleQuery" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="开票日期">
|
<el-form-item label="开票日期">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
@@ -10,15 +10,16 @@
|
|||||||
type="daterange"
|
type="daterange"
|
||||||
value-format="YYYY-MM-DD"
|
value-format="YYYY-MM-DD"
|
||||||
format="YYYY-MM-DD"
|
format="YYYY-MM-DD"
|
||||||
start-placeholder="开始日期"
|
range-separator="-"
|
||||||
end-placeholder="结束日期"
|
start-placeholder="请选择"
|
||||||
|
end-placeholder="请选择"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="开票单位">
|
<el-form-item label="开票单位">
|
||||||
<el-input v-model="query.salerName" clearable @keyup.enter="handleQuery" />
|
<el-input v-model="query.salerName" clearable placeholder="请输入" @keyup.enter="handleQuery" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="受票单位">
|
<el-form-item label="受票单位">
|
||||||
<el-input v-model="query.buyerName" clearable @keyup.enter="handleQuery" />
|
<el-input v-model="query.buyerName" clearable placeholder="请输入" @keyup.enter="handleQuery" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="开票单位(销方)">
|
<el-form-item label="开票单位(销方)">
|
||||||
<el-select
|
<el-select
|
||||||
@@ -93,6 +94,9 @@
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button :disabled="loading" @click="resetQuery">重置</el-button>
|
<el-button :disabled="loading" @click="resetQuery">重置</el-button>
|
||||||
<el-button type="primary" :disabled="loading" @click="handleQuery">查询</el-button>
|
<el-button type="primary" :disabled="loading" @click="handleQuery">查询</el-button>
|
||||||
|
<el-tooltip content="按名称检索范围为已同步票,未找到请改用发票号码或税号精确查找" placement="top">
|
||||||
|
<el-icon class="kingdee-pool-dialog__query-tip"><QuestionFilled /></el-icon>
|
||||||
|
</el-tooltip>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-table
|
<el-table
|
||||||
@@ -101,7 +105,7 @@
|
|||||||
:data="rows"
|
:data="rows"
|
||||||
:row-key="rowKey"
|
:row-key="rowKey"
|
||||||
border
|
border
|
||||||
height="520"
|
max-height="50vh"
|
||||||
:highlight-current-row="!multiple"
|
:highlight-current-row="!multiple"
|
||||||
@selection-change="selection => (selected = selection)"
|
@selection-change="selection => (selected = selection)"
|
||||||
@row-dblclick="handleRowDblclick"
|
@row-dblclick="handleRowDblclick"
|
||||||
@@ -118,6 +122,7 @@
|
|||||||
</el-radio>
|
</el-radio>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column type="index" label="序号" width="70" align="center" :index="indexMethod" />
|
||||||
<el-table-column prop="invoiceNo" label="发票号码" min-width="180" />
|
<el-table-column prop="invoiceNo" label="发票号码" min-width="180" />
|
||||||
<el-table-column prop="invoiceDate" label="开票日期" min-width="120" />
|
<el-table-column prop="invoiceDate" label="开票日期" min-width="120" />
|
||||||
<el-table-column prop="invoiceType" label="发票类型" min-width="140" />
|
<el-table-column prop="invoiceType" label="发票类型" min-width="140" />
|
||||||
@@ -172,8 +177,8 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<div class="kingdee-pool-dialog__pager">
|
<div class="kingdee-pool-dialog__pagination">
|
||||||
<span class="kingdee-pool-dialog__pager-tip">按名称检索范围为已同步票,未找到请改用发票号码或税号精确查找</span>
|
<span class="kingdee-pool-dialog__pagination-tip">按名称检索范围为已同步票,未找到请改用发票号码或税号精确查找</span>
|
||||||
<el-pagination
|
<el-pagination
|
||||||
v-model:current-page="page.current"
|
v-model:current-page="page.current"
|
||||||
v-model:page-size="page.size"
|
v-model:page-size="page.size"
|
||||||
@@ -323,6 +328,9 @@ export default {
|
|||||||
this.page.current = 1;
|
this.page.current = 1;
|
||||||
this.load();
|
this.load();
|
||||||
},
|
},
|
||||||
|
indexMethod(index) {
|
||||||
|
return (this.page.current - 1) * this.page.size + index + 1;
|
||||||
|
},
|
||||||
resetQuery() {
|
resetQuery() {
|
||||||
this.query = this.emptyQuery();
|
this.query = this.emptyQuery();
|
||||||
this.handleQuery();
|
this.handleQuery();
|
||||||
@@ -420,15 +428,28 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.kingdee-pool-dialog__pager {
|
.kingdee-pool-dialog__form {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
padding: 12px 12px 4px;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 6px;
|
||||||
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
|
||||||
|
}
|
||||||
|
.kingdee-pool-dialog__pagination {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
margin-top: 12px;
|
padding: 16px 0;
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
}
|
}
|
||||||
.kingdee-pool-dialog__pager-tip {
|
.kingdee-pool-dialog__pagination-tip {
|
||||||
color: #909399;
|
color: #909399;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.kingdee-pool-dialog__query-tip {
|
||||||
|
margin-left: 8px;
|
||||||
|
color: #909399;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export const invoiceReceiptTableColumns = [
|
|||||||
{ prop: 'createUserName', label: '创建人', minWidth: 110 },
|
{ prop: 'createUserName', label: '创建人', minWidth: 110 },
|
||||||
{ prop: 'createTime', label: '创建时间', minWidth: 170 },
|
{ prop: 'createTime', label: '创建时间', minWidth: 170 },
|
||||||
{ prop: 'kingdeeReceivedInvoiceNo', label: '金蝶单据号', minWidth: 150 },
|
{ prop: 'kingdeeReceivedInvoiceNo', label: '金蝶单据号', minWidth: 150 },
|
||||||
{ prop: 'kingdeePushStatusName', label: '金蝶状态', minWidth: 130 },
|
{ prop: 'kingdeePushStatusName', label: '金蝶状态', minWidth: 130, kingdeeStatus: true },
|
||||||
{ prop: 'kingdeePushMsg', label: '失败原因', minWidth: 160 },
|
{ prop: 'kingdeePushMsg', label: '失败原因', minWidth: 160 },
|
||||||
{ prop: 'attachmentSyncStatusName', label: '附件同步', minWidth: 100 },
|
{ prop: 'attachmentSyncStatusName', label: '附件同步', minWidth: 100 },
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -14,6 +14,17 @@ export const KINGDEE_STATUS_TAG_TYPES = {
|
|||||||
/** 金蝶单据状态 → el-tag 颜色类型,未映射状态返回 info */
|
/** 金蝶单据状态 → el-tag 颜色类型,未映射状态返回 info */
|
||||||
export const kingdeeStatusType = status => KINGDEE_STATUS_TAG_TYPES[status] || 'info';
|
export const kingdeeStatusType = status => KINGDEE_STATUS_TAG_TYPES[status] || 'info';
|
||||||
|
|
||||||
|
/** 收票登记推送状态 → el-tag 颜色类型(已指定应付=绿、已保存收票单=黄、推送失败=红、未推送=灰) */
|
||||||
|
export const KINGDEE_PUSH_STATUS_TAG_TYPES = {
|
||||||
|
unsynced: 'info',
|
||||||
|
pushed: 'warning',
|
||||||
|
assigned: 'success',
|
||||||
|
failed: 'danger',
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 收票登记推送状态 → el-tag 颜色类型,未映射状态返回 info */
|
||||||
|
export const kingdeePushStatusType = status => KINGDEE_PUSH_STATUS_TAG_TYPES[status] || 'info';
|
||||||
|
|
||||||
/** 金蝶冲销状态 → el-tag 颜色类型(已冲销=绿、未冲销=黄) */
|
/** 金蝶冲销状态 → el-tag 颜色类型(已冲销=绿、未冲销=黄) */
|
||||||
export const KINGDEE_WRITEOFF_TAG_TYPES = {
|
export const KINGDEE_WRITEOFF_TAG_TYPES = {
|
||||||
writtenoff: 'success',
|
writtenoff: 'success',
|
||||||
|
|||||||
@@ -119,6 +119,9 @@
|
|||||||
<el-tag v-else-if="column.status" :type="statusType(row.approvalStatus)" class="status-text">
|
<el-tag v-else-if="column.status" :type="statusType(row.approvalStatus)" class="status-text">
|
||||||
{{ displayValue(row[column.prop]) }}
|
{{ displayValue(row[column.prop]) }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
|
<el-tag v-else-if="column.kingdeeStatus" :type="kingdeePushStatusType(row.kingdeePushStatus)">
|
||||||
|
{{ displayValue(row[column.prop]) }}
|
||||||
|
</el-tag>
|
||||||
<span v-else-if="column.money">{{ formatMoney(row[column.prop]) }}</span>
|
<span v-else-if="column.money">{{ formatMoney(row[column.prop]) }}</span>
|
||||||
<span v-else>{{ displayValue(row[column.prop]) }}</span>
|
<span v-else>{{ displayValue(row[column.prop]) }}</span>
|
||||||
</template>
|
</template>
|
||||||
@@ -222,6 +225,7 @@ import TableHeaderTools from '@/components/table-header-tools/main.vue';
|
|||||||
import organizationSearch from '@/mixins/organization-search';
|
import organizationSearch from '@/mixins/organization-search';
|
||||||
import { getMKApprovalUrl } from '@/api/system/business-process';
|
import { getMKApprovalUrl } from '@/api/system/business-process';
|
||||||
import { loadMkEnabled, submitMkApprovalFlow } from '@/utils/mk-approval';
|
import { loadMkEnabled, submitMkApprovalFlow } from '@/utils/mk-approval';
|
||||||
|
import { kingdeePushStatusType } from '@/utils/kingdee';
|
||||||
|
|
||||||
// 表单提交成功后带标记返回,keep-alive 缓存的列表页据此重新拉取
|
// 表单提交成功后带标记返回,keep-alive 缓存的列表页据此重新拉取
|
||||||
const invoiceReceiptListRefreshKey = 'invoice-receipt-list-refresh';
|
const invoiceReceiptListRefreshKey = 'invoice-receipt-list-refresh';
|
||||||
@@ -480,6 +484,7 @@ export default {
|
|||||||
''
|
''
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
kingdeePushStatusType,
|
||||||
displayValue(value) {
|
displayValue(value) {
|
||||||
return value === null || value === undefined || value === '' ? '-' : value;
|
return value === null || value === undefined || value === '' ? '-' : value;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -74,6 +74,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { claimCandidates } from '@/api/payment/invoiceReceipt';
|
import { claimCandidates } from '@/api/payment/invoiceReceipt';
|
||||||
|
import { kingdeePushStatusType } from '@/utils/kingdee';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'InvoiceReceiptCandidatesDialog',
|
name: 'InvoiceReceiptCandidatesDialog',
|
||||||
@@ -152,7 +153,7 @@ export default {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
pushStatusType(value) {
|
pushStatusType(value) {
|
||||||
return { pushed: 'warning', assigned: 'success', failed: 'danger', unsynced: 'info' }[value] || 'info';
|
return kingdeePushStatusType(value);
|
||||||
},
|
},
|
||||||
formatMoney(value) {
|
formatMoney(value) {
|
||||||
const number = Number(value);
|
const number = Number(value);
|
||||||
|
|||||||
@@ -145,10 +145,10 @@
|
|||||||
<el-descriptions-item label="创建时间">
|
<el-descriptions-item label="创建时间">
|
||||||
{{ invoiceRegisterDialog.row.createTime || '-' }}
|
{{ invoiceRegisterDialog.row.createTime || '-' }}
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="金蝶同步状态" :span="2">
|
<el-descriptions-item label="金蝶同步状态">
|
||||||
{{ kingdeeSyncName(invoiceRegisterDialog.row.kingdeeSyncStatus) }}
|
{{ kingdeeSyncName(invoiceRegisterDialog.row.kingdeeSyncStatus) }}
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="备注" :span="2">
|
<el-descriptions-item label="备注">
|
||||||
{{ invoiceRegisterDialog.row.remark || '-' }}
|
{{ invoiceRegisterDialog.row.remark || '-' }}
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
</el-descriptions>
|
</el-descriptions>
|
||||||
@@ -847,6 +847,10 @@ export default {
|
|||||||
settlementTypeName(value) {
|
settlementTypeName(value) {
|
||||||
return { payable: '付款', receivable: '收款' }[value] || '-';
|
return { payable: '付款', receivable: '收款' }[value] || '-';
|
||||||
},
|
},
|
||||||
|
// 模板无法直接访问 script 顶部 import,包装成实例方法(与 formal-settlement-table-panel 同模式)
|
||||||
|
kingdeeSyncName(value) {
|
||||||
|
return kingdeeSyncName(value);
|
||||||
|
},
|
||||||
unwrapData(response) {
|
unwrapData(response) {
|
||||||
const body = response?.data || response || {};
|
const body = response?.data || response || {};
|
||||||
return body?.data || body;
|
return body?.data || body;
|
||||||
|
|||||||
@@ -689,7 +689,6 @@ import {
|
|||||||
recognitionIDCard,
|
recognitionIDCard,
|
||||||
recognitionTransportCertificates,
|
recognitionTransportCertificates,
|
||||||
recognizeBaiduOcr,
|
recognizeBaiduOcr,
|
||||||
recognizeQualificationCertificateOcr,
|
|
||||||
} from '@/api/transportCapacity/driver';
|
} from '@/api/transportCapacity/driver';
|
||||||
import { getList as getVehicleList } from '@/api/transportCapacity/transport-vehicle';
|
import { getList as getVehicleList } from '@/api/transportCapacity/transport-vehicle';
|
||||||
import { getDeptTree } from '@/api/system/dept';
|
import { getDeptTree } from '@/api/system/dept';
|
||||||
@@ -1323,29 +1322,9 @@ export default {
|
|||||||
},
|
},
|
||||||
handleQualificationUploadSuccess(prop, url) {
|
handleQualificationUploadSuccess(prop, url) {
|
||||||
this.setImage(prop, url);
|
this.setImage(prop, url);
|
||||||
this.recognizeQualificationCertificate(url);
|
this.recognizeBaiduOcr(url, 'general', '', '从业资格证', data => {
|
||||||
},
|
this.applyQualificationRecognition(data);
|
||||||
recognizeQualificationCertificate(url) {
|
|
||||||
if (!url) {
|
|
||||||
this.$message.warning('从业资格证图片上传成功,未获取到图片地址,无法自动识别');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const loading = ElLoading.service({
|
|
||||||
lock: true,
|
|
||||||
text: '从业资格证识别中',
|
|
||||||
background: 'rgba(255, 255, 255, 0.7)',
|
|
||||||
});
|
});
|
||||||
recognizeQualificationCertificateOcr(url)
|
|
||||||
.then(res => {
|
|
||||||
this.applyQualificationRecognition(res?.data?.data || {});
|
|
||||||
this.$message.success('从业资格证识别完成');
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
this.$message.warning('从业资格证图片上传成功,自动识别失败,请手动填写相关信息');
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
loading.close();
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
recognizeBaiduOcr(url, type, side, documentName, applyRecognition) {
|
recognizeBaiduOcr(url, type, side, documentName, applyRecognition) {
|
||||||
if (!url) {
|
if (!url) {
|
||||||
@@ -1635,43 +1614,25 @@ export default {
|
|||||||
return typeof value === 'object' ? value.words || value.value || '' : value || '';
|
return typeof value === 'object' ? value.words || value.value || '' : value || '';
|
||||||
},
|
},
|
||||||
applyQualificationRecognition(data = {}) {
|
applyQualificationRecognition(data = {}) {
|
||||||
const fields = this.normalizeQualificationOcrFields(data);
|
const qualificationType = this.getQualificationType(data);
|
||||||
const qualificationType = this.getQualificationOcrValue(fields, [
|
const qualificationNo = this.getQualificationNo(data);
|
||||||
'qualification_category',
|
|
||||||
'从业资格类别',
|
|
||||||
'从业资格类型',
|
|
||||||
]).replace(/[,,;;]+$/, '');
|
|
||||||
const qualificationNo = this.getQualificationOcrValue(fields, [
|
|
||||||
'certificate_no',
|
|
||||||
'证号',
|
|
||||||
'从业资格证号',
|
|
||||||
'资格证号',
|
|
||||||
'证书编号',
|
|
||||||
]);
|
|
||||||
const validFrom = this.getQualificationOcrValue(fields, ['valid_from', '有效起始日期']);
|
|
||||||
const validUntil = this.getQualificationOcrValue(fields, ['valid_until', '有效期限', '有效期']);
|
|
||||||
const matchedType = this.matchQualificationType(qualificationType);
|
const matchedType = this.matchQualificationType(qualificationType);
|
||||||
if (matchedType) {
|
if (matchedType) {
|
||||||
this.driverForm.qualificationType = matchedType;
|
this.driverForm.qualificationType = matchedType;
|
||||||
} else if (qualificationType && !this.qualificationTypeOptions.length) {
|
} else if (qualificationType && !this.qualificationTypeOptions.length) {
|
||||||
this.driverForm.qualificationType = qualificationType;
|
this.driverForm.qualificationType = qualificationType;
|
||||||
}
|
}
|
||||||
if (qualificationNo) {
|
if (qualificationNo && !this.driverForm.qualificationNo) {
|
||||||
this.driverForm.qualificationNo = String(qualificationNo).replace(/\s/g, '');
|
this.driverForm.qualificationNo = String(qualificationNo).replace(/\s/g, '');
|
||||||
}
|
}
|
||||||
const startDate = this.normalizeBirthday(validFrom);
|
const words = this.getBaiduOcrWords(data).join(' ');
|
||||||
if (startDate) {
|
const dateList = words.match(/\d{4}[-/.年]\d{1,2}[-/.月]\d{1,2}日?/g) || [];
|
||||||
this.driverForm.qualificationStartDate = startDate;
|
if (/(长期|永久有效)/.test(words)) {
|
||||||
}
|
|
||||||
if (/(长期|永久)/.test(validUntil)) {
|
|
||||||
this.driverForm.qualificationLongTerm = 1;
|
this.driverForm.qualificationLongTerm = 1;
|
||||||
this.driverForm.qualificationEndDate = '';
|
this.driverForm.qualificationEndDate = '';
|
||||||
} else {
|
} else if (dateList.length) {
|
||||||
const endDate = this.normalizeBirthday(validUntil);
|
this.driverForm.qualificationEndDate = this.normalizeBirthday(dateList[dateList.length - 1]);
|
||||||
if (endDate) {
|
this.driverForm.qualificationLongTerm = 0;
|
||||||
this.driverForm.qualificationEndDate = endDate;
|
|
||||||
this.driverForm.qualificationLongTerm = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
['qualificationType', 'qualificationNo', 'qualificationEndDate'].forEach(prop => {
|
['qualificationType', 'qualificationNo', 'qualificationEndDate'].forEach(prop => {
|
||||||
@@ -1679,25 +1640,22 @@ export default {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
normalizeQualificationOcrFields(result = {}) {
|
getQualificationType(data = {}) {
|
||||||
if (result.fields && typeof result.fields === 'object' && !Array.isArray(result.fields)) {
|
const fieldValue = this.getOcrValue(data, ['从业资格类别', '从业资格类型']);
|
||||||
return result.fields;
|
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);
|
||||||
}
|
}
|
||||||
const keyInfos = result.key_info || result.keyInfo || result.keyInfos || [];
|
return values.join('').replace(/[,,;;]+$/, '').trim();
|
||||||
if (!Array.isArray(keyInfos)) return {};
|
|
||||||
return Object.fromEntries(
|
|
||||||
keyInfos
|
|
||||||
.filter(item => item && item.key)
|
|
||||||
.map(item => [String(item.key).trim(), String(item.value ?? '').trim()])
|
|
||||||
.filter(([, value]) => value)
|
|
||||||
);
|
|
||||||
},
|
|
||||||
getQualificationOcrValue(fields = {}, keys = []) {
|
|
||||||
const normalizedKeys = keys.map(key => String(key).toLowerCase());
|
|
||||||
const entry = Object.entries(fields).find(([key]) =>
|
|
||||||
normalizedKeys.includes(String(key).toLowerCase())
|
|
||||||
);
|
|
||||||
return entry ? String(entry[1] || '').trim() : '';
|
|
||||||
},
|
},
|
||||||
matchQualificationType(value = '') {
|
matchQualificationType(value = '') {
|
||||||
const text = String(value || '').replace(/\s/g, '');
|
const text = String(value || '').replace(/\s/g, '');
|
||||||
@@ -1715,6 +1673,27 @@ export default {
|
|||||||
);
|
);
|
||||||
return matched?.value || '';
|
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 = '') {
|
normalizeNation(value = '') {
|
||||||
const nation = String(value || '').trim();
|
const nation = String(value || '').trim();
|
||||||
if (!nation) return '';
|
if (!nation) return '';
|
||||||
|
|||||||
Reference in New Issue
Block a user