diff --git a/apps/wf/services.py b/apps/wf/services.py index 68c891ac..3aefdda7 100755 --- a/apps/wf/services.py +++ b/apps/wf/services.py @@ -174,6 +174,19 @@ class WfService(object): destination_participant = list(User.objects.filter( dept__in=destination_participant).values_list('id', flat=True)) + elif destination_participant_type == State.PARTICIPANT_TYPE_POST: # 岗位 + user_queryset = User.objects.filter(posts__in=destination_participant) + # 如果选择了岗位, 需要走过滤策略 + if state.filter_policy == 1: + depts = get_parent_queryset(ticket.belong_dept) + user_queryset = user_queryset.filter(dept__in=depts) + elif state.filter_policy == 2: + depts = get_parent_queryset(ticket.create_by.belong_dept) + user_queryset = user_queryset.filter(dept__in=depts) + elif state.filter_policy == 3: + depts = get_parent_queryset(handler.belong_dept) + user_queryset = user_queryset.filter(dept__in=depts) + destination_participant = list(user_queryset.values_list('id', flat=True)) elif destination_participant_type == State.PARTICIPANT_TYPE_ROLE: # 角色 user_queryset = User.objects.filter(roles__in=destination_participant) # 如果选择了角色, 需要走过滤策略