From a385917c1f82edbdf1063ac1505bc9b57c6c1108 Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期五, 30 十月 2026 21:46:11 +0800
Subject: [PATCH] feat(hrm,bi): 移植长辉电力的考勤请假展示与 BI 大屏

---
 src/views/hrm/attendance/record/data.ts |   57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 56 insertions(+), 1 deletions(-)

diff --git a/src/views/hrm/attendance/record/data.ts b/src/views/hrm/attendance/record/data.ts
index 933798f..ce59bac 100644
--- a/src/views/hrm/attendance/record/data.ts
+++ b/src/views/hrm/attendance/record/data.ts
@@ -3,10 +3,44 @@
 import type { HrmAttendanceRecordApi } from '#/api/hrm/attendance/record';
 
 import { DICT_TYPE } from '#/packages/constants/src';
-import { getDictOptions } from '#/packages/effects/hooks/src';
+import { getDictLabel, getDictOptions } from '#/packages/effects/hooks/src';
 
 import { getDeptList } from '#/api/system/dept';
 import { handleTree } from '#/packages/utils/src';
+
+/** 璇峰亣绫诲瀷鐨勫厹搴曞悕绉帮紝涓庡悗绔� HrmLeaveTypeEnum 淇濇寔涓�鑷� */
+const LEAVE_TYPE_FALLBACK_LABELS: Record<number, string> = {
+  1: '浜嬪亣',
+  2: '鐥呭亣',
+  3: '骞村亣',
+  4: '濠氬亣',
+  5: '浜у亣',
+  6: '涓у亣',
+};
+
+/**
+ * 璇峰亣绫诲瀷鐨勫瓧鍏告爣绛�
+ *
+ * 瀛楀吀 hrm_leave_type 鏈悓姝ユ椂杩斿洖绌轰覆锛岀敱璋冪敤鏂瑰喅瀹氬厹搴曪紝
+ * 閬垮厤杩欑被鐜鎶婅鍋囩被鍨嬫樉绀烘垚 "-" 鑰岃浜鸿浠ヤ负娌℃湁璇峰亣銆�
+ */
+export function getLeaveTypeLabel(type: number | string) {
+  const label = getDictLabel(DICT_TYPE.HRM_LEAVE_TYPE, String(type));
+  return label || LEAVE_TYPE_FALLBACK_LABELS[Number(type)] || '';
+}
+
+/** 鎶� leaveTypes锛堝 "1,2"锛夌炕璇戞垚璇峰亣绫诲瀷鍚嶇О锛屽娈电敤椤垮彿鍒嗛殧 */
+export function formatLeaveTypeNames(leaveTypes?: string) {
+  if (!leaveTypes) {
+    return '';
+  }
+  return leaveTypes
+    .split(',')
+    .map((type) => type.trim())
+    .filter(Boolean)
+    .map((type) => getLeaveTypeLabel(type) || type)
+    .join('銆�');
+}
 
 /** 鍒楄〃鐨勬悳绱㈣〃鍗� */
 export function useGridFormSchema(): VbenFormSchema[] {
@@ -67,6 +101,19 @@
         placeholder: '璇烽�夋嫨涓嬬彮鎵撳崱绫诲瀷',
       },
     },
+    {
+      fieldName: 'leaveFlag',
+      label: '鏄惁璇峰亣',
+      component: 'Select',
+      componentProps: {
+        allowClear: true,
+        options: [
+          { label: '宸茶鍋�', value: true },
+          { label: '鏈鍋�', value: false },
+        ],
+        placeholder: '璇烽�夋嫨鏄惁璇峰亣',
+      },
+    },
   ];
 }
 
@@ -96,6 +143,14 @@
         props: { type: DICT_TYPE.HRM_CLOCK_TYPE },
       },
     },
+    {
+      field: 'leaveFlag',
+      title: '璇峰亣',
+      width: 160,
+      slots: {
+        default: 'leave',
+      },
+    },
     { field: 'workHours', title: '宸ヤ綔鏃堕暱(h)', width: 100 },
     { field: 'overtimeHours', title: '鍔犵彮鏃堕暱(h)', width: 100 },
     { field: 'location', title: '鎵撳崱鍦扮偣', minWidth: 150 },

--
Gitblit v1.9.3