AccountsTotalList.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. import React, { Component } from 'react';
  2. import { connect } from 'dva';
  3. import { Card } from 'antd';
  4. import { StandardTableList } from '../../../components/AXList';
  5. import { addRowKey, renderStatus } from '../../../utils/utils';
  6. @connect(({ loading, accounts }) => ({
  7. accounts,
  8. loading: loading.models.accounts,
  9. }))
  10. export default class TotalListAccountsPage extends Component {
  11. constructor(props) {
  12. super(props);
  13. const { state } = props.location;
  14. this.state = {
  15. UIParams: (state || {}).UIParams, // 组件的状态参数
  16. Queryers: (state || {}).Queryers, // 查询的条件参数
  17. };
  18. }
  19. componentWillMount() {
  20. this.props.dispatch({
  21. type: 'accounts/fetchCampusAmount',
  22. payload: {}
  23. })
  24. this.props.dispatch({
  25. type: 'accounts/fetchTotalList',
  26. payload: { ...this.state.Queryers }
  27. })
  28. }
  29. handleFilterOperation = (params, states) => {
  30. this.setState({
  31. UIParams: states,
  32. Queryers: params,
  33. });
  34. this.props.dispatch({
  35. type: 'accounts/fetchTerminalsList',
  36. payload: {
  37. ...params,
  38. },
  39. });
  40. };
  41. render() {
  42. const { loading,accounts } = this.props;
  43. const { list, totalSize, pageSize, pageNo, campusAmount} = accounts;
  44. const basicSearch = {
  45. keys: [{
  46. name: '校区名称',
  47. field: 'campusName',
  48. }, {
  49. name: '终端编号',
  50. field: 'code',
  51. }],
  52. };
  53. const pagination = {
  54. pageNo,
  55. pageSize,
  56. totalSize,
  57. };
  58. const columns = [{
  59. title: '校区类型',
  60. key: 1,
  61. dataIndex: 'merchantName',
  62. width: '15%',
  63. }, {
  64. title: '校区名称',
  65. key: 2,
  66. dataIndex: 'campusName',
  67. width: '20%',
  68. }, {
  69. title: '终端编号',
  70. key: 3,
  71. dataIndex: 'code',
  72. width: '20%',
  73. }, {
  74. title: '终端名称',
  75. key: 4,
  76. dataIndex: 'name',
  77. width: '30%',
  78. }, {
  79. title: '课程状态',
  80. key: 5,
  81. dataIndex: 'status',
  82. render: text => renderStatus(text),
  83. width: '15%',
  84. }];
  85. return (
  86. <Card>
  87. <StandardTableList
  88. columns={columns}
  89. loading={loading}
  90. dataSource={addRowKey(list)}
  91. header={{
  92. basicSearch,
  93. campusAmount,
  94. onFilterClick: this.handleFilterOperation,
  95. }}
  96. footer={{
  97. pagination,
  98. }}
  99. keepUIState={{ ...this.state.UIParams }}
  100. showStatusSelect={false}
  101. />
  102. </Card>
  103. );
  104. }
  105. }