forked from alibaba/ice
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProgressTable.jsx
More file actions
78 lines (70 loc) · 1.97 KB
/
ProgressTable.jsx
File metadata and controls
78 lines (70 loc) · 1.97 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
/* eslint no-mixed-operators:0 */
import React, { Component } from 'react';
import { Table, Progress, Pagination } from '@icedesign/base';
import IceContainer from '@icedesign/container';
const getTableData = () => {
return Array.from({ length: 10 }).map((item, index) => {
return {
name: 'A旗舰店',
total: Math.ceil(Math.random() * 1000000),
count: 300 - index * 10,
progress: Math.ceil(Math.random() * 100),
};
});
};
export default class ProgressTable extends Component {
static displayName = 'ProgressTable';
constructor(props) {
super(props);
this.state = {
dataSource: getTableData(),
current: 1,
};
}
renderCellProgress = (value) => (
<Progress showInfo={false} percent={parseInt(value, 10)} />
);
onPageChange = (pageNo) => {
this.setState({
current: pageNo,
});
};
render() {
return (
<div className="progress-table">
<IceContainer className="tab-card" title="本月最活跃金主">
<Table
hasBorder
getRowClassName={(record, index) => {
return `progress-table-tr progress-table-tr${index}`;
}}
dataSource={this.state.dataSource}
>
<Table.Column title="店铺名称" dataIndex="name" />
<Table.Column title="成交金额" dataIndex="total" />
<Table.Column title="成交单数" dataIndex="count" />
<Table.Column
title=""
dataIndex="progress"
cell={this.renderCellProgress}
/>
</Table>
<div style={styles.paginationWrapper}>
<Pagination
current={this.state.current}
onChange={this.onPageChange}
shape="arrow-only"
/>
</div>
</IceContainer>
</div>
);
}
}
const styles = {
paginationWrapper: {
display: 'flex',
padding: '20px 0 0 0',
flexDirection: 'row-reverse',
},
};