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
53
54
55
56
57
58
59
60
61
import React, { useState } from 'react';
import { notification } from 'antd';
import SiteModal from '@/components/Modal/SiteModa';
import { deleteRole } from '@/services/RoleManage/api';
const DelModal = props => {
const { confirmModal, itemObj } = props;
const [loading, setLoading] = useState(false);
const onSubmit = props => {
setLoading(true);
deleteRole({
roleID: itemObj.roleID || '',
})
.then(res => {
setLoading(false);
if (res.msg==='') {
notification.success({
message: '通知',
duration: 3,
description: '删除成功',
});
confirmModal();
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
})
.catch(err => {
setLoading(false);
notification.error({
message: '提示',
duration: 3,
description: err,
});
});
};
return (
<SiteModal
{...props}
title="删除角色"
bodyStyle={{ width: '100%', minHeight: '50px' }}
style={{ top: 200 }}
width="400px"
destroyOnClose
cancelText="取消"
okText="确认"
onOk={() => onSubmit()}
confirmLoading={loading}
>
是否删除角色
<span style={{ color: 'red' }}>
{itemObj.roleName && itemObj.roleName}
</span>
?
</SiteModal>
);
};
export default DelModal;