|
@@ -1,15 +1,9 @@
|
|
|
import React, { Component } from 'react';
|
|
|
import PropTypes from 'prop-types';
|
|
|
-import { Table, Radio, Pagination } from 'antd';
|
|
|
+import { Table, Pagination } from 'antd';
|
|
|
import styles from './SingleSelectTable.less';
|
|
|
|
|
|
export default class SingleSelectTable extends Component {
|
|
|
- static defaultProps = {
|
|
|
- loading: false,
|
|
|
- columns: [],
|
|
|
- dataSource: [],
|
|
|
- pagination: false,
|
|
|
- };
|
|
|
static propTypes = {
|
|
|
loading: PropTypes.bool,
|
|
|
columns: PropTypes.array,
|
|
@@ -19,13 +13,19 @@ export default class SingleSelectTable extends Component {
|
|
|
PropTypes.bool,
|
|
|
]),
|
|
|
};
|
|
|
+ static defaultProps = {
|
|
|
+ loading: false,
|
|
|
+ columns: [],
|
|
|
+ dataSource: [],
|
|
|
+ pagination: false,
|
|
|
+ };
|
|
|
state = {
|
|
|
selectedRowKeys: null,
|
|
|
};
|
|
|
|
|
|
handleRowSelectChange = (record) => {
|
|
|
this.setState({
|
|
|
- selectedRowKeys: record.key,
|
|
|
+ selectedRowKeys: [record.key],
|
|
|
});
|
|
|
this.props.onSingleTransfer(record);
|
|
|
};
|
|
@@ -40,7 +40,7 @@ export default class SingleSelectTable extends Component {
|
|
|
const rowSelection = {
|
|
|
type: 'radio',
|
|
|
selectedRowKeys,
|
|
|
- onChange: this.handleRowSelectChange,
|
|
|
+ onChange: (_, rows) => this.handleRowSelectChange(rows[0]),
|
|
|
};
|
|
|
const onRowClick = (record) => {
|
|
|
return {
|