// index.tsx import { ERROR_CODE } from '@/constants/constants'; import { getBindImageList } from '@/services/terminal'; import { Button, Form, message, Modal } from 'antd'; import React, { useEffect } from 'react'; import SelectedTable from '../ImageSelectedTable/index'; import styles from './index.less'; interface UserEditModalProps { onCancel: () => void; onOk: (values: any) => void; confirmLoading?: boolean; dataDetial?: Termial.ModalBaseNode; selectedOrg?: number; } const BindUserModal: React.FC = ({ onCancel, onOk, confirmLoading = false, dataDetial, }) => { const { recordData, visible, selectedOrg } = dataDetial || {}; const { id: device_id } = recordData || {}; const [form] = Form.useForm(); useEffect(() => { const params = { device_id: device_id }; getBindImageList(params).then((res: any) => { const { code, data = [] } = res || {}; if (code === ERROR_CODE) { if (data && data.length) { const initialValues = { image_list: data }; form.setFieldsValue(initialValues); } } }); }, [visible, form, recordData, selectedOrg]); const handleOk = async () => { try { const values = await form.validateFields(); console.log('values=====', values); onOk(values); } catch (error) { message.error('请检查表单字段'); } }; return ( // // // // } >
{/* */}
); }; export default BindUserModal;