diff --git a/apps/hrm/views.py b/apps/hrm/views.py index 72e59b40..358f8c61 100755 --- a/apps/hrm/views.py +++ b/apps/hrm/views.py @@ -30,7 +30,8 @@ from rest_framework.permissions import IsAuthenticated epTypeOptions = {'employee': '正式员工', 'remployee': '相关方', 'visitor': '访客', 'driver': '货车司机'} -crOptions = {10: '上班打卡', 20: '下班打卡'} +crOptions = {10: '上班打卡', 20: '下班打卡', 30: ''} +crEoptions = {10: '在岗时间短', 20: '在岗时间长', 30: '缺卡', 40: '加班'} # Create your views here. @@ -235,9 +236,8 @@ class ClockRecordViewSet(ListModelMixin, CustomGenericViewSet): """导出excel 导出excel """ - field_data = ['人员类型', '人员', '编号', '身份证号', - '所属部门', '打卡类型', '触发形式', '体温', '打卡时间'] - queryset = self.filter_queryset(self.get_queryset()).filter(type__in=[10, 20]) + field_data = ['人员类型', '人员', '编号', '身份证号', '所属部门', '触发形式', '打卡时间', '打卡推测', '异常推测'] + queryset = self.filter_queryset(self.get_queryset()) odata = ClockRecordListSerializer(queryset, many=True).data # 处理数据 data = [] @@ -248,10 +248,10 @@ class ClockRecordViewSet(ListModelMixin, CustomGenericViewSet): i['employee_']['number'], i['employee_']['id_number'], i['employee_'].get('belong_dept_name', ''), - crOptions[i['type']], i['detail'].get('deviceName', None), - i['detail'].get('curTemp', None), - i['create_time']] + i['create_time']], + crOptions[i['type']], + crEoptions[i['exception_type']] ) return Response({'path': export_excel(field_data, data, '打卡记录')})