FinancialDrawer.tsx 2.11 KB
// import { PlusOutlined } from '@ant-design/icons';
import {
  DrawerForm,
  ProFormDatePicker,
  ProFormText,
} from '@ant-design/pro-components';
import { Form, message } from 'antd';

// const waitTime = (time: number = 100) => {
//   return new Promise((resolve) => {
//     setTimeout(() => {
//       resolve(true);
//     }, time);
//   });
// };

export default ({ onClose }) => {
  //   const [expandedRowKeys, setExpandedRowKeys] = useState<readonly Key[]>([]);
  const [form] = Form.useForm<{ name: string; company: string }>();
  //   const actionRef = useRef<
  //     FormListActionType<{
  //       name: string;
  //     }>
  //   >();
  //作为商品行号
  //   const rowRumber = useRef(0);

  return (
    <DrawerForm<{
      name: string;
      company: string;
    }>
      open
      title="财务信息"
      resize={{
        onResize() {
          console.log('resize!');
        },
        maxWidth: window.innerWidth * 0.8,
        minWidth: 400,
      }}
      // layout="horizontal"
      // labelCol={{ span: 8 }}
      form={form}
      autoFocusFirstInput
      drawerProps={{
        destroyOnClose: true,
      }}
      submitTimeout={2000}
      onFinish={async (values) => {
        console.log(form);
        console.log(values);
        console.log(values.name);
        message.success('提交成功');
        // 不返回不会关闭弹框
        // onClose();
        return true;
      }}
      onOpenChange={(val) => {
        return !val && onClose();
      }}
    >
      <ProFormText
        width="lg"
        name="invoiceInformation"
        label="开票信息"
        placeholder="请输入开票信息"
      />
      <ProFormText
        width="lg"
        name="bank"
        label="开户银行"
        placeholder="请输入开户银行"
      />
      <ProFormText
        width="lg"
        name="bankAccountNumber"
        label="开户银行账号"
        placeholder="请输入开户银行账号"
      />
      <ProFormDatePicker width="lg" name="contractTime" label="开票时间" />
      <ProFormDatePicker width="lg" name="contractTime" label="收款时间" />
    </DrawerForm>
  );
};