forked from huge/frontEnd/hugeOA

Mr Ke
2020-05-27 fa71559c92ce8f7429971370ca4bd1139c903621
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
/* eslint-disable */
/**柯礼钦
 * 4/6/2020, 11:03:52 AM
 * doc comment for the file goes here
 */
 
/** 榜单table列表 */
import React, { ReactNode, ReactEventHandler, Component } from 'react';
import { Table, Row, Col } from 'antd';
import { tagList, tag } from './tagList';
import fetch from '../../../api/request';
 
import './index.scss';
 
 
export default class TopListTableView extends Component {
  constructor(props) {
    super(props);
    this.config = {
    };
    this.state = {
      topList: []
    };
  }
 
  componentWillMount() {
    fetch({
      url: `api/merits/queryMerits`
    }).then(res => {
      if( res) {
        this.setState({
          topList: [
            { ...tag['latenessRanking'], dataSource: res['latenessRanking'] },
            { ...tag['earlyRanking'], dataSource: res['earlyRanking'] },
            // { ...tag['meritsRanking'], dataSource: res['meritsRanking'] },
            { ...tag['defectRanking'], dataSource: res['defectRanking'] },
          ]
        })
      }
    })
  }
 
  componentDidMount() { }
 
  renderDom = ({ name, columns, dataSource }) => {
    return <div className="top-list-table-view-main-table h-100">
      <div className="top-list-table-view-main-table-title">{name}
        {/* <span className="top-list-table-view-main-table-title-fuc">查看</span> */}
      </div>
      <Table
        scroll={{ y: 130 }}
        dataSource={dataSource ? dataSource.map((a, idx) => ({ ...a, key: idx })) : []}
        columns={columns}
        size="small"
        bordered={false}
        pagination={false}
      />
    </div>
  }
 
  render() {
    let { topList } = this.state;
    return (
      <div className="top-list-table-view-main">
        <Row type="flex" gutter={12}>
          {
            topList.map((item, idx) => {
              return <Col span={24 / topList.length} key={idx} >{this.renderDom(item)}</Col>;
            })
          }
        </Row>
      </div>
    )
  }
}