|
|
@@ -25,7 +25,7 @@
|
|
|
<template #footer>
|
|
|
<span class="dialog-footer">
|
|
|
<el-button type="info" @click="() => ((showRefundableDialog = false), (refundableId = 0))" size="default">取 消</el-button>
|
|
|
- <el-button color="#2c78ff" @click="onRefundableSubmit()" size="default">提交</el-button>
|
|
|
+ <el-button color="#2c78ff" @click="onRefundableSubmit()" size="default" :loading="submitting" :disabled="submitting">提交</el-button>
|
|
|
</span>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
@@ -50,6 +50,7 @@ const platAnimalCageApplicationApi = usePlatAnimalCageApplicationApi();
|
|
|
const uploadRef = ref<any>(null);
|
|
|
const showRefundableDialog = ref<boolean>(false);
|
|
|
const refundableId = ref<number>(0);
|
|
|
+const submitting = ref<boolean>(false);
|
|
|
const refundableForm = reactive<{ number: number; endDate: string }>({
|
|
|
number: 0,
|
|
|
endDate: '',
|
|
|
@@ -66,18 +67,28 @@ const handleOpenRefundableDialog = (id: number) => {
|
|
|
};
|
|
|
|
|
|
const onRefundableSubmit = () => {
|
|
|
+ submitting.value = true;
|
|
|
uploadRef.value?.validate(async (valid: boolean) => {
|
|
|
- if (!valid) return;
|
|
|
+ if (!valid) {
|
|
|
+ submitting.value = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
const params = {
|
|
|
cageApplicationId: refundableId.value,
|
|
|
endDate: dayjs(refundableForm.endDate).format('YYYY-MM-DD'),
|
|
|
number: refundableForm.number,
|
|
|
};
|
|
|
const [err]: ToResponse = await to(platAnimalCageApplicationApi.releaseCage(params));
|
|
|
- if (err) return;
|
|
|
+ if (err) {
|
|
|
+ submitting.value = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
ElMessage.success('操作成功');
|
|
|
- showRefundableDialog.value = false;
|
|
|
- emit('getTableData');
|
|
|
+ setTimeout(() => {
|
|
|
+ submitting.value = false;
|
|
|
+ showRefundableDialog.value = false;
|
|
|
+ emit('getTableData');
|
|
|
+ }, 5000);
|
|
|
});
|
|
|
};
|
|
|
|
|
|
@@ -90,4 +101,4 @@ watch(showRefundableDialog, (val) => {
|
|
|
defineExpose({
|
|
|
handleOpenRefundableDialog,
|
|
|
});
|
|
|
-</script>
|
|
|
+</script>
|