| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Table, message, Button, Typography } from 'antd' |
| | | import './index.scss' |
| | | |
| | |
| | | loading: PropTypes.bool, // 表格加载中 |
| | | refreshdata: PropTypes.func, // 表格中排序列、页码的变化时刷新 |
| | | buttonTrigger: PropTypes.func, // 表格中按钮触发操作 |
| | | handleTableId: PropTypes.func // 控制表格数据切换时,更新在主表中的id |
| | | handleTableId: PropTypes.func, // 控制表格数据切换时,更新在主表中的id |
| | | pickup: PropTypes.any // 数据展开合并控制 |
| | | } |
| | | |
| | | state = { |
| | |
| | | <div className={match ? item.color : ''}> |
| | | <div className="background"></div> |
| | | <div className="content" style={{ minWidth: (item.Width || 120) + 'px' }}> |
| | | <Paragraph copyable ellipsis={{ rows: 3, expandable: true }}>{content}</Paragraph> |
| | | {content ? <Paragraph copyable ellipsis={{ rows: 3, expandable: true }}>{content}</Paragraph> : null} |
| | | </div> |
| | | </div> |
| | | ) |
| | |
| | | this.props.handleTableId(_id, _data) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | render() { |
| | | let { selectedRowKeys } = this.state |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | let _data = this.props.data ? this.props.data : [] |
| | | if (this.props.pickup) { |
| | | _data = _data.filter((item, index) => selectedRowKeys.includes(index)) |
| | | } |
| | | |
| | | return ( |
| | | <div className="sub-table"> |
| | | <Table |
| | |
| | | bordered={true} |
| | | rowSelection={rowSelection} |
| | | columns={this.state.columns} |
| | | dataSource={this.props.data ? this.props.data : []} |
| | | dataSource={_data} |
| | | loading={this.props.loading} |
| | | scroll={{ x: '100%', y: false }} |
| | | onRow={(record, index) => { |