Добавил блокировку модального окна
This commit is contained in:
@@ -150,11 +150,14 @@ watch(() => show.value, (opened) => {
|
||||
fetchDepartments()
|
||||
}, {immediate: false})
|
||||
|
||||
const loadingButton = ref(false)
|
||||
|
||||
const onSubmit = (e) => {
|
||||
e.preventDefault()
|
||||
formRef.value?.validate((errors) => {
|
||||
if (!errors) {
|
||||
if (reportExists.value) return
|
||||
loadingButton.value = true
|
||||
|
||||
router.visit(props.targetPath, {
|
||||
data: {
|
||||
@@ -164,6 +167,9 @@ const onSubmit = (e) => {
|
||||
onSuccess: () => {
|
||||
onboarding.emit('navigate:report')
|
||||
show.value = false
|
||||
},
|
||||
onFinally: () => {
|
||||
loadingButton.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -193,7 +199,6 @@ const onChangeDepartment = (departmentId) => {
|
||||
class="max-w-[420px]"
|
||||
:mask-closable="false"
|
||||
@before-leave="onAfterLeave"
|
||||
@after-enter="onAfterEnter"
|
||||
>
|
||||
<NForm id="select-user-form" ref="formRef" :model="reportStore.reportInfo" :rules="rules">
|
||||
<NFormItem id="modal-select-user-department" label="Выберите отделение" path="departmentId">
|
||||
@@ -225,7 +230,8 @@ const onChangeDepartment = (departmentId) => {
|
||||
type="primary"
|
||||
block
|
||||
@click="onSubmit"
|
||||
:disabled="withExistsCheck && reportExists">
|
||||
:loading="loadingButton"
|
||||
:disabled="(withExistsCheck && reportExists) || loadingButton">
|
||||
{{ submitLabel }}
|
||||
</NButton>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user