import React, { Component } from 'react'; import moment from 'moment'; import { connect } from 'dva'; import { routerRedux } from 'dva/router'; import { Card, Button, message } from 'antd'; import { StandardTableList } from '../../../components/AXList'; import { renderStatus, renderCategory, addRowKey } from '../../../utils/utils'; const Message = message; @connect(({ loading, merchant }) => ({ merchant, loading: loading.models.merchant, })) export default class MerchantListPage extends Component { constructor(props) { super(props); const { state } = props.location; this.state = { UIParams: (state || {}).UIParams, // 组件的状态参数 Queryers: (state || {}).Queryers, // 查询的条件参数 }; } componentDidMount() { this.props.dispatch({ type: 'merchant/fetchMerchantList', payload: { ...this.state.Queryers }, }); } handleEditRecommend = ({ id }) => { this.props.dispatch(routerRedux.push({ pathname: `/frontend/recommend/edit/${id}`, state: this.state, })); } handleFilterOperation = (params, states) => { this.props.dispatch({ type: 'merchant/fetchMerchantList', payload: params, }); this.setState({ UIParams: states, Queryers: params, }); } handleBatchOperation = () => { Message.info('暂不支持批量操作!'); } render() { const { loading, merchant } = this.props; const { list, totalSize, pageSize, pageNo } = merchant; const renderOperation = (item) => { return (
); }; const batchActions = [{ key: 'modify', name: '批量修改', }]; const basicSearch = { keys: [{ name: '商户编号', field: 'code', }, { name: '商户名称', field: 'name', }], }; const pagination = { pageNo, pageSize, totalSize, }; const columns = [{ title: '商户编号', key: 1, dataIndex: 'code', width: '16%', }, { title: '商户名称', key: 2, dataIndex: 'name', width: '18%', }, { title: '商户简称', key: 3, dataIndex: 'simple', width: '16%', }, { title: '商户类型', key: 4, dataIndex: 'domain', render: text => renderCategory(text), width: '12%', }, { title: '状态', key: 5, dataIndex: 'status', render: text => renderStatus(text), width: '12%', }, { title: '更新时间', key: 6, dataIndex: 'gmtModified', render: text => moment(text).format('YYYY-MM-DD HH:mm:ss'), width: '16%', }, { title: '操作', key: 7, dataIndex: 'operation', render: (_, record) => renderOperation(record), width: '10%', align: 'right', }]; return ( ); } }