|
|
@@ -4,6 +4,7 @@ import { cancelAllRequests, IotStatApi } from '@/api/pms/stat'
|
|
|
import { useTableComponents } from '@/components/ZmTable/useTableComponents'
|
|
|
import { rangeShortcuts } from '@/utils/formatTime'
|
|
|
import { useMqtt } from '@/utils/useMqtt'
|
|
|
+import { toExcelDateValue } from './excelDate'
|
|
|
import {
|
|
|
Dimensions,
|
|
|
formatChartValue,
|
|
|
@@ -1014,13 +1015,13 @@ function buildExportRows(selectedDimensions: Dimensions[]) {
|
|
|
new Map((chartData.value[dimension.name] || []).map((point) => [point.ts, point.value]))
|
|
|
])
|
|
|
)
|
|
|
- const rows: Array<Array<string | number | Date | null>> = [
|
|
|
+ const rows: Array<Array<string | number | null>> = [
|
|
|
['时间', ...selectedDimensions.map((dimension) => dimension.name)]
|
|
|
]
|
|
|
|
|
|
timestamps.forEach((timestamp) => {
|
|
|
rows.push([
|
|
|
- new Date(timestamp),
|
|
|
+ toExcelDateValue(timestamp),
|
|
|
...selectedDimensions.map(
|
|
|
(dimension) => valuesByDimension.get(dimension.name)?.get(timestamp) ?? null
|
|
|
)
|
|
|
@@ -1054,7 +1055,7 @@ async function exportChartData() {
|
|
|
|
|
|
exportDataLoading.value = true
|
|
|
try {
|
|
|
- const worksheet = XLSX.utils.aoa_to_sheet(rows, { cellDates: true })
|
|
|
+ const worksheet = XLSX.utils.aoa_to_sheet(rows)
|
|
|
worksheet['!cols'] = [{ wch: 22 }, ...selectedDimensions.map(() => ({ wch: 20 }))]
|
|
|
|
|
|
timestamps.forEach((_, index) => {
|