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