ModalEventLog.jsx
3.11 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/**
* Author: Charles
* Date: 2022.9.13
* Description: [事件日志]
*/
import React, { useEffect } from 'react';
import { connect } from 'umi';
import { Modal, Tooltip, Table } from 'antd';
import { paginations, mapStatus, mapRiskType, mapRiskSourceType } from '@/constants';
import { StyledEllipsisWrap } from '@/components/style';
const ModalEventLog = props => {
const {
dispatch,
loading,
dataModal: {
modalType,
modalShow,
modalData: { id },
},
dataEventLogList: { records = [], current, size, total },
} = props;
useEffect(() => {
if (modalType === 'View_Event_Log' && modalShow) {
dispatch({ type: 'Event/getEventRiskLog', payload: { eventId: id } });
}
}, [modalType, modalShow]);
/* 点击分页 */
const handlePageChange = (current, size) => {
dispatch({ type: 'Event/getEventRiskLog', payload: { eventId: id, current, size } });
};
const columns = [
{
title: '序号',
dataIndex: 'id',
align: 'center',
fixed: 'left',
width: 60,
render(t, r, idx) {
return idx + 1;
},
},
{
title: '发送内容',
dataIndex: 'content',
align: 'center',
width: 160,
render: (t, r) => {
return (
<Tooltip placement="top" title={t}>
<StyledEllipsisWrap maxLine={1}>{t || '-'}</StyledEllipsisWrap>
</Tooltip>
);
},
},
{
title: '接收者信息',
dataIndex: 'recipient',
align: 'center',
width: 160,
render: (t, r) => {
return r.type == 2
? `${r.recipientName || '-'}(${r.recipient || '-'})`
: `${r.recipientName || '-'}`;
},
},
{
title: '状态',
dataIndex: 'status',
align: 'center',
width: 120,
},
{
title: '失败原因',
dataIndex: 'statusMessage:',
align: 'center',
width: 160,
render: (t, r) => {
return (
<Tooltip placement="top" title={t}>
<StyledEllipsisWrap maxLine={1}>{t || '-'}</StyledEllipsisWrap>
</Tooltip>
);
},
},
];
const pagination = {
...paginations,
total: total,
pageSize: size,
current,
showSizeChanger: total > 10,
onChange: (current, pageSize) => {
handlePageChange(current, pageSize);
},
onShowSizeChange: (current, pageSize) => {
handlePageChange(1, pageSize);
},
showTotal(total) {
return `总共 ${total} 条数据`;
},
};
return (
<Modal
title="事件日志"
placement="right"
width={1000}
maskClosable={false}
onCancel={() => {
dispatch({ type: 'Event/cancelModal' });
}}
visible={modalType === 'View_Event_Log' && modalShow}
footer={null}
>
<Table
rowKey="id"
loading={loading}
dataSource={records}
columns={columns}
pagination={pagination}
scroll={{ x: 1500, y: 600 }}
/>
</Modal>
);
};
export default connect(({ Event, loading }) => ({
...Event,
loading: loading.effects['Event/getEventRiskLog'],
}))(ModalEventLog);