tdevice 增加 door_auth_list

This commit is contained in:
曹前明 2022-07-12 15:57:36 +08:00
parent f21c37e84f
commit aee59ca56b
4 changed files with 28 additions and 2 deletions

View File

@ -0,0 +1,18 @@
# Generated by Django 3.2.12 on 2022-07-12 07:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('third', '0005_alter_tdevice_employee'),
]
operations = [
migrations.AddField(
model_name='tdevice',
name='door_auth_list',
field=models.JSONField(blank=True, default=list, verbose_name='自动下发人员类型列表'),
),
]

View File

@ -43,6 +43,7 @@ class TDevice(BaseModel):
employee = models.OneToOneField(Employee, verbose_name='当前绑定人员', on_delete=models.CASCADE,
null=True, blank=True)
is_clock = models.BooleanField('是否打卡设备', default=False)
door_auth_list = models.JSONField('自动下发人员类型列表', default=list, blank=True)
third_info = models.JSONField('三方信息', default=dict,
null=False, blank=True)

View File

@ -20,6 +20,12 @@ class TDeviceSerializer(CustomModelSerializer):
fields = '__all__'
class TDeviceUpdateSerializer(CustomModelSerializer):
class Meta:
model = TDevice
fields = ['is_clock', 'door_auth_list']
class TDeviceSimpleSerializer(CustomModelSerializer):
class Meta:
model = TDevice
@ -48,6 +54,7 @@ class BindAreaSerializer(serializers.Serializer):
class LabelLocationSerializer(CustomModelSerializer):
code = serializers.CharField(label='设备唯一标识')
class Meta:
model = TDevice
fields = ['type', 'location', 'area', 'areas', 'name', 'code']

View File

@ -12,7 +12,7 @@ from apps.am.models import Area
from rest_framework.views import APIView
from rest_framework.exceptions import ParseError
from django.db import transaction
from rest_framework.mixins import ListModelMixin, CreateModelMixin, DestroyModelMixin
from rest_framework.mixins import ListModelMixin, CreateModelMixin, DestroyModelMixin, UpdateModelMixin
class BltViewSet(CustomGenericViewSet):
@ -111,7 +111,7 @@ class BltViewSet(CustomGenericViewSet):
return Response(blt_list)
class TDeviceViewSet(ListModelMixin, DestroyModelMixin, CustomGenericViewSet):
class TDeviceViewSet(ListModelMixin, UpdateModelMixin, DestroyModelMixin, CustomGenericViewSet):
"""
三方设备接口
"""