44 lines
1.1 KiB
Python
44 lines
1.1 KiB
Python
from apps.wf.mixins import TicketMixin
|
|
from apps.utils.viewsets import CustomModelViewSet
|
|
from apps.asm.models import Asset, AssetLog, AssetCate
|
|
from rest_framework.exceptions import ParseError
|
|
from apps.asm.serializers import AssetSerializer, AssetLogSerializer, AssetCateSerializer
|
|
from apps.wf.models import Ticket
|
|
|
|
|
|
class AssetCateViewSet(CustomModelViewSet):
|
|
"""
|
|
list: 固定资产分类
|
|
|
|
固定资产分类
|
|
"""
|
|
queryset = AssetCate.objects.all()
|
|
serializer_class = AssetCateSerializer
|
|
search_fields = ['name', 'code']
|
|
|
|
|
|
class AssetViewSet(CustomModelViewSet):
|
|
"""
|
|
list: 固定资产台账
|
|
|
|
固定资产台账
|
|
"""
|
|
queryset = Asset.objects.all()
|
|
serializer_class = AssetSerializer
|
|
search_fields = ['name', 'card_number', 'specification']
|
|
filterset_fields = ['keep_dept', 'state']
|
|
|
|
|
|
class AssetLogViewSet(TicketMixin, CustomModelViewSet):
|
|
"""
|
|
list: 固定资产操作
|
|
|
|
固定资产操作
|
|
"""
|
|
queryset = AssetLog.objects.all()
|
|
serializer_class = AssetLogSerializer
|
|
search_fields = ['assetlog']
|
|
workflow_key = 'wf_assetlog'
|
|
|
|
|