fix(desktop): починить «Продолжить» в оверлее выбора КУ
Кнопка снова submit формы из footer, BranchSelector синхронизирует selectedBranch, ошибки генерации документа показываются пользователю. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -14,7 +14,7 @@ BaseDialog(
|
||||
p.q-mt-lg
|
||||
| Кооператив перешёл на двухэтапную систему управления на основании общего собрания уполномоченных председателей кооперативных участков...
|
||||
Loader(v-if="branchesLoading" text="Загружаем список кооперативных участков...")
|
||||
Form(
|
||||
Form#select-branch-form(
|
||||
v-else
|
||||
:handler-submit="next"
|
||||
:is-submitting="isSubmitting"
|
||||
@@ -34,10 +34,10 @@ BaseDialog(
|
||||
.select-branch-overlay__actions(v-if="step === 1 && !branchesLoading")
|
||||
BaseButton(
|
||||
variant='primary',
|
||||
:block='true',
|
||||
:loading='isSubmitting',
|
||||
:disabled='!selectedBranch',
|
||||
@click='next'
|
||||
type='submit',
|
||||
form='select-branch-form',
|
||||
:loading='isLoading',
|
||||
:disabled='!selectedBranch || isLoading',
|
||||
) Продолжить
|
||||
.select-branch-overlay__actions(v-else-if="step === 2 && !isLoading")
|
||||
BaseButton(variant='ghost', @click='back') назад
|
||||
|
||||
@@ -60,15 +60,22 @@ export function useSelectBranchProcess() {
|
||||
)
|
||||
|
||||
const next = async () => {
|
||||
isLoading.value = true
|
||||
document.value = await digitalDocument.generate<Cooperative.Registry.SelectBranchStatement.Action>({
|
||||
registry_id: Cooperative.Registry.SelectBranchStatement.registry_id,
|
||||
coopname: system.info.coopname,
|
||||
username: session.username,
|
||||
braname: selectedBranch.value,
|
||||
})
|
||||
isLoading.value = false
|
||||
step.value++
|
||||
if (!selectedBranch.value || isLoading.value) return
|
||||
|
||||
try {
|
||||
isLoading.value = true
|
||||
document.value = await digitalDocument.generate<Cooperative.Registry.SelectBranchStatement.Action>({
|
||||
registry_id: Cooperative.Registry.SelectBranchStatement.registry_id,
|
||||
coopname: system.info.coopname,
|
||||
username: session.username,
|
||||
braname: selectedBranch.value,
|
||||
})
|
||||
step.value++
|
||||
} catch (e: unknown) {
|
||||
FailAlert(e)
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const back = () => {
|
||||
|
||||
@@ -9,7 +9,6 @@ div
|
||||
emit-value
|
||||
standout="bg-teal text-white"
|
||||
map-options
|
||||
@update:model-value="$emit('update:selectedBranch', $event)"
|
||||
)
|
||||
|
||||
template(v-slot:option="scope")
|
||||
@@ -27,22 +26,13 @@ div
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { type IPublicBranch } from 'src/entities/Branch/model';
|
||||
import { ref, watch } from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
defineProps({
|
||||
branches: {
|
||||
type: Object as () => IPublicBranch[],
|
||||
required: true,
|
||||
},
|
||||
modelValue: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
})
|
||||
|
||||
const selectedBranch = ref(props.modelValue)
|
||||
|
||||
watch(() => props.modelValue, (newVal) => {
|
||||
selectedBranch.value = newVal
|
||||
})
|
||||
const selectedBranch = defineModel<string>('selectedBranch', { default: '' })
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user