From c95981ff1ce815becb658d3d79ca2ad1f9a532db Mon Sep 17 00:00:00 2001 From: Mr Ke <kelq@hugeinfo.com.cn> Date: Mon, 06 Apr 2020 18:13:50 +0800 Subject: [PATCH] 修改工作台排行榜 --- src/components/common/TopListTableView/index.jsx | 17 +++-- src/components/common/TopListTableView/tagList.js | 125 +++++++++++++++++++++++++---------------- 2 files changed, 86 insertions(+), 56 deletions(-) diff --git a/src/components/common/TopListTableView/index.jsx b/src/components/common/TopListTableView/index.jsx index 859bf83..d359b2b 100644 --- a/src/components/common/TopListTableView/index.jsx +++ b/src/components/common/TopListTableView/index.jsx @@ -7,7 +7,7 @@ /** 榜单table列表 */ import React, { ReactNode, ReactEventHandler, Component } from 'react'; import { Table, Row, Col } from 'antd'; -import { tagList } from './tagList'; +import { tagList, tag } from './tagList'; import fetch from '../../../api/request'; import './index.scss'; @@ -28,21 +28,25 @@ url: `api/merits/queryMerits` }).then(res => { console.log('res', res); - }) - this.setState({ - topList: tagList + this.setState({ + topList: [ + { ...tag['latenessRanking'], dataSource: res['latenessRanking'] }, + { ...tag['meritsRanking'], dataSource: res['meritsRanking'] }, + { ...tag['defectRanking'], dataSource: res['defectRanking'] }, + ] + }) }) } componentDidMount() { } - renderDom = ({ name, columns }) => { + 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={[{ age: 1 }]} + dataSource={dataSource || []} columns={columns} size="small" bordered={false} @@ -53,6 +57,7 @@ render() { let { topList } = this.state; + console.log(topList) return ( <div className="top-list-table-view-main"> <Row type="flex" gutter={12}> diff --git a/src/components/common/TopListTableView/tagList.js b/src/components/common/TopListTableView/tagList.js index 646b9e4..4de7ad2 100644 --- a/src/components/common/TopListTableView/tagList.js +++ b/src/components/common/TopListTableView/tagList.js @@ -1,83 +1,108 @@ /* eslint-disable */ -export const tagList = [ - { - name: '考勤榜单', - columns: [ - { - title: '名词', - dataIndex: 'index', - key: 'index' - }, - { - title: '姓名', - dataIndex: 'name', - key: 'name' - }, - { - title: '部门', - dataIndex: 'part', - key: 'part' - }, - { - title: '次数', - dataIndex: 'count', - key: 'count' - }, - { - title: '时长(分)', - dataIndex: 'time', - key: 'timer' - } - ] - }, - { +export const tag = { + // 绩效排行 + meritsRanking: { name: '绩效榜单', columns: [ { - title: '名词', + title: '名次', dataIndex: 'index', - key: 'index' + key: 'index', + render: (item, cur, idx) => { + return idx + 1; + } }, { title: '姓名', - dataIndex: 'name', - key: 'name' + dataIndex: 'userName', + key: 'userName' }, { title: '部门', - dataIndex: 'part', - key: 'part' + dataIndex: 'userDeptName', + key: 'userDeptName' }, { title: '绩效得分', - dataIndex: 'score', - key: 'score' + dataIndex: 'meritsGrade', + key: 'meritsGrade', + render: (cur, item) => { + return cur + '分'; + } } ] }, - { + + // 缺陷排行 + defectRanking: { name: '缺陷榜单', columns: [ { - title: '名词', + title: '名次', dataIndex: 'index', - key: 'index' + key: 'index', + render: (item, cur, idx) => { + return idx + 1; + } }, { title: '姓名', - dataIndex: 'name', - key: 'name' + dataIndex: 'userName', + key: 'userName' }, { title: '部门', - dataIndex: 'part', - key: 'part' + dataIndex: 'userDeptName', + key: 'userDeptName' }, { title: '缺陷数', - dataIndex: 'quexianshu', - key: 'quexianshu' + dataIndex: 'defectNumber', + key: 'defectNumber', + render: (cur, item) => { + return cur + '个'; + } + } + ] + }, + + latenessRanking: { + name: '考勤(迟到)榜单', + columns: [ + { + title: '名次', + dataIndex: 'index', + key: 'index', + render: (item, cur, idx) => { + return idx + 1; + } + }, + { + title: '姓名', + dataIndex: 'userName', + key: 'userName' + }, + { + title: '部门', + dataIndex: 'userDeptName', + key: 'userDeptName' + }, + { + title: '次数', + dataIndex: 'lateness', + key: 'lateness', + render: (item, cur) => { + return item + '次'; + } + }, + { + title: '时长(分)', + dataIndex: 'latenessTime', + key: 'latenessTime', + render: (item, cur) => { + return item + '分钟'; + } } ] } -]; +}; -- Gitblit v1.8.0