feat(platform): add vehicle identity maintenance list

This commit is contained in:
lingniu
2026-07-04 20:39:58 +08:00
parent 87fa0f524c
commit 4b34a2bf4c
2 changed files with 56 additions and 0 deletions

View File

@@ -235,6 +235,44 @@ function vehicleDispatchListText({
return lines.join('\n');
}
function vehicleIdentityMaintenanceText({
filters,
rows,
total
}: {
filters: Record<string, string>;
rows: VehicleCoverageRow[];
total: number;
}) {
const maintenanceRows = rows.filter((row) => row.bindingStatus !== 'bound' || vehicleArchiveMissingLabels(row).length > 0);
const lines = [
'【车辆身份维护清单】',
`当前筛选:${vehicleFilterSummary(filters).join('') || '全部车辆'}`,
`当前页待维护:${maintenanceRows.length.toLocaleString()} 辆 / 当前筛选 ${total.toLocaleString()}`,
''
];
maintenanceRows.forEach((row, index) => {
const missingLabels = vehicleArchiveMissingLabels(row);
const lookupKeys = [
row.vin ? `vin=${row.vin}` : '',
row.plate ? `plate=${row.plate}` : '',
row.phone ? `phone=${row.phone}` : '',
row.oem ? `oem=${row.oem}` : ''
].filter(Boolean).join('') || '暂无可用关联键';
const action = row.bindingStatus !== 'bound'
? '先维护 vehicle_identity_binding 的车牌/手机号到 VIN 映射,再复核实时来源是否归并到车辆服务。'
: `补齐档案字段:${missingLabels.join('、')}`;
lines.push(
`${index + 1}. ${row.plate || '-'} / ${row.vin || '-'} / ${row.phone || '-'} / ${row.oem || '-'}`,
` 状态:${vehicleServiceStatus(row).label};绑定:${row.bindingStatus === 'bound' ? '已绑定' : '未绑定'};档案缺项:${missingLabels.join('、') || '无'}`,
` 关联键:${lookupKeys}`,
` 建议动作:${action}`,
` 车辆服务:${appURL(buildAppHash({ page: 'detail', keyword: row.vin, protocol: primaryRowProtocol(row, filters.protocol) }))}`
);
});
return lines.join('\n');
}
type VehicleActionRecommendation = {
label: string;
color: 'green' | 'orange' | 'red';
@@ -501,6 +539,14 @@ export function Vehicles({
}
copyText(vehicleDispatchListText({ filters, rows, total: pagination.total }), '车辆处置清单');
};
const copyIdentityMaintenanceList = () => {
const maintenanceRows = rows.filter((row) => row.bindingStatus !== 'bound' || vehicleArchiveMissingLabels(row).length > 0);
if (maintenanceRows.length === 0) {
Toast.warning('当前页没有需要维护身份或档案的车辆');
return;
}
copyText(vehicleIdentityMaintenanceText({ filters, rows, total: pagination.total }), '车辆身份维护清单');
};
useEffect(() => {
setFilters(initialFilters);
@@ -679,6 +725,7 @@ export function Vehicles({
<span></span>
<Button size="small" theme="light" onClick={copyGovernanceSummary}></Button>
<Button size="small" theme="light" onClick={copyDispatchList}></Button>
<Button size="small" theme="light" onClick={copyIdentityMaintenanceList}></Button>
</Space>
)}
style={{ marginTop: 16 }}