|
|
@@ -47,7 +47,7 @@ function isWeekend(date: Date): boolean {
|
|
|
|
|
|
/**
|
|
|
* 生成指定月份的模拟考勤数据
|
|
|
- * 注:使用固定值作为展示层修复(业务需求:22天,100%)
|
|
|
+ * 使用固定值:22天正常出勤,100%出勤率,无迟到早退
|
|
|
* @param year 年份
|
|
|
* @param month 月份 (1-12)
|
|
|
* @returns 考勤统计数据和打卡记录
|
|
|
@@ -58,6 +58,7 @@ export function generateMockAttendanceData(year: number, month: number): {
|
|
|
} {
|
|
|
const dates = getDatesInMonth(year, month)
|
|
|
const records: AttendanceRecord[] = []
|
|
|
+ let workDayCount = 0
|
|
|
|
|
|
// 从后向前生成记录(倒序)
|
|
|
for (let i = dates.length - 1; i >= 0; i--) {
|
|
|
@@ -75,37 +76,22 @@ export function generateMockAttendanceData(year: number, month: number): {
|
|
|
status: AttendanceStatus.NORMAL
|
|
|
})
|
|
|
} else {
|
|
|
- // 工作日随机生成打卡记录
|
|
|
- const random = Math.random()
|
|
|
- let status = AttendanceStatus.NORMAL
|
|
|
- let checkInTime = '08:30'
|
|
|
- let checkOutTime = '17:30'
|
|
|
-
|
|
|
- // 10%概率迟到
|
|
|
- if (random < 0.1) {
|
|
|
- status = AttendanceStatus.LATE
|
|
|
- checkInTime = '09:15'
|
|
|
- }
|
|
|
- // 10%概率早退(排除迟到的情况)
|
|
|
- else if (random >= 0.1 && random < 0.2) {
|
|
|
- status = AttendanceStatus.EARLY_LEAVE
|
|
|
- checkOutTime = '16:30'
|
|
|
- }
|
|
|
-
|
|
|
+ // 工作日全部正常打卡
|
|
|
+ workDayCount++
|
|
|
records.push({
|
|
|
date: formatDate(date),
|
|
|
weekday,
|
|
|
- checkInTime,
|
|
|
- checkOutTime,
|
|
|
- status
|
|
|
+ checkInTime: '08:30',
|
|
|
+ checkOutTime: '17:30',
|
|
|
+ status: AttendanceStatus.NORMAL
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 使用固定值作为展示层修复(业务需求:22天,100%)
|
|
|
+ // 固定统计数据:符合业务需求
|
|
|
const stats: AttendanceStats = {
|
|
|
attendanceRate: 100,
|
|
|
- normalDays: 22,
|
|
|
+ normalDays: workDayCount,
|
|
|
lateCount: 0,
|
|
|
earlyLeaveCount: 0,
|
|
|
absentCount: 0
|
|
|
@@ -154,3 +140,4 @@ export function getNextMonth(year: number, month: number): { year: number; month
|
|
|
}
|
|
|
return { year, month: month + 1 }
|
|
|
}
|
|
|
+
|