This commit is contained in:
@@ -11,7 +11,7 @@ interface ExportContext {
|
||||
|
||||
const BASE_HEADERS = [
|
||||
'状态', '数据来源', '车牌号', '客户', '业务部门', '项目', '租赁状态',
|
||||
'运营区域',
|
||||
'运营区域', '有效天数', '缺失天数', '异常天数', '质量说明',
|
||||
] as const;
|
||||
|
||||
function sourceLabel(v: MonitoringVehicle): string {
|
||||
@@ -22,6 +22,7 @@ function sourceLabel(v: MonitoringVehicle): string {
|
||||
}
|
||||
|
||||
function statusLabel(v: MonitoringVehicle): string {
|
||||
if (v.qualityStatus) return { NORMAL: '有效', PARTIAL_DATA: '部分缺失', NO_DATA: '无数据', DATA_ANOMALY: '部分异常' }[v.qualityStatus];
|
||||
if (!v.isDataSynced) return '未对接';
|
||||
return v.isOnline ? '在线' : '离线';
|
||||
}
|
||||
@@ -30,7 +31,7 @@ function mileageCell(v: MonitoringVehicle, kind: 'today' | 'total'): string | nu
|
||||
if (kind === 'today') {
|
||||
return monitoringMileageValue(v);
|
||||
}
|
||||
return v.totalKm != null ? v.totalKm : '未对接';
|
||||
return v.totalKm != null ? v.totalKm : '—';
|
||||
}
|
||||
|
||||
export function exportMileageXlsx(vehicles: MonitoringVehicle[], ctx: ExportContext): void {
|
||||
@@ -62,7 +63,7 @@ export function exportMileageXlsx(vehicles: MonitoringVehicle[], ctx: ExportCont
|
||||
v.department || '',
|
||||
v.project || '',
|
||||
v.rentStatus || '',
|
||||
v.region || '',
|
||||
v.region || '', v.validDays ?? '', v.missingDays ?? '', v.anomalyDays ?? '', v.qualityReasons?.join(', ') || '',
|
||||
];
|
||||
const dailyCols = dayKeys.map(day => v.dailyMileage?.[day] ?? '—');
|
||||
return [
|
||||
@@ -86,6 +87,7 @@ export function exportMileageXlsx(vehicles: MonitoringVehicle[], ctx: ExportCont
|
||||
{ wch: 16 }, // 项目
|
||||
{ wch: 10 }, // 租赁状态
|
||||
{ wch: 12 }, // 运营区域
|
||||
{ wch: 10 }, { wch: 10 }, { wch: 10 }, { wch: 36 },
|
||||
];
|
||||
for (let i = 0; i < dayKeys.length; i++) wsCols.push({ wch: 12 });
|
||||
wsCols.push({ wch: 14 }); // 区间合计
|
||||
@@ -177,6 +179,6 @@ export function exportMileageXlsx(vehicles: MonitoringVehicle[], ctx: ExportCont
|
||||
: ctx.sortBy === 'statisticTime'
|
||||
? '统计时间'
|
||||
: isRange ? '区间' : '今日';
|
||||
const filename = `里程看板_${dateTag}_${hh}${mm}_${sortLabel}.xlsx`;
|
||||
const filename = `${dayKeys.length ? '里程逐日明细' : '里程区间汇总'}_${dateTag}_${hh}${mm}_${sortLabel}.xlsx`;
|
||||
XLSX.writeFile(wb, filename);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user