feat: base workflow添加分类字段
This commit is contained in:
parent
168d917232
commit
50c21292a9
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.2.12 on 2025-11-18 01:44
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('wf', '0004_workflow_view_path2'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='workflow',
|
||||
name='cate',
|
||||
field=models.CharField(blank=True, max_length=50, null=True, verbose_name='分类'),
|
||||
),
|
||||
]
|
||||
|
|
@ -9,6 +9,7 @@ class Workflow(CommonAModel):
|
|||
TN:工作流
|
||||
"""
|
||||
name = models.CharField('名称', max_length=50)
|
||||
cate = models.CharField('分类', max_length=50, null=True, blank=True)
|
||||
key = models.CharField('工作流标识', unique=True, max_length=20, null=True, blank=True)
|
||||
sn_prefix = models.CharField('流水号前缀', max_length=50, default='hb')
|
||||
description = models.CharField('描述', max_length=200, null=True, blank=True)
|
||||
|
|
|
|||
|
|
@ -60,11 +60,18 @@ class WorkflowKeyInitView(APIView):
|
|||
class WorkflowViewSet(CustomModelViewSet):
|
||||
queryset = Workflow.objects.all()
|
||||
serializer_class = WorkflowSerializer
|
||||
search_fields = ['name', 'description']
|
||||
filterset_fields = []
|
||||
search_fields = ['name', 'description', 'key']
|
||||
filterset_fields = ['key', 'cate']
|
||||
ordering_fields = ['create_time']
|
||||
ordering = ['key', '-create_time']
|
||||
|
||||
@action(methods=['get'], detail=True, perms_map={'get': '*'})
|
||||
def cates(self, request, pk=None):
|
||||
"""
|
||||
工作流分类
|
||||
"""
|
||||
return Response(Workflow.objects.filter(cate__isnull=False).values_list('cate', flat=True).distinct())
|
||||
|
||||
@action(methods=['get'], detail=True, perms_map={'get': 'workflow.update'},
|
||||
pagination_class=None, serializer_class=StateSerializer)
|
||||
def states(self, request, pk=None):
|
||||
|
|
|
|||
Loading…
Reference in New Issue