Добавлен код при выборе организации и переработана фильтрация
This commit is contained in:
@@ -63,7 +63,10 @@ const onCloseWithoutSave = () => {
|
|||||||
const loadArchiveHistoryData = async () => {
|
const loadArchiveHistoryData = async () => {
|
||||||
try {
|
try {
|
||||||
await axios.get('/api/orgs').then(res => {
|
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
|
if (!props.archiveHistoryId) return
|
||||||
@@ -100,6 +103,10 @@ const submit = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const filterOrg = (pattern, option) => {
|
||||||
|
return option.name.startsWith(pattern)
|
||||||
|
}
|
||||||
|
|
||||||
// Наблюдаем за изменением archiveHistoryId
|
// Наблюдаем за изменением archiveHistoryId
|
||||||
watch(() => props.archiveHistoryId, async (newId) => {
|
watch(() => props.archiveHistoryId, async (newId) => {
|
||||||
if (!props.isCreateNew) {
|
if (!props.isCreateNew) {
|
||||||
@@ -123,7 +130,7 @@ watch(() => props.archiveHistoryId, async (newId) => {
|
|||||||
<NDatePicker v-model:value="archiveHistory.return_at" format="dd.MM.yyyy" />
|
<NDatePicker v-model:value="archiveHistory.return_at" format="dd.MM.yyyy" />
|
||||||
</NFormItem>
|
</NFormItem>
|
||||||
<NFormItem label="Организация">
|
<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>
|
||||||
<NFormItem label="Имя сотрудника">
|
<NFormItem label="Имя сотрудника">
|
||||||
<NInput v-model:value="archiveHistory.employee_name" />
|
<NInput v-model:value="archiveHistory.employee_name" />
|
||||||
|
|||||||
Reference in New Issue
Block a user