Skip to content

Commit

Permalink
Merge pull request #4494 from mikhailprivalov/fix-hide-fractions
Browse files Browse the repository at this point in the history
Конструктор лаборатории - улучшения и исправления
  • Loading branch information
urchinpro authored Nov 27, 2024
2 parents 6cd7899 + c15e066 commit dbbee43
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 14 deletions.
2 changes: 2 additions & 0 deletions api/construct/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ def change_tube_for_fractions(request):
fractions_id = request_data.get("fractionsIds")
old_tube = request_data.get("oldTube")
new_tube = request_data.get("newTube")
if not new_tube:
return JsonResponse({"ok": False, "message": "Не выбрана пробирка"})
result = Fractions.change_relation_tube(fractions_id, old_tube, new_tube)
if result:
Log.log(
Expand Down
1 change: 1 addition & 0 deletions directory/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,7 @@ def as_json(research):
"pk": research.pk,
"title": research.title,
"internalCode": research.internal_code,
"code": research.code,
"hide": research.hide,
"order": research.sort_weight,
}
Expand Down
3 changes: 2 additions & 1 deletion l2-frontend/src/construct/ConstructLaboratory.vue
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ const filteredResearchTubes = computed(() => researchTubes.value.map(tubes => {
const result = tubes.researches.filter(research => {
const researchTitle = research.title.toLowerCase();
const researchInternalCode = research.internalCode.toLowerCase();
return researchTitle.includes(searchTerm) || researchInternalCode.includes(searchTerm);
const researchCode = research.code.toLowerCase();
return researchTitle.includes(searchTerm) || researchInternalCode.includes(searchTerm) || researchCode.includes(searchTerm);
});
if (result) {
return { researches: result, tubes: tubes.tubes };
Expand Down
32 changes: 19 additions & 13 deletions l2-frontend/src/construct/FractionsGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
</div>
<button
v-tippy
class="height-button-change-tube"
class="height-button-change-tube btn"
title="Изменить пробирку"
:disabled="selectedTubeTypeId===-1"
:disabled="!selectedTubeTypeId"
@click="changeTube()"
>
Изменить
Expand Down Expand Up @@ -254,16 +254,20 @@ const addFraction = () => {
}
};
const selectedTubeTypeId = ref(-1);
const selectedTubeTypeId = ref(null);
const changeTube = async () => {
const fractionsIds = props.tube.fractions.map(t => t.id);
await api('construct/laboratory/change-tube-for-fractions', {
oldTube: props.tube.id,
newTube: selectedTubeTypeId.value,
fractionsIds,
});
emit('changeTube');
if (selectedTubeTypeId.value) {
const fractionsIds = props.tube.fractions.map(t => t.id);
await api('construct/laboratory/change-tube-for-fractions', {
oldTube: props.tube.id,
newTube: selectedTubeTypeId.value,
fractionsIds,
});
emit('changeTube');
} else {
root.$emit('msg', 'error', 'Пробирка не выбрана');
}
};
</script>

Expand Down Expand Up @@ -310,7 +314,7 @@ const changeTube = async () => {
border: 1px solid #AAB2BD;
border-radius: 4px;
padding: 3px 2px;
margin: 0px 1px;
margin: 0 1px;
}
.transparent-button:hover {
background-color: #434a54;
Expand Down Expand Up @@ -356,12 +360,12 @@ const changeTube = async () => {
background-image: linear-gradient(#6c7a89, #56616c);
color: #fff;
cursor: not-allowed;
line-height: 28px !important;
line-height: 26px !important;
}
}
::v-deep .hide-treeselect .vue-treeselect {
&__placeholder {
line-height: 28px !important;
line-height: 26px !important;
}
}
Expand Down Expand Up @@ -393,5 +397,7 @@ const changeTube = async () => {
.height-button-change-tube {
height: 26px;
padding: 0 6px;
border-radius: 4px;
}
</style>

0 comments on commit dbbee43

Please sign in to comment.