| | |
| | | workHours?: number; |
| | | overtimeHours?: number; |
| | | location?: string; |
| | | /** 上班打卡经度(WGS84) */ |
| | | clockInLongitude?: number; |
| | | /** 上班打卡纬度(WGS84) */ |
| | | clockInLatitude?: number; |
| | | /** 上班定位精度,米 */ |
| | | clockInAccuracy?: number; |
| | | /** 上班距打卡地点距离,米 */ |
| | | clockInDistance?: number; |
| | | /** 上班打卡地点地址快照 */ |
| | | clockInAddress?: string; |
| | | /** 下班打卡经度(WGS84) */ |
| | | clockOutLongitude?: number; |
| | | /** 下班打卡纬度(WGS84) */ |
| | | clockOutLatitude?: number; |
| | | /** 下班定位精度,米 */ |
| | | clockOutAccuracy?: number; |
| | | /** 下班距打卡地点距离,米 */ |
| | | clockOutDistance?: number; |
| | | /** 下班打卡地点地址快照 */ |
| | | clockOutAddress?: string; |
| | | dataSource?: number; |
| | | dataSourceName?: string; |
| | | remark?: string; |
| | |
| | | overtimeHours?: number; |
| | | totalWorkHours?: number; |
| | | } |
| | | } |
| | | |
| | | /** 定位打卡坐标,后端仅接受 WGS84 */ |
| | | export interface AttendanceClockLocation { |
| | | longitude: number; |
| | | latitude: number; |
| | | accuracy: number; |
| | | coordinateSystem: 'WGS84'; |
| | | } |
| | | |
| | | /** 定位打卡结果;未启用定位范围校验时,距离与半径为空 */ |
| | | export interface AttendanceClockResponse { |
| | | record?: HrmAttendanceRecordApi.AttendanceRecord; |
| | | locationName?: string; |
| | | distanceMeters?: number; |
| | | radiusMeters?: number; |
| | | withinRange?: boolean; |
| | | } |
| | | |
| | | /** 查询考勤记录分页列表 */ |
| | |
| | | return requestClient.download('/hrm/attendance/record/export-excel', { params }); |
| | | } |
| | | |
| | | /** 上班打卡 */ |
| | | export function clockIn(params: { location: string }) { |
| | | return requestClient.post<HrmAttendanceRecordApi.AttendanceRecord>( |
| | | /** |
| | | * 上班打卡 |
| | | * |
| | | * 同时提交定位(JSON body)与旧版地点文本(query 参数): |
| | | * - 新后端按定位校验打卡范围,未启用定位时忽略定位; |
| | | * - 旧后端只读取 location 参数,保证升级前后都能正常打卡。 |
| | | */ |
| | | export function clockIn( |
| | | data?: AttendanceClockLocation | null, |
| | | location?: string, |
| | | ) { |
| | | return requestClient.post<AttendanceClockResponse>( |
| | | '/hrm/attendance/record/clock-in', |
| | | null, |
| | | { params }, |
| | | data ?? null, |
| | | location ? { params: { location } } : undefined, |
| | | ); |
| | | } |
| | | |
| | | /** 下班打卡 */ |
| | | export function clockOut(params: { location: string }) { |
| | | return requestClient.post<HrmAttendanceRecordApi.AttendanceRecord>( |
| | | /** 下班打卡,参数说明同 clockIn */ |
| | | export function clockOut( |
| | | data?: AttendanceClockLocation | null, |
| | | location?: string, |
| | | ) { |
| | | return requestClient.post<AttendanceClockResponse>( |
| | | '/hrm/attendance/record/clock-out', |
| | | null, |
| | | { params }, |
| | | data ?? null, |
| | | location ? { params: { location } } : undefined, |
| | | ); |
| | | } |