Przeglądaj źródła

feat(attendance): 优化详情卡状态标签展示逻辑,确保优先级正确

xieyong 1 miesiąc temu
rodzic
commit
84cba3dad3
1 zmienionych plików z 8 dodań i 1 usunięć
  1. 8 1
      src/pages/attendance/index.vue

+ 8 - 1
src/pages/attendance/index.vue

@@ -401,7 +401,14 @@ const detail = computed(() => {
   if (isRest && !d.actualIn && !d.actualOut && !augmentedList.includes('REST')) {
     augmentedList.push('REST')
   }
-  const statusLabel = augmentedList.length > 0 ? translateStatus(augmentedList) : ''
+  // 详情卡的 statusLabel 只能展示一个名称,否则会出现"正常 / 迟到"这种自相矛盾的标签。
+  // 优先级:异常 (LATE/EARLY/ABSENT) > 请假 > 休息 > 正常
+  const STATUS_PRIORITY = ["LATE", "EARLY", "ABSENT", "LEAVE", "REST", "NORMAL"]
+  let picked = null
+  for (const s of STATUS_PRIORITY) {
+    if (augmentedList.includes(s)) { picked = s; break }
+  }
+  const statusLabel = picked ? translateStatus(picked) : ''
   return { shiftText, inText, outText, inLabel, outLabel, workText, statusLabel, actualOut: d.actualOut };
 });