feat(platform): add mileage evidence package
This commit is contained in:
@@ -177,6 +177,31 @@ function mileageSummaryText({
|
||||
].join('\n');
|
||||
}
|
||||
|
||||
function mileageEvidencePackageText(row: DailyMileageRow) {
|
||||
const dateFrom = row.date?.trim() ?? '';
|
||||
const dateTo = nextDate(dateFrom);
|
||||
const evidenceFilters = {
|
||||
...(dateFrom ? { dateFrom } : {}),
|
||||
...(dateTo ? { dateTo } : {})
|
||||
};
|
||||
const vehicle = row.plate?.trim() ? `${row.plate.trim()} / ${row.vin}` : row.vin;
|
||||
return [
|
||||
'【里程异常证据包】',
|
||||
`车辆:${vehicle}`,
|
||||
`数据来源:${row.source || '未知来源'}`,
|
||||
`统计日期:${row.date || '-'}`,
|
||||
`起始里程:${formatKm(row.startMileageKm)} km`,
|
||||
`结束里程:${formatKm(row.endMileageKm)} km`,
|
||||
`日里程:${formatKm(row.dailyMileageKm)} km`,
|
||||
`异常等级:${row.anomalySeverity || '正常'}`,
|
||||
`处置建议:${mileageActionRecommendation(row).detail}`,
|
||||
`车辆服务:${appURL(buildAppHash({ page: 'detail', keyword: row.vin, protocol: row.source }))}`,
|
||||
`轨迹证据:${appURL(buildAppHash({ page: 'history', keyword: row.vin, protocol: row.source, filters: evidenceFilters }))}`,
|
||||
`RAW证据:${appURL(buildAppHash({ page: 'history-query', keyword: row.vin, protocol: row.source, filters: { ...evidenceFilters, tab: 'raw', includeFields: 'true' } }))}`,
|
||||
`统计查询:${appURL(buildAppHash({ page: 'mileage', keyword: row.vin, protocol: row.source, filters: evidenceFilters }))}`
|
||||
].join('\n');
|
||||
}
|
||||
|
||||
async function copyText(value: string, label: string) {
|
||||
const text = value.trim();
|
||||
if (!text) {
|
||||
@@ -326,6 +351,9 @@ export function Mileage({
|
||||
...(dateTo ? { dateTo } : {})
|
||||
});
|
||||
};
|
||||
const copyMileageEvidence = (row: DailyMileageRow) => {
|
||||
copyText(mileageEvidencePackageText(row), '里程证据包');
|
||||
};
|
||||
const exportMileage = () => {
|
||||
if (rows.length === 0) {
|
||||
Toast.warning('当前没有可导出的里程明细');
|
||||
@@ -683,9 +711,10 @@ export function Mileage({
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 270,
|
||||
width: 360,
|
||||
render: (_: unknown, row: DailyMileageRow) => (
|
||||
<Space spacing={4} wrap>
|
||||
<Button disabled={!canOpenVehicle(row.vin)} onClick={() => copyMileageEvidence(row)}>复制证据</Button>
|
||||
<Button disabled={!canOpenVehicle(row.vin) || !onOpenHistory} onClick={() => openMileageEvidence(row)}>核对轨迹</Button>
|
||||
<Button disabled={!canOpenVehicle(row.vin) || !onOpenRaw} onClick={() => openMileageRawEvidence(row)}>核对 RAW</Button>
|
||||
<Button disabled={!canOpenVehicle(row.vin)} onClick={() => onOpenVehicle(row.vin, row.source)}>车辆服务</Button>
|
||||
|
||||
Reference in New Issue
Block a user