/* 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 => {
|
console.log('res', res);
|
this.setState({
|
topList: [
|
{ ...tag['latenessRanking'], dataSource: res['latenessRanking'] },
|
{ ...tag['meritsRanking'], dataSource: res['meritsRanking'] },
|
{ ...tag['defectRanking'], dataSource: res['defectRanking'] },
|
]
|
})
|
})
|
}
|
|
componentDidMount() { }
|
|
renderDom = ({ name, columns, dataSource }) => {
|
return <div className="top-list-table-view-main-table">
|
<div className="top-list-table-view-main-table-title">{name}
|
<span className="top-list-table-view-main-table-title-fuc">查看</span>
|
</div>
|
<Table
|
dataSource={dataSource ? dataSource.map((a, idx) => ({ ...a, key: idx })) : []}
|
columns={columns}
|
size="small"
|
bordered={false}
|
pagination={false}
|
/>
|
</div>
|
}
|
|
render() {
|
let { topList } = this.state;
|
console.log(topList)
|
return (
|
<div className="top-list-table-view-main">
|
<Row type="flex" gutter={12}>
|
{
|
topList.map((item, idx) => {
|
return <Col span={24 / 3} key={idx}>{this.renderDom(item)}</Col>;
|
})
|
}
|
</Row>
|
</div>
|
)
|
}
|
}
|