fix: batchst支持返回source_near修复

This commit is contained in:
caoqianming 2026-01-16 14:00:52 +08:00
parent e99b2ecbbc
commit 70e49eb27e
1 changed files with 2 additions and 1 deletions

View File

@ -1078,7 +1078,8 @@ class BatchStViewSet(CustomListModelMixin, ComplexQueryMixin, CustomGenericViewS
filterset_class = BatchStFilter
def add_info_for_list(self, data):
if self.request.query_params.get("with_source_near", None) == "yes":
if (self.request.query_params.get("with_source_near", None) == "yes" or
self.request.data.get("with_source_near", None) == "yes"):
batchstIds = [ins["id"] for ins in data]
batchlog_qs = BatchLog.objects.filter(target__id__in=batchstIds).values("id", "source", "target")
source_data = BatchStSerializer(instance=BatchSt.objects.filter(id__in=[ins["source"] for ins in batchlog_qs]), many=True).data