comfire.tsx
1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import { ModalForm } from '@ant-design/pro-components';
import { Form, message } from 'antd';
import { useState } from 'react';
const waitTime = (time: number = 100) => {
return new Promise((resolve) => {
setTimeout(() => {
resolve(true);
}, time);
});
};
export default ({ currtDid, sureDelete }) => {
const [form] = Form.useForm<{ name: string; company: string }>();
const [ids, setIds] = useState([]);
function getIds() {
setIds([]);
setIds(currtDid);
}
return (
<ModalForm<{
name: string;
company: string;
}>
trigger={
<a
onClick={() => {
getIds();
}}
>
删除
</a>
}
form={form}
autoFocusFirstInput
width={280}
modalProps={{
destroyOnClose: true,
}}
onFinish={async () => {
await waitTime(100);
sureDelete([ids]);
message.success('提交成功');
return true;
}}
>
<br />
<h2>确定删除吗</h2>
</ModalForm>
);
};