import React, { Component } from 'react'; import moment from 'moment'; import { connect } from 'dva'; import { routerRedux } from 'dva/router'; import { Card, Modal, Form, Button, message } from 'antd'; import { StandardTableList } from '../../components/RBList'; import RBRemoteSelect from '../../components/RBRemoteSelect'; import PageHeaderLayout from '../../layouts/PageHeaderLayout'; import { addRowKey } from '../../utils/utils'; import styles from './CampusList.less'; const Message = message; const formItemLayout = { labelCol: { xs: { span: 24 }, sm: { span: 7 }, }, wrapperCol: { xs: { span: 24 }, sm: { span: 15 }, md: { span: 13 }, }, }; function merchantDataFormatter(data) { return data.map((item) => { return { text: item.name, value: item.id, }; }); } @Form.create() @connect(({ loading, campus, merchant }) => ({ campus, merchant, fetching: loading.models.merchant, loading: loading.models.campus, })) export default class CampusListPage extends Component { constructor(props) { super(props); const { state } = props.location; this.state = { UIParams: (state || {}).UIParams, // 组件的状态参数 Queryers: (state || {}).Queryers, // 查询的条件参数 filterModalDestroy: true, }; } componentDidMount() { this.props.dispatch({ type: 'campus/fetchCampusList', payload: { ...this.state.Queryers }, }); } handleCreateOperation = () => { this.props.dispatch(routerRedux.push({ pathname: '/campus/create', state: this.state, })); } handleEditOperation = (item) => { this.props.dispatch(routerRedux.push({ pathname: `/campus/edit/${item.id}`, state: this.state, })); } handleFilterOperation = (params, states) => { this.props.dispatch({ type: 'campus/fetchCampusList', payload: params, }); this.setState({ UIParams: states, Queryers: params, }); } handleModalFilterOperation = () => { const { getFieldValue } = this.props.form; const value = getFieldValue('merchantId'); this.props.dispatch({ type: 'campus/fetchCampusList', payload: { ...this.state.Queryers, merchantId: value[0], }, }); this.handleFilterModalDestroy(); } handleBatchOperation = () => { Message.info('暂不支持批量操作!'); } handleFilterModalShow = () => { this.setState({ filterModalDestroy: false }); } handleFilterModalDestroy = () => { this.setState({ filterModalDestroy: true }); } handleRemoteSelectSearch = (value) => { this.props.dispatch({ type: 'merchant/fetchMerchantList', payload: { pageSize: 50, name: value, }, }); } render() { const { loading, fetching, form, campus, merchant } = this.props; const { list, totalSize, pageSize, pageNo } = campus; const { getFieldDecorator } = form; const renderOperation = (item) => { return (