AccountsCampus.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. import React, { Component } from 'react';
  2. import moment from 'moment';
  3. import { connect } from 'dva';
  4. import { Card } from 'antd';
  5. import { StandardTableList } from '../../../components/AXList';
  6. import { addRowKey } from '../../../utils/utils';
  7. @connect(({ loading, accounts }) => ({
  8. accounts,
  9. loading: loading.models.accounts,
  10. }))
  11. export default class CampusAccountsPage 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. this.props.dispatch({
  22. type: 'accounts/fetchCampusList',
  23. payload: { ...this.state.Queryers }
  24. })
  25. }
  26. handleDownloadOperation = () => {
  27. this.props.dispatch({
  28. type: 'accounts/fetchCampusExcel'
  29. })
  30. };
  31. handleFilterOperation = (params, states) => {
  32. this.setState({
  33. UIParams: states,
  34. Queryers: params,
  35. });
  36. this.props.dispatch({
  37. type: 'accounts/fetchCampusList',
  38. payload: {
  39. ...params,
  40. },
  41. });
  42. };
  43. render() {
  44. const { loading,accounts } = this.props;
  45. const { list, totalSize, pageSize, pageNo } = accounts;
  46. const basicSearch = {
  47. keys: [{
  48. name: '校区编号',
  49. field: 'code',
  50. }, {
  51. name: '校区名称',
  52. field: 'name',
  53. }],
  54. };
  55. const pagination = {
  56. pageNo,
  57. pageSize,
  58. totalSize,
  59. };
  60. const columns = [{
  61. title: '校区编号',
  62. key: 1,
  63. dataIndex: 'code',
  64. width: '10%',
  65. }, {
  66. title: '校区名称',
  67. key: 2,
  68. dataIndex: 'name',
  69. width: '23%',
  70. }, {
  71. title: '校区类型',
  72. key: 3,
  73. dataIndex: 'merchantName',
  74. width: '10%',
  75. }, {
  76. title: '所属省(直辖市)',
  77. key: 4,
  78. dataIndex: 'provinceName',
  79. width: '12%',
  80. }, {
  81. title: '所属市(区)/县',
  82. key: 5,
  83. dataIndex: 'cityName',
  84. width: '12%',
  85. }, {
  86. title: '联系人',
  87. key: 6,
  88. dataIndex: 'contactName',
  89. width: '7%',
  90. }, {
  91. title: '联系电话',
  92. key: 7,
  93. dataIndex: 'mobile',
  94. width: '10%',
  95. }, {
  96. title: '更新时间',
  97. key: 8,
  98. dataIndex: 'gmtModified',
  99. render: text => moment(text).format('YYYY-MM-DD HH:mm:ss'),
  100. width: '15%',
  101. }];
  102. return (
  103. <Card>
  104. <StandardTableList
  105. columns={columns}
  106. loading={loading}
  107. dataSource={addRowKey(list)}
  108. header={{
  109. basicSearch,
  110. onFilterClick: this.handleFilterOperation,
  111. onDownload: this.handleDownloadOperation,
  112. }}
  113. footer={{
  114. pagination,
  115. }}
  116. keepUIState={{ ...this.state.UIParams }}
  117. showStatusSelect={false}
  118. />
  119. </Card>
  120. );
  121. }
  122. }