From 3365f9ddeb68fc7e30b3a403a08533e04ac5cff1 Mon Sep 17 00:00:00 2001
From: zhou <123@>
Date: Thu, 14 Aug 2025 11:09:07 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../controllers/applet_attendance.py | 30 +++++++++++++------
yuthon_work_brand/views/hr_menus.xml | 10 +++----
2 files changed, 26 insertions(+), 14 deletions(-)
diff --git a/yuthon_hr_attendance/controllers/applet_attendance.py b/yuthon_hr_attendance/controllers/applet_attendance.py
index b4aa1d320..8777b3700 100644
--- a/yuthon_hr_attendance/controllers/applet_attendance.py
+++ b/yuthon_hr_attendance/controllers/applet_attendance.py
@@ -410,10 +410,11 @@ class AppletAttendance(Controller):
}
return json.dumps(return_data)
- # 处理考勤记录
def process_attendances(self, attendances, user_id):
records = []
for att in attendances:
+ is_weekend = att.current_data.weekday() in [5, 6]
+
if not att.shift_id:
year = att.current_data.year
month = att.current_data.month
@@ -448,29 +449,39 @@ class AppletAttendance(Controller):
check_out = att.check_out
is_early_card = att.is_early_card
is_late_card = att.is_late_card
- check_in_status = '缺卡' if not check_in else ('迟到' if is_late_card else '正常')
- check_out_status = '缺卡' if not check_out else ('早退' if is_early_card else '正常')
+
+ base_check_in_status = '缺卡' if not check_in else ('迟到' if is_late_card else '正常')
+ base_check_out_status = '缺卡' if not check_out else ('早退' if is_early_card else '正常')
+
+ if is_weekend:
+ check_in_status = '正常'
+ check_out_status = '正常'
+ else:
+ check_in_status = base_check_in_status
+ check_out_status = base_check_out_status
+
if check_in:
check_in_time = (check_in + timedelta(hours=8)).strftime('%H:%M:%S')
check_in_str = f"{check_in_status} {check_in_time}" if check_in_status in ['迟到',
'早退'] else check_in_time
else:
- check_in_str = '缺卡'
+ check_in_str = '正常' if is_weekend else '缺卡'
if check_out:
check_out_time = (check_out + timedelta(hours=8)).strftime('%H:%M:%S')
check_out_str = f"{check_out_status} {check_out_time}" if check_out_status in ['迟到',
'早退'] else check_out_time
else:
- check_out_str = '缺卡'
+ check_out_str = '正常' if is_weekend else '缺卡'
- if not check_in_status and not check_out_status:
- color_select = 3
+ if is_weekend:
+ has_exception = False # 周末任何情况都不算异常
else:
has_exception = (check_in_status in ['迟到', '早退', '缺卡']) or (
check_out_status in ['迟到', '早退', '缺卡'])
- color_select = 2 if has_exception else 1
- # 添加到记录列表
+
+ color_select = 2 if has_exception else 1
+
records.append({
'date': att.current_data.strftime('%Y/%m/%d'),
'class': [f"{att.shift_name} ", f"{standard_check_in_str}-{standard_check_out_str}"],
@@ -478,6 +489,7 @@ class AppletAttendance(Controller):
'check_in': check_in_str,
'check_out': check_out_str,
'color_select': color_select,
+ 'is_weekend': is_weekend
})
return records
diff --git a/yuthon_work_brand/views/hr_menus.xml b/yuthon_work_brand/views/hr_menus.xml
index 36e0f6c30..e808918aa 100644
--- a/yuthon_work_brand/views/hr_menus.xml
+++ b/yuthon_work_brand/views/hr_menus.xml
@@ -184,11 +184,6 @@
parent="hr_attendance_root_board_menu"
sequence="19"
action="yuthon_hr_attendance.applet_security_action"/>
-
-
-
-
-
@@ -248,6 +243,11 @@
parent="attendance_resources_setting_root_board"
action="yuthon_holiday.view_yuthon_holiday_setting_action"
sequence="30"/>
+