AccountsTotalList.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. import React, { Component } from 'react';
  2. import moment from 'moment';
  3. import { connect } from 'dva';
  4. import { Card, message, Badge } from 'antd';
  5. import { StandardTableList } from '../../../components/AXList';
  6. import { addRowKey, renderStatus } from '../../../utils/utils';
  7. @connect(({ loading, accounts }) => ({
  8. accounts,
  9. loading: loading.models.accounts,
  10. }))
  11. export default class TotalListAccountsPage extends Component {
  12. constructor(props) {
  13. super(props);
  14. const { state } = props.location;
  15. this.state = {
  16. UIParams: (state || {}).UIParams, // 组件的状态参数
  17. Queryers: (state || {}).Queryers, // 查询的条件参数
  18. };
  19. }
  20. componentWillMount() {
  21. // 获取总的学校得数量
  22. this.props.dispatch({
  23. type: 'accounts/fetchCampusAmount',
  24. payload: {}
  25. })
  26. // 获取总表数据
  27. this.props.dispatch({
  28. type: 'accounts/fetchTotalList',
  29. payload: { ...this.state.Queryers }
  30. })
  31. }
  32. handleFilterOperation = (params, states) => {
  33. this.setState({
  34. UIParams: states,
  35. Queryers: params,
  36. });
  37. this.props.dispatch({
  38. type: 'accounts/fetchTerminalsList',
  39. payload: {
  40. ...params,
  41. },
  42. });
  43. };
  44. render() {
  45. const { loading,accounts } = this.props;
  46. const { list, totalSize, pageSize, pageNo, campusAmount} = accounts;
  47. const basicSearch = {
  48. keys: [{
  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. }