/*
 * @Note:
 * @Author: 2058827620@qq.com
 * @Date: 2022-04-03 17:02:15
 */

import { ProForm, ModalForm, ProFormSelect, ProFormText, ProFormTextArea, ProFormInstance } from '@ant-design/pro-components';
import { Divider } from 'antd';
import { useEffect, useRef } from 'react';
import FilesManager from '@/components/FilesManage/index';

export default ({ modalOpenState, onModalOpenState, onSubmit }) => {
  const restFormRef = useRef<ProFormInstance>();

  useEffect(() => {
  }, []);

  return (
    <>
      <ModalForm
        title="用户-账号变更"
        formRef={restFormRef}
        submitter={{
          searchConfig: {
            resetText: '重置',
          },
          resetButtonProps: {
            onClick: () => {
              restFormRef.current?.resetFields();
            },
          },
        }}
        onFinish={async(e)=>{
          onSubmit(e)
          restFormRef.current?.resetFields();
        }}
        open={modalOpenState}
        onOpenChange={onModalOpenState}
      >
        <Divider>原投资人，用户名、手机号</Divider>
        <ProForm.Group>
          <ProFormText
            rules={[{ required: true, message: '请输入' }]}
            width="md"
            name="userNameOld"
            label="用户名(原)"
            placeholder="请输入"
          />
          <ProFormText
            rules={[{ required: true, message: '请输入' }]}
            width="md"
            name="phoneOld"
            label="手机号(原)"
            placeholder="请输入"
          />
        </ProForm.Group>
        <Divider>新投资人，用户名、手机号</Divider>
        <ProForm.Group>
          <ProFormText
            rules={[{ required: true, message: '请输入' }]}
            width="md"
            name="userNameNew"
            label="用户名(新)"
            placeholder="请输入"
          />
          <ProFormText
            rules={[{ required: true, message: '请输入' }]}
            width="md"
            name="phoneNew"
            label="手机号(新)"
            placeholder="请输入"
          />
        </ProForm.Group>
        <ProFormTextArea
          rules={[{ required: true, message: '请输入' }]}
          width="md"
          name="remark"
          label="备注"
          placeholder="请输入"
        />
      </ModalForm>
    </>
  );
};

