|
@@ -1,15 +1,38 @@
|
|
|
import React, { Component } from 'react';
|
|
|
import moment from 'moment';
|
|
|
import { connect } from 'dva';
|
|
|
-import { Card, Badge } from 'antd';
|
|
|
+import { Card, Badge, Modal, Form } from 'antd';
|
|
|
import { StandardTableList } from '../../../components/AXList';
|
|
|
import { addRowKey } from '../../../utils/utils';
|
|
|
import styles from './AccountsTerminals.less';
|
|
|
+import AXRemoteSelect from '../../../components/AXRemoteSelect';
|
|
|
|
|
|
+const formItemLayout = {
|
|
|
+ labelCol: {
|
|
|
+ xs: { span: 24 },
|
|
|
+ sm: { span: 7 },
|
|
|
+ },
|
|
|
+ wrapperCol: {
|
|
|
+ xs: { span: 24 },
|
|
|
+ sm: { span: 15 },
|
|
|
+ md: { span: 13 },
|
|
|
+ },
|
|
|
+};
|
|
|
+function arrayDataFormatter(data) {
|
|
|
+ return data.map((item) => {
|
|
|
+ return {
|
|
|
+ text: item.name,
|
|
|
+ value: `${item.name}||${item.id}`,
|
|
|
+ };
|
|
|
+ });
|
|
|
+}
|
|
|
|
|
|
-@connect(({ loading, accounts }) => ({
|
|
|
+@Form.create()
|
|
|
+@connect(({ loading, accounts, campus }) => ({
|
|
|
accounts,
|
|
|
+ campus,
|
|
|
loading: loading.models.accounts,
|
|
|
+ fetching: loading.models.campus,
|
|
|
}))
|
|
|
|
|
|
export default class TerminalsAccountsPage extends Component {
|
|
@@ -19,21 +42,29 @@ export default class TerminalsAccountsPage extends Component {
|
|
|
this.state = {
|
|
|
UIParams: (state || {}).UIParams, // 组件的状态参数
|
|
|
Queryers: (state || {}).Queryers, // 查询的条件参数
|
|
|
+ campuses: (state || {}).campuses || [], // 记录筛选的校区
|
|
|
+ filterModalDestroy: true,
|
|
|
};
|
|
|
}
|
|
|
componentWillMount() {
|
|
|
+ const { campuses } = this.state;
|
|
|
+ let campusId;
|
|
|
+ if (campuses && campuses.length) {
|
|
|
+ campusId = campuses[0].split('||')[1];
|
|
|
+ }
|
|
|
this.props.dispatch({
|
|
|
type: 'accounts/fetchTerminalsList',
|
|
|
- payload: { ...this.state.Queryers }
|
|
|
- })
|
|
|
+ payload: {
|
|
|
+ campusId,
|
|
|
+ ...this.state.Queryers,
|
|
|
+ },
|
|
|
+ });
|
|
|
}
|
|
|
- // 下载
|
|
|
handleDownloadOperation = () => {
|
|
|
this.props.dispatch({
|
|
|
type: 'accounts/fetchTerminalsExcel',
|
|
|
- })
|
|
|
+ });
|
|
|
};
|
|
|
-
|
|
|
handleFilterOperation = (params, states) => {
|
|
|
this.setState({
|
|
|
UIParams: states,
|
|
@@ -46,10 +77,43 @@ export default class TerminalsAccountsPage extends Component {
|
|
|
},
|
|
|
});
|
|
|
};
|
|
|
+ handleFilterModalShow = () => {
|
|
|
+ this.setState({ filterModalDestroy: false });
|
|
|
+ };
|
|
|
+ handleFilterModalDestroy = () => {
|
|
|
+ this.setState({ filterModalDestroy: true });
|
|
|
+ };
|
|
|
+ handleModalFilterOperation = () => {
|
|
|
+ const { getFieldsValue } = this.props.form;
|
|
|
+ const { campuses } = getFieldsValue();
|
|
|
+ let campusId;
|
|
|
+ if (campuses && campuses.length) {
|
|
|
+ campusId = campuses[0].split('||')[1];
|
|
|
+ }
|
|
|
+ this.props.dispatch({
|
|
|
+ type: 'accounts/fetchTerminalsList',
|
|
|
+ payload: {
|
|
|
+ campusId,
|
|
|
+ ...this.state.Queryers,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ this.handleFilterModalDestroy();
|
|
|
+ this.setState({ campuses });
|
|
|
+ };
|
|
|
+ handleTerminalsRemoteSelectSearch = (value) => {
|
|
|
+ this.props.dispatch({
|
|
|
+ type: 'campus/fetchCampusList',
|
|
|
+ payload: {
|
|
|
+ pageSize: 50,
|
|
|
+ name: value,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ };
|
|
|
render() {
|
|
|
- const { loading,accounts } = this.props;
|
|
|
+ const { campuses } = this.state;
|
|
|
+ const { loading, accounts, fetching, campus, form } = this.props;
|
|
|
const { list, totalSize, pageSize, pageNo } = accounts;
|
|
|
-
|
|
|
+ const { getFieldDecorator } = form;
|
|
|
const basicSearch = {
|
|
|
keys: [{
|
|
|
name: '终端编号',
|
|
@@ -61,7 +125,6 @@ export default class TerminalsAccountsPage extends Component {
|
|
|
pageSize,
|
|
|
totalSize,
|
|
|
};
|
|
|
-
|
|
|
const columns = [{
|
|
|
title: '终端编号',
|
|
|
key: 1,
|
|
@@ -129,6 +192,7 @@ export default class TerminalsAccountsPage extends Component {
|
|
|
dataSource={addRowKey(list)}
|
|
|
header={{
|
|
|
basicSearch,
|
|
|
+ onAdvanceFilterClick: this.handleFilterModalShow,
|
|
|
onFilterClick: this.handleFilterOperation,
|
|
|
onDownload: this.handleDownloadOperation,
|
|
|
}}
|
|
@@ -138,6 +202,32 @@ export default class TerminalsAccountsPage extends Component {
|
|
|
keepUIState={{ ...this.state.UIParams }}
|
|
|
showStatusSelect={false}
|
|
|
/>
|
|
|
+ {!this.state.filterModalDestroy && (
|
|
|
+ <Modal
|
|
|
+ width={600}
|
|
|
+ visible
|
|
|
+ title="高级筛选"
|
|
|
+ okText="筛选"
|
|
|
+ cancelText="取消"
|
|
|
+ maskClosable={false}
|
|
|
+ onCancel={this.handleFilterModalDestroy}
|
|
|
+ onOk={this.handleModalFilterOperation}
|
|
|
+ >
|
|
|
+ <Form>
|
|
|
+ <Form.Item label="所属校区" {...formItemLayout}>
|
|
|
+ {getFieldDecorator('campuses', {
|
|
|
+ initialValue: campuses,
|
|
|
+ })(
|
|
|
+ <AXRemoteSelect
|
|
|
+ fetching={fetching}
|
|
|
+ dataSource={arrayDataFormatter(campus.list)}
|
|
|
+ onSearch={this.handleTerminalsRemoteSelectSearch}
|
|
|
+ />
|
|
|
+ )}
|
|
|
+ </Form.Item>
|
|
|
+ </Form>
|
|
|
+ </Modal>
|
|
|
+ )}
|
|
|
</Card>
|
|
|
);
|
|
|
}
|