联调电镀数据页面

This commit is contained in:
guanj
2026-06-01 20:35:26 +08:00
parent c2f23aa957
commit 7deafa6d69
6 changed files with 1378 additions and 478 deletions

View File

@@ -1,4 +1,3 @@
const dataProcessing = (arr: any[]) => {
return arr
.filter(item => typeof item === 'number' || (typeof item === 'string' && !isNaN(parseFloat(item))))
@@ -258,6 +257,32 @@ export const completeTimeSeries = (rawData: string[][]): (string | null)[][] =>
}
})
// 补首尾边界:首日 00:00:00、末日 23:59:59
const createPadItem = (timeStr: string): (string | null | undefined)[] => {
const result: (string | null | undefined)[] = [timeStr, '/']
if (template.length > 2) result.push(template[2])
if (template.length > 3) result.push(template[3])
return result
}
const firstDate = new Date(completedData[0][0] as string)
const dayStartStr = formatTime(
new Date(firstDate.getFullYear(), firstDate.getMonth(), firstDate.getDate(), 0, 0, 0)
)
const lastDate = new Date(completedData[completedData.length - 1][0] as string)
const dayEndStr = formatTime(new Date(lastDate.getFullYear(), lastDate.getMonth(), lastDate.getDate(), 23, 59, 59))
const firstTimeStr = formatTime(new Date(completedData[0][0] as string))
if (firstTimeStr !== dayStartStr) {
completedData.unshift(createPadItem(dayStartStr))
}
const lastTimeStr = formatTime(new Date(completedData[completedData.length - 1][0] as string))
if (lastTimeStr !== dayEndStr) {
completedData.push(createPadItem(dayEndStr))
}
return completedData
}