Commit 56c23826 authored by 卢均锐's avatar 卢均锐

chore: 采购能力中的弹出审核框增加loading效果,修复原因输入框不受控制显示

parent 2430c80c
import React, { useEffect } from 'react';
import React, { useEffect, useState } from 'react';
import { Modal } from 'antd';
import {
SchemaForm, SchemaMarkupField as Field,
createAsyncFormActions ,
createAsyncFormActions,
FormEffectHooks,
} from '@formily/antd'
import { Input, Radio, DatePicker, Checkbox } from '@formily/antd-components'
......@@ -11,7 +11,7 @@ import moment from 'moment';
import styles from './index.less';
import { isEmpty } from 'lodash';
const actions = createAsyncFormActions ()
const actions = createAsyncFormActions()
const { onFieldChange$ } = FormEffectHooks;
export interface IProps {
......@@ -39,11 +39,12 @@ const ModalOperate: React.FC<IProps> = (props: any) => {
maxNumber,
} = props;
const [confirmLoading, setConfirmLoading] = useState<boolean>(false);
const useFormEffects = () => {
const { setFieldState } = createAsyncFormActions ()
if (modalType === 'audit') {
onFieldChange$('state').subscribe(({ value }) => {
setFieldState('auditOpinion', state => {
actions.setFieldState('auditOpinion', state => {
if (value == 1) {
state.visible = false
} else {
......@@ -54,7 +55,7 @@ const ModalOperate: React.FC<IProps> = (props: any) => {
}
if (modalType === 'planAudit') {
onFieldChange$('status').subscribe(({ value }) => {
setFieldState('cause', state => {
actions.setFieldState('cause', state => {
if (value == 1) {
state.visible = false
} else {
......@@ -206,6 +207,10 @@ const ModalOperate: React.FC<IProps> = (props: any) => {
}, [visible])
const handleSubmit = (val: any) => {
if(confirmLoading){
return;
}
setConfirmLoading(true);
let value = { ...val }
let params: any = {}
if (modalType === 'audit') {
......@@ -235,6 +240,8 @@ const ModalOperate: React.FC<IProps> = (props: any) => {
if (res.code === 1000) {
onOk && onOk()
}
}).finally(() => {
setConfirmLoading(false);
})
}
......@@ -262,6 +269,7 @@ const ModalOperate: React.FC<IProps> = (props: any) => {
onCancel={handleClose}
onOk={() => actions.submit()}
afterClose={() => actions.reset()}
confirmLoading={confirmLoading}
>
<SchemaForm
className={styles.revise_style}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment