Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Конструктор лаборатории - улучшения и исправления #4494

Merged
merged 7 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>