From 2d0e600900696bb309d09efd47fd7d4980eeb172 Mon Sep 17 00:00:00 2001 From: liyj <1003249715@qq.com> Date: Mon, 01 Jun 2020 16:11:28 +0800 Subject: [PATCH] 页面调整 --- src/components/common/TopListTableView/index.jsx | 28 +++++++++++++++------------- 1 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/components/common/TopListTableView/index.jsx b/src/components/common/TopListTableView/index.jsx index d359b2b..69f34c1 100644 --- a/src/components/common/TopListTableView/index.jsx +++ b/src/components/common/TopListTableView/index.jsx @@ -27,26 +27,29 @@ 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'] }, - ] - }) + 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"> + 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> + {/* <span className="top-list-table-view-main-table-title-fuc">查看</span> */} </div> <Table - dataSource={dataSource || []} + scroll={{ y: 130 }} + dataSource={dataSource ? dataSource.map((a, idx) => ({ ...a, key: idx })) : []} columns={columns} size="small" bordered={false} @@ -57,13 +60,12 @@ 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>; + return <Col span={24 / topList.length} key={idx} >{this.renderDom(item)}</Col>; }) } </Row> -- Gitblit v1.8.0