import React, { PureComponent } from 'react'; import moment from 'moment'; import { Table, Alert, Badge, Divider } from 'antd'; import styles from './index.less'; const statusMap = ['default', 'processing', 'success', 'error']; class StandardTable extends PureComponent { state = { selectedRowKeys: [], totalCallNo: 0, }; componentWillReceiveProps(nextProps) { // clean state if (nextProps.selectedRows.length === 0) { this.setState({ selectedRowKeys: [], totalCallNo: 0, }); } } handleRowSelectChange = (selectedRowKeys, selectedRows) => { const totalCallNo = selectedRows.reduce((sum, val) => { return sum + parseFloat(val.callNo, 10); }, 0); if (this.props.onSelectRow) { this.props.onSelectRow(selectedRows); } this.setState({ selectedRowKeys, totalCallNo }); } handleTableChange = (pagination, filters, sorter) => { this.props.onChange(pagination, filters, sorter); } cleanSelectedKeys = () => { this.handleRowSelectChange([], []); } render() { const { selectedRowKeys, totalCallNo } = this.state; const { data: { list, pagination }, loading } = this.props; const status = ['关闭', '运行中', '已上线', '异常']; const columns = [ { title: '规则编号', dataIndex: 'no', }, { title: '描述', dataIndex: 'description', }, { title: '服务调用次数', dataIndex: 'callNo', sorter: true, render: val => (