diff --git a/yuthon_hr_attendance/controllers/applet_attendance.py b/yuthon_hr_attendance/controllers/applet_attendance.py
index da54704db..e350e0b52 100644
--- a/yuthon_hr_attendance/controllers/applet_attendance.py
+++ b/yuthon_hr_attendance/controllers/applet_attendance.py
@@ -412,10 +412,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
@@ -450,29 +451,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}"],
@@ -480,6 +491,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"/>
+