|
@@ -1,3 +1,4 @@
|
|
|
+/* eslint-disable prefer-destructuring */
|
|
|
import React, { Component } from 'react';
|
|
|
import moment from 'moment';
|
|
|
import { connect } from 'dva';
|
|
@@ -26,7 +27,7 @@ function arrayDataFormatter(data) {
|
|
|
return data.map((item) => {
|
|
|
return {
|
|
|
text: item.name,
|
|
|
- value: item.id,
|
|
|
+ value: `${item.name}||${item.id}`,
|
|
|
};
|
|
|
});
|
|
|
}
|
|
@@ -47,13 +48,28 @@ export default class TerminalListPage extends Component {
|
|
|
this.state = {
|
|
|
UIParams: (state || {}).UIParams, // 组件的状态参数
|
|
|
Queryers: (state || {}).Queryers, // 查询的条件参数
|
|
|
+ merchants: (state || {}).merchants || [], // 记录筛选的渠道
|
|
|
+ campuses: (state || {}).campuses || [], // 记录筛选的校区
|
|
|
filterModalDestroy: true,
|
|
|
};
|
|
|
}
|
|
|
componentDidMount() {
|
|
|
+ const { merchants, campuses } = this.state;
|
|
|
+ let merchantId;
|
|
|
+ if (merchants && merchants.length) {
|
|
|
+ merchantId = merchants[0].split('||')[1];
|
|
|
+ }
|
|
|
+ let campusId;
|
|
|
+ if (campuses && campuses.length) {
|
|
|
+ campusId = campuses[0].split('||')[1];
|
|
|
+ }
|
|
|
this.props.dispatch({
|
|
|
type: 'terminal/fetchTerminalList',
|
|
|
- payload: { ...this.state.Queryers },
|
|
|
+ payload: {
|
|
|
+ campusId,
|
|
|
+ merchantId,
|
|
|
+ ...this.state.Queryers,
|
|
|
+ },
|
|
|
});
|
|
|
}
|
|
|
handleCreateOperation = () => {
|
|
@@ -119,26 +135,48 @@ export default class TerminalListPage extends Component {
|
|
|
}));
|
|
|
};
|
|
|
handleFilterOperation = (params, states) => {
|
|
|
- this.props.dispatch({
|
|
|
- type: 'terminal/fetchTerminalList',
|
|
|
- payload: params,
|
|
|
- });
|
|
|
this.setState({
|
|
|
UIParams: states,
|
|
|
Queryers: params,
|
|
|
});
|
|
|
+ const { merchants, campuses } = this.state;
|
|
|
+ let merchantId;
|
|
|
+ if (merchants && merchants.length) {
|
|
|
+ merchantId = merchants[0].split('||')[1];
|
|
|
+ }
|
|
|
+ let campusId;
|
|
|
+ if (campuses && campuses.length) {
|
|
|
+ campusId = campuses[0].split('||')[1];
|
|
|
+ }
|
|
|
+ this.props.dispatch({
|
|
|
+ type: 'terminal/fetchTerminalList',
|
|
|
+ payload: {
|
|
|
+ campusId,
|
|
|
+ merchantId,
|
|
|
+ ...params,
|
|
|
+ },
|
|
|
+ });
|
|
|
};
|
|
|
handleModalFilterOperation = () => {
|
|
|
const { getFieldsValue } = this.props.form;
|
|
|
- const { merchantIds, campusIds } = getFieldsValue();
|
|
|
+ const { merchants, campuses } = getFieldsValue();
|
|
|
+ let merchantId;
|
|
|
+ if (merchants && merchants.length) {
|
|
|
+ merchantId = merchants[0].split('||')[1];
|
|
|
+ }
|
|
|
+ let campusId;
|
|
|
+ if (campuses && campuses.length) {
|
|
|
+ campusId = campuses[0].split('||')[1];
|
|
|
+ }
|
|
|
this.props.dispatch({
|
|
|
type: 'terminal/fetchTerminalList',
|
|
|
payload: {
|
|
|
...this.state.Queryers,
|
|
|
- merchantId: merchantIds[0],
|
|
|
- campusId: campusIds[0],
|
|
|
+ merchantId,
|
|
|
+ campusId,
|
|
|
},
|
|
|
});
|
|
|
+ this.setState({ merchants, campuses });
|
|
|
this.handleFilterModalDestroy();
|
|
|
};
|
|
|
handleBatchOperation = () => {
|
|
@@ -170,6 +208,7 @@ export default class TerminalListPage extends Component {
|
|
|
};
|
|
|
|
|
|
render() {
|
|
|
+ const { merchants, campuses } = this.state;
|
|
|
const { loading, fetching1, fetching2, form, campus, merchant, terminal } = this.props;
|
|
|
const { list, totalSize, pageSize, pageNo } = terminal;
|
|
|
const { getFieldDecorator } = form;
|
|
@@ -318,8 +357,8 @@ export default class TerminalListPage extends Component {
|
|
|
>
|
|
|
<Form>
|
|
|
<Form.Item label="所属商户" {...formItemLayout}>
|
|
|
- {getFieldDecorator('merchantIds', {
|
|
|
- initialValue: [],
|
|
|
+ {getFieldDecorator('merchants', {
|
|
|
+ initialValue: merchants,
|
|
|
})(
|
|
|
<AXRemoteSelect
|
|
|
fetching={fetching1}
|
|
@@ -329,8 +368,8 @@ export default class TerminalListPage extends Component {
|
|
|
)}
|
|
|
</Form.Item>
|
|
|
<Form.Item label="所属校区" {...formItemLayout}>
|
|
|
- {getFieldDecorator('campusIds', {
|
|
|
- initialValue: [],
|
|
|
+ {getFieldDecorator('campuses', {
|
|
|
+ initialValue: campuses,
|
|
|
})(
|
|
|
<AXRemoteSelect
|
|
|
fetching={fetching2}
|