打卡记录导出增加身份证号列

This commit is contained in:
caoqianming 2022-10-26 17:58:59 +08:00
parent 6f6ee439d7
commit fe2ae8cd35
1 changed files with 8 additions and 3 deletions

View File

@ -27,7 +27,8 @@ from apps.utils.export import export_excel
from apps.utils.viewsets import CustomGenericViewSet, CustomModelViewSet
from rest_framework.permissions import IsAuthenticated
epTypeOptions = {'employee': '正式员工', 'remployee': '相关方', 'visitor': '访客', 'driver': '货车司机'}
epTypeOptions = {'employee': '正式员工', 'remployee': '相关方',
'visitor': '访客', 'driver': '货车司机'}
crOptions = {10: '上班打卡', 20: '下班打卡'}
# Create your views here.
@ -87,7 +88,8 @@ class EmployeeViewSet(CustomModelViewSet):
serializer.is_valid(raise_exception=True)
vdata = serializer.validated_data
if vdata.get('photo', None):
dhClient.request(**dhapis['person_img_upload'], file_path_rela=vdata['photo'])
dhClient.request(**dhapis['person_img_upload'],
file_path_rela=vdata['photo'])
serializer.save()
if ep.type == 'remployee':
from apps.rpm.services import sync_to_rep
@ -232,7 +234,8 @@ class ClockRecordViewSet(ListModelMixin, CustomGenericViewSet):
"""导出excel
导出excel
"""
field_data = ['人员类型', '人员', '所属部门', '打卡类型', '触发形式', '体温', '打卡时间']
field_data = ['人员类型', '人员', '编号', '身份证号',
'所属部门', '打卡类型', '触发形式', '体温', '打卡时间']
queryset = self.filter_queryset(self.get_queryset())
odata = ClockRecordListSerializer(queryset, many=True).data
# 处理数据
@ -241,6 +244,8 @@ class ClockRecordViewSet(ListModelMixin, CustomGenericViewSet):
data.append(
[epTypeOptions[i['employee_']['type']],
i['employee_']['name'],
i['employee_']['number'],
i['employee_']['id_number'],
i['employee_']['belong_dept_name'],
crOptions[i['type']],
i['detail'].get('deviceName', None),