Search req by id
This commit is contained in:
parent
d13bef5e8a
commit
e50c8cc17f
@ -1000,20 +1000,22 @@ watch(selectedRequisitionSideTwoId, async (newId, oldId) => {
|
||||
// }
|
||||
// }
|
||||
async function filterRequisitionsList(event) {
|
||||
const query = event.filter || '';
|
||||
const query = event.value ?? event.filter ?? '';
|
||||
|
||||
if (query === '') {
|
||||
// Если запрос пустой, возвращаем полный список (с исключением текущей заявки стороны 1)
|
||||
requisitionsList.value = originalRequisitionsList.value.filter(req => req.id !== selectedRequisitionSideOneId.value);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetchRequisitionsListData(`/requisitions?search=${encodeURIComponent(query)}&exclude_linked_for_deal=1` + (dealId ? '&exclude_linked_for_deal_id=' + dealId : ''));
|
||||
requisitionsList.value = response.data.data || [];
|
||||
const items = (response.data.data || response.data.list || []).map(r => ({
|
||||
...r,
|
||||
name: r.name + ' (ID: ' + r.id + ')',
|
||||
}));
|
||||
requisitionsList.value = items;
|
||||
} catch (error) {
|
||||
console.error('Ошибка поиска заявок:', error);
|
||||
// В случае ошибки тоже возвращаем полный список
|
||||
requisitionsList.value = [...originalRequisitionsList.value];
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user