Commit 688a371d7808d30127a4a2366ad0f6b5f0d58f45

Authored by zhongnanhuang
1 parent 1d454be0

feat: update FinancialDrawer

src/pages/Order/components/FinancialDrawer.tsx 0 → 100644
  1 +// import { PlusOutlined } from '@ant-design/icons';
  2 +import {
  3 + DrawerForm,
  4 + ProFormDatePicker,
  5 + ProFormText,
  6 +} from '@ant-design/pro-components';
  7 +import { Form, message } from 'antd';
  8 +
  9 +// const waitTime = (time: number = 100) => {
  10 +// return new Promise((resolve) => {
  11 +// setTimeout(() => {
  12 +// resolve(true);
  13 +// }, time);
  14 +// });
  15 +// };
  16 +
  17 +export default ({ onClose }) => {
  18 + // const [expandedRowKeys, setExpandedRowKeys] = useState<readonly Key[]>([]);
  19 + const [form] = Form.useForm<{ name: string; company: string }>();
  20 + // const actionRef = useRef<
  21 + // FormListActionType<{
  22 + // name: string;
  23 + // }>
  24 + // >();
  25 + //作为商品行号
  26 + // const rowRumber = useRef(0);
  27 +
  28 + return (
  29 + <DrawerForm<{
  30 + name: string;
  31 + company: string;
  32 + }>
  33 + open
  34 + title="财务信息"
  35 + resize={{
  36 + onResize() {
  37 + console.log('resize!');
  38 + },
  39 + maxWidth: window.innerWidth * 0.8,
  40 + minWidth: 400,
  41 + }}
  42 + // layout="horizontal"
  43 + // labelCol={{ span: 8 }}
  44 + form={form}
  45 + autoFocusFirstInput
  46 + drawerProps={{
  47 + destroyOnClose: true,
  48 + }}
  49 + submitTimeout={2000}
  50 + onFinish={async (values) => {
  51 + console.log(form);
  52 + console.log(values);
  53 + console.log(values.name);
  54 + message.success('提交成功');
  55 + // 不返回不会关闭弹框
  56 + // onClose();
  57 + return true;
  58 + }}
  59 + onOpenChange={(val) => {
  60 + return !val && onClose();
  61 + }}
  62 + >
  63 + <ProFormText
  64 + width="lg"
  65 + name="invoiceInformation"
  66 + label="开票信息"
  67 + placeholder="请输入开票信息"
  68 + />
  69 + <ProFormText
  70 + width="lg"
  71 + name="bank"
  72 + label="开户银行"
  73 + placeholder="请输入开户银行"
  74 + />
  75 + <ProFormText
  76 + width="lg"
  77 + name="bankAccountNumber"
  78 + label="开户银行账号"
  79 + placeholder="请输入开户银行账号"
  80 + />
  81 + <ProFormDatePicker width="lg" name="contractTime" label="开票时间" />
  82 + <ProFormDatePicker width="lg" name="contractTime" label="收款时间" />
  83 + </DrawerForm>
  84 + );
  85 +};
... ...