diff --git a/api/construct/views.py b/api/construct/views.py index 51bd3db887..d2212fe496 100644 --- a/api/construct/views.py +++ b/api/construct/views.py @@ -118,7 +118,7 @@ def get_lab_ref_books(request): materials = LaboratoryMaterial.get_materials() subgroups = SubGroupPadrazdeleniye.get_subgroup_podrazdeleniye(request_data["departmentId"]) variants = ResultVariants.get_all() - tubes = Tubes.get_all() + tubes = Tubes.get_all(True) relations_tubes = ReleationsFT.get_all_relation() result = {"units": units, "materials": materials, "subGroups": subgroups, "variants": variants, "tubes": tubes, "relations": relations_tubes} return JsonResponse({"result": result}) diff --git a/directory/models.py b/directory/models.py index dfdd48a00e..dcd357ee74 100644 --- a/directory/models.py +++ b/directory/models.py @@ -63,8 +63,8 @@ def get_or_create_relation(relation_data): @staticmethod def get_all_relation(): - relations = ReleationsFT.objects.all() - data = [{"id": i.pk, "label": f"{i.tube.title}-({i.pk})"} for i in relations] + relations = ReleationsFT.objects.all().select_related('tube').order_by('tube__title') + data = [{"id": i.pk, "label": f"{i.tube.title} ({i.pk})", "color": i.tube.color} for i in relations] return data @@ -584,10 +584,10 @@ def get_site_type_id(self): return self.site_type_id @staticmethod - def as_json(research): + def as_json(research, pk_in_title=False): result = { "pk": research.pk, - "title": research.title, + "title": research.title if not pk_in_title else f"{research.title} ({research.pk})", "internalCode": research.internal_code, "code": research.code, "hide": research.hide, @@ -658,10 +658,10 @@ def get_tubes(podrazdelenie_id: int): tubes_info = [value for _, value in research_tubes.items()] tubes_keys = tuple(research_tubes.keys()) if tubes.get(tubes_keys): - tubes[tubes_keys]["researches"].append(research.as_json(research)) + tubes[tubes_keys]["researches"].append(research.as_json(research, True)) else: tubes[tubes_keys] = { - "researches": [research.as_json(research)], + "researches": [research.as_json(research, True)], "tubes": tubes_info, } diff --git a/l2-frontend/src/construct/FractionsGroup.vue b/l2-frontend/src/construct/FractionsGroup.vue index d068f91e8a..4cf88d5ac4 100644 --- a/l2-frontend/src/construct/FractionsGroup.vue +++ b/l2-frontend/src/construct/FractionsGroup.vue @@ -21,7 +21,27 @@ :options="props.tubesData" :multiple="false" class="treeselect-wide treeselect-26px" - /> + placeholder="Выберите пробирку" + > + <div + slot="value-label" + slot-scope="{ node }" + > + <ColorTitled + :title="node.label" + :color="node.raw.color" + /> + </div> + <div + slot="option-label" + slot-scope="{ node }" + > + <ColorTitled + :title="node.label" + :color="node.raw.color" + /> + </div> + </Treeselect> </div> <table class="table"> <colgroup> diff --git a/laboratory/__init__.py b/laboratory/__init__.py index 9e7a76602b..bf523dfff1 100644 --- a/laboratory/__init__.py +++ b/laboratory/__init__.py @@ -1,2 +1,2 @@ -__version__ = "2024.12.151313+fe4486" +__version__ = "2024.12.160300+595657" VERSION = __version__ diff --git a/pyproject.toml b/pyproject.toml index b5b384adca..5b8ba1c3c8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ skip-string-normalization = true [tool.poetry] name = "l2" -version = "2024.12.151313+fe4486" +version = "2024.12.160300+595657" description = "" authors = ["Mikhail Privalov <n5250@ya.ru>"] license = "MIT" diff --git a/researches/models.py b/researches/models.py index e37b39b0a9..9ed4539f21 100644 --- a/researches/models.py +++ b/researches/models.py @@ -62,14 +62,14 @@ def get_short_title(self): return pr @staticmethod - def get_all(): + def get_all(pk_in_title=False): result = [ { "id": tube.pk, - "label": f"{tube.title} - tube.pk", + "label": tube.title if not pk_in_title else f"{tube.title} ({tube.pk})", "color": tube.color, } - for tube in Tubes.objects.all() + for tube in Tubes.objects.all().order_by("title") ] return result