import React, { useState } from 'react' import { Form, Radio, DatePicker, Switch, Modal } from 'antd' import { dayjsFormat } from '@/utils/utils' import dayjs from 'dayjs' import { ProFormTextArea } from '@ant-design/pro-form' const AddRecord = props => { const [formRef] = Form.useForm() const { onConfirm, ...resetModalProps } = props const [state, setState] = useState({ showExtraItem: false, loading: false }) const onChange = value => { setState({ ...state, showExtraItem: value }) } const disabledDate = current => { return current && current < dayjs().endOf('day') } return ( document.getElementById('root')} onOk={() => { setState({ ...state, loading: true }) formRef ?.validateFields() .then(async values => { const newVal = { ...values } formRef.current?.resetFields() if (values.date) { newVal.date = dayjsFormat(values.date, 'YYYY-MM-DD') } if (values.remindTime) { newVal.remindTime = dayjsFormat(values.remindTime, 'YYYY-MM-DD') } const isSuccess = await onConfirm(newVal) isSuccess && resetModalProps.onCancel() setState({ ...state, loading: false }) }) .catch(() => { setState({ ...state, loading: false }) }) }} confirmLoading={state.loading} >
上门服务 电话拜访 其他事项 在线服务
添加备忘录
{state.showExtraItem ? ( <> ) : null}
) } export default AddRecord