123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- import React, { Component } from 'react';
- import moment from 'moment';
- import { connect } from 'dva';
- import { Card } from 'antd';
- import { StandardTableList } from '../../../components/AXList';
- import { addRowKey } from '../../../utils/utils';
- @connect(({ loading, accounts }) => ({
- accounts,
- loading: loading.models.accounts,
- }))
- export default class CampusAccountsPage extends Component {
- constructor(props) {
- super(props);
- const { state } = props.location;
- this.state = {
- UIParams: (state || {}).UIParams, // 组件的状态参数
- Queryers: (state || {}).Queryers, // 查询的条件参数
- };
- }
- componentWillMount() {
- this.props.dispatch({
- type: 'accounts/fetchCampusList',
- payload: { ...this.state.Queryers }
- })
- }
- handleDownloadOperation = () => {
- this.props.dispatch({
- type: 'accounts/fetchCampusExcel'
- })
- };
- handleFilterOperation = (params, states) => {
- this.setState({
- UIParams: states,
- Queryers: params,
- });
- this.props.dispatch({
- type: 'accounts/fetchCampusList',
- payload: {
- ...params,
- },
- });
- };
- render() {
- const { loading,accounts } = this.props;
- const { list, totalSize, pageSize, pageNo } = accounts;
- const basicSearch = {
- keys: [{
- name: '校区编号',
- field: 'code',
- }, {
- name: '校区名称',
- field: 'name',
- }],
- };
- const pagination = {
- pageNo,
- pageSize,
- totalSize,
- };
- const columns = [{
- title: '校区编号',
- key: 1,
- dataIndex: 'code',
- width: '10%',
- }, {
- title: '校区名称',
- key: 2,
- dataIndex: 'name',
- width: '23%',
- }, {
- title: '校区类型',
- key: 3,
- dataIndex: 'merchantName',
- width: '10%',
- }, {
- title: '所属省(直辖市)',
- key: 4,
- dataIndex: 'provinceName',
- width: '12%',
- }, {
- title: '所属市(区)/县',
- key: 5,
- dataIndex: 'cityName',
- width: '12%',
- }, {
- title: '联系人',
- key: 6,
- dataIndex: 'contactName',
- width: '7%',
- }, {
- title: '联系电话',
- key: 7,
- dataIndex: 'mobile',
- width: '10%',
- }, {
- title: '更新时间',
- key: 8,
- dataIndex: 'gmtModified',
- render: text => moment(text).format('YYYY-MM-DD HH:mm:ss'),
- width: '15%',
- }];
- return (
- <Card>
- <StandardTableList
- columns={columns}
- loading={loading}
- dataSource={addRowKey(list)}
- header={{
- basicSearch,
- onFilterClick: this.handleFilterOperation,
- onDownload: this.handleDownloadOperation,
- }}
- footer={{
- pagination,
- }}
- keepUIState={{ ...this.state.UIParams }}
- showStatusSelect={false}
- />
- </Card>
- );
- }
- }
|