|
@@ -30,7 +30,6 @@ type MetricField = Exclude<keyof IotProjectTaskPlanSummaryItem, 'yearMonth'>
|
|
|
interface MonthColumn {
|
|
interface MonthColumn {
|
|
|
key: string
|
|
key: string
|
|
|
label: string
|
|
label: string
|
|
|
- sortValue: number
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
interface SummaryTableRow {
|
|
interface SummaryTableRow {
|
|
@@ -53,6 +52,7 @@ const BUSINESS_METRICS: Record<string, { field: MetricField; unit: string }> = {
|
|
|
|
|
|
|
|
const monthColumns = ref<MonthColumn[]>([])
|
|
const monthColumns = ref<MonthColumn[]>([])
|
|
|
const tableData = ref<SummaryTableRow[]>([])
|
|
const tableData = ref<SummaryTableRow[]>([])
|
|
|
|
|
+const tableColumnKey = computed(() => monthColumns.value.map((month) => month.key).join('|'))
|
|
|
|
|
|
|
|
const normalizeMonth = (yearMonth: string): MonthColumn => {
|
|
const normalizeMonth = (yearMonth: string): MonthColumn => {
|
|
|
const matched = String(yearMonth).match(/^(\d{4})[-/](\d{1,2})/)
|
|
const matched = String(yearMonth).match(/^(\d{4})[-/](\d{1,2})/)
|
|
@@ -60,8 +60,7 @@ const normalizeMonth = (yearMonth: string): MonthColumn => {
|
|
|
if (!matched) {
|
|
if (!matched) {
|
|
|
return {
|
|
return {
|
|
|
key: String(yearMonth),
|
|
key: String(yearMonth),
|
|
|
- label: String(yearMonth),
|
|
|
|
|
- sortValue: Number.MAX_SAFE_INTEGER
|
|
|
|
|
|
|
+ label: String(yearMonth)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -70,8 +69,7 @@ const normalizeMonth = (yearMonth: string): MonthColumn => {
|
|
|
|
|
|
|
|
return {
|
|
return {
|
|
|
key: `${year}-${String(month).padStart(2, '0')}`,
|
|
key: `${year}-${String(month).padStart(2, '0')}`,
|
|
|
- label: `${year}-${month}`,
|
|
|
|
|
- sortValue: year * 100 + month
|
|
|
|
|
|
|
+ label: `${year}-${month}`
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -101,9 +99,7 @@ const buildTableData = (list: IotProjectTaskPlanSummaryVO[]) => {
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- monthColumns.value = Array.from(columnMap.values()).sort(
|
|
|
|
|
- (left, right) => left.sortValue - right.sortValue || left.label.localeCompare(right.label)
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ monthColumns.value = Array.from(columnMap.values())
|
|
|
|
|
|
|
|
tableData.value = list.flatMap((project) => {
|
|
tableData.value = list.flatMap((project) => {
|
|
|
const businesses = splitBusinesses(project.business)
|
|
const businesses = splitBusinesses(project.business)
|
|
@@ -242,6 +238,7 @@ watch(
|
|
|
<el-auto-resizer class="absolute inset-0">
|
|
<el-auto-resizer class="absolute inset-0">
|
|
|
<template #default="{ width, height }">
|
|
<template #default="{ width, height }">
|
|
|
<ZmTable
|
|
<ZmTable
|
|
|
|
|
+ :key="tableColumnKey"
|
|
|
:data="tableData"
|
|
:data="tableData"
|
|
|
:loading="loading"
|
|
:loading="loading"
|
|
|
:width="width"
|
|
:width="width"
|