Blame view

src/pages/Instalment/components/comfire/comfire.tsx 1012 Bytes
凌世锦 authored
1
import { ModalForm } from '@ant-design/pro-components';
凌世锦 authored
2
import { Form } from 'antd';
凌世锦 authored
3
4
5
6
7
8
9
10
11
12
import { useState } from 'react';

const waitTime = (time: number = 100) => {
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve(true);
    }, time);
  });
};
凌世锦 authored
13
export default ({ currtDid, sureDelete }) => {
凌世锦 authored
14
  const [form] = Form.useForm<{ name: string; company: string }>();
凌世锦 authored
15
  const [ids, setIds] = useState([]);
凌世锦 authored
16
凌世锦 authored
17
18
19
  function getIds() {
    setIds([]);
    setIds(currtDid);
凌世锦 authored
20
21
22
23
24
25
26
  }
  return (
    <ModalForm<{
      name: string;
      company: string;
    }>
      trigger={
凌世锦 authored
27
28
29
30
31
        <a
          onClick={() => {
            getIds();
          }}
        >
凌世锦 authored
32
33
34
35
36
          删除
        </a>
      }
      form={form}
      autoFocusFirstInput
凌世锦 authored
37
      width={280}
凌世锦 authored
38
39
40
      modalProps={{
        destroyOnClose: true,
      }}
凌世锦 authored
41
      onFinish={async () => {
凌世锦 authored
42
43
44
45
46
        await waitTime(100);
        sureDelete([ids]);
        return true;
      }}
    >
凌世锦 authored
47
      <br />
凌世锦 authored
48
49
50
      <h2>确定删除吗</h2>
    </ModalForm>
  );
凌世锦 authored
51
};