Kaynağa Gözat

feat(pms): 新增计划工作汇总统计页面

- 接入计划工作汇总统计接口
- 支持组织和年度时间范围筛选
- 按接口顺序动态生成月份列
- 支持多项目业务拆行及项目名称合并
- 增加行合计和列合计
- 使用 ZmTable 展示汇总数据
Zimo 1 hafta önce
ebeveyn
işleme
888375e7e4
1 değiştirilmiş dosya ile 5 ekleme ve 8 silme
  1. 5 8
      src/views/pms/plan-work/index.vue

+ 5 - 8
src/views/pms/plan-work/index.vue

@@ -30,7 +30,6 @@ type MetricField = Exclude<keyof IotProjectTaskPlanSummaryItem, 'yearMonth'>
 interface MonthColumn {
   key: string
   label: string
-  sortValue: number
 }
 
 interface SummaryTableRow {
@@ -53,6 +52,7 @@ const BUSINESS_METRICS: Record<string, { field: MetricField; unit: string }> = {
 
 const monthColumns = ref<MonthColumn[]>([])
 const tableData = ref<SummaryTableRow[]>([])
+const tableColumnKey = computed(() => monthColumns.value.map((month) => month.key).join('|'))
 
 const normalizeMonth = (yearMonth: string): MonthColumn => {
   const matched = String(yearMonth).match(/^(\d{4})[-/](\d{1,2})/)
@@ -60,8 +60,7 @@ const normalizeMonth = (yearMonth: string): MonthColumn => {
   if (!matched) {
     return {
       key: String(yearMonth),
-      label: String(yearMonth),
-      sortValue: Number.MAX_SAFE_INTEGER
+      label: String(yearMonth)
     }
   }
 
@@ -70,8 +69,7 @@ const normalizeMonth = (yearMonth: string): MonthColumn => {
 
   return {
     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) => {
     const businesses = splitBusinesses(project.business)
@@ -242,6 +238,7 @@ watch(
         <el-auto-resizer class="absolute inset-0">
           <template #default="{ width, height }">
             <ZmTable
+              :key="tableColumnKey"
               :data="tableData"
               :loading="loading"
               :width="width"