Добавлен код при выборе организации и переработана фильтрация
Some checks failed
Build and Push Docker Image / test (push) Failing after 6s
Build and Push Docker Image / build (push) Has been cancelled

This commit is contained in:
brusnitsyn
2026-02-27 15:35:25 +09:00
parent 8790b95d7b
commit 5c7d1816e7

View File

@@ -63,7 +63,10 @@ const onCloseWithoutSave = () => {
const loadArchiveHistoryData = async () => {
try {
await axios.get('/api/orgs').then(res => {
orgs.value = res.data
orgs.value = res.data.map(org => ({
...org,
name: `${org.code} - ${org.name}`
}))
})
if (!props.archiveHistoryId) return
@@ -100,6 +103,10 @@ const submit = () => {
}
}
const filterOrg = (pattern, option) => {
return option.name.startsWith(pattern)
}
// Наблюдаем за изменением archiveHistoryId
watch(() => props.archiveHistoryId, async (newId) => {
if (!props.isCreateNew) {
@@ -123,7 +130,7 @@ watch(() => props.archiveHistoryId, async (newId) => {
<NDatePicker v-model:value="archiveHistory.return_at" format="dd.MM.yyyy" />
</NFormItem>
<NFormItem label="Организация">
<NSelect v-model:value="archiveHistory.org_id" :options="orgs" label-field="name" value-field="id" filterable />
<NSelect v-model:value="archiveHistory.org_id" :filter="(pattern, option) => filterOrg(pattern, option)" :options="orgs" label-field="name" value-field="id" filterable />
</NFormItem>
<NFormItem label="Имя сотрудника">
<NInput v-model:value="archiveHistory.employee_name" />