feat: sync vehicle monitoring and accumulated platform updates

Add monitoring metrics, numeric sorting, report-time display, vehicle number labels, and map layout fixes. Include accumulated mileage, hydrogen, OneOS authentication, open platform, ingestion, deployment, and UI updates.

Exclude temporary files, generated reports, and credentials. Validate frontend 632 tests and production build, API packages, vehicle-map tests, and release installer tests. Gateway suite has one pre-existing date-sensitive identity throttling test failure reproduced on the parent commit.
This commit is contained in:
lingniu
2026-10-26 18:05:59 +08:00
parent 8b32ae2988
commit d6b957dfc8
290 changed files with 28238 additions and 1647 deletions
@@ -93,6 +93,15 @@ export async function createMileageWorkbook(input: MileageExportInput) {
if (!rowsByVin.has(row.vin)) rowsByVin.set(row.vin, new Map());
rowsByVin.get(row.vin)!.set(row.date, row);
}
// ExcelJS retains every cell until ZIP serialization. Share immutable style
// objects instead of allocating fonts, fills and borders per vehicle-day.
const bodyStyles = [0, 1].map((parity) => Array.from({ length: 5 }, (_, kind) => ({
font: { name: kind === 1 ? 'Consolas' : 'Microsoft YaHei', size: kind === 1 ? 9 : 10, color: { argb: kind === 3 ? 'FF1D4E89' : 'FF34445A' }, bold: kind === 0 || kind === 3 },
alignment: { vertical: 'middle' as const, horizontal: kind <= 1 || kind === 4 ? 'left' as const : 'right' as const },
fill: { type: 'pattern' as const, pattern: 'solid' as const, fgColor: { argb: kind === 3 ? (parity ? 'FFEDF5FF' : 'FFF4F8FE') : (parity ? 'FFF9FBFD' : 'FFFFFFFF') } },
border: { bottom: { style: 'thin' as const, color: { argb: 'FFE6ECF3' } } },
...((kind === 2 || kind === 3) ? { numFmt: '#,##0.0" km"' } : {})
})));
input.vehicles.forEach((vehicle, index) => {
const rowNumber = firstDataRow + index;
const mileageByDate = rowsByVin.get(vehicle.vin) ?? new Map<string, MileageWorkbookRow>();
@@ -102,17 +111,13 @@ export async function createMileageWorkbook(input: MileageExportInput) {
row.values = [vehicle.plate || '未绑定', vehicle.vin, vehicle.brandName || '待维护', vehicle.modelName || '待维护', ...dailyValues, null];
row.height = 25;
row.eachCell({ includeEmpty: true }, (cell, columnNumber) => {
cell.font = { name: columnNumber === 2 ? 'Consolas' : 'Microsoft YaHei', size: columnNumber === 2 ? 9 : 10, color: { argb: columnNumber === totalColumn ? 'FF1D4E89' : 'FF34445A' }, bold: columnNumber === 1 || columnNumber === totalColumn };
cell.alignment = { vertical: 'middle', horizontal: columnNumber <= 4 ? 'left' : 'right' };
cell.fill = { type: 'pattern', pattern: 'solid', fgColor: { argb: index % 2 ? 'FFF9FBFD' : 'FFFFFFFF' } };
cell.border = { bottom: { style: 'thin', color: { argb: 'FFE6ECF3' } } };
if (columnNumber >= firstDateColumn) cell.numFmt = '#,##0.0" km"';
const kind = columnNumber === totalColumn ? 3 : columnNumber >= firstDateColumn ? 2 : columnNumber === 2 ? 1 : columnNumber === 1 ? 0 : 4;
cell.style = bodyStyles[index % 2][kind];
});
const dateStart = excelColumn(firstDateColumn);
const dateEnd = excelColumn(lastDateColumn);
const totalCell = sheet.getCell(rowNumber, totalColumn);
totalCell.value = { formula: `SUM(${dateStart}${rowNumber}:${dateEnd}${rowNumber})`, result: total };
totalCell.fill = { type: 'pattern', pattern: 'solid', fgColor: { argb: index % 2 ? 'FFEDF5FF' : 'FFF4F8FE' } };
row.commit();
});
@@ -135,7 +140,11 @@ export async function createMileageWorkbook(input: MileageExportInput) {
}
sheet.headerFooter.oddFooter = '&L灵牛车辆数据中台&C第 &P / &N 页&R导出于 ' + localDateTime(exportedAt);
const hydrogenSheet = primaryHydrogenSheet ?? workbook.addWorksheet('氢能明细');
// A GPS annual report must not allocate a 24-column energy row for every
// vehicle-day (300,000 days otherwise become 7.2 million extra cells).
if (input.metricView !== 'hydrogen') return workbook;
const hydrogenSheet = primaryHydrogenSheet!;
hydrogenSheet.views = [{ state: 'frozen', xSplit: 2, ySplit: 1, activeCell: 'C2', showGridLines: false }];
hydrogenSheet.properties.defaultRowHeight = 21;
const hydrogenHeaders = [