import { ProForm, ProFormCheckbox, ProFormDependency, ProFormGroup, ProFormList, ProFormRadio, ProFormSelect, ProFormSwitch, } from '@ant-design/pro-components'; import { Form } from 'antd'; import type { NamePath } from 'antd/lib/form/interface'; import { useEffect } from 'react'; type AlarmSetFormProps = { values?: Record; }; const AlarmSetForm: React.FC = (props) => { const [form] = Form.useForm(); const initialValues = { label: 1, value: 2, }; const depName1: NamePath[] = [['ways']]; useEffect(() => { form.setFieldValue('ways', [ { label: '短信', value: [], isChecked: true, }, { label: '邮件', value: [], isChecked: false, }, ]); }, []); return ( // TODO 模拟提交告警设置 {(f, index, action) => { console.log('isChecked_value', f, index, action); return ( {/* {form.getFieldValue('ways')[index].label}{' '} */} {form.getFieldValue('ways')[index].label} {({ isChecked }) => { return ( { // const resp = await postCurrentIP(); const resp = ['test001', 'test002', 'test003']; return resp?.map((v: any) => { return { label: v, value: v, }; }); }} /> ); }} {/* */} ); }} {/* `} > {(depValues) => (
              {JSON.stringify(depValues)}
            
)}
*/}
); }; export default AlarmSetForm;