|
@@ -1,3 +1,4 @@
|
|
|
|
+/* eslint-disable prefer-destructuring */
|
|
import React, { Component } from 'react';
|
|
import React, { Component } from 'react';
|
|
import moment from 'moment';
|
|
import moment from 'moment';
|
|
import { connect } from 'dva';
|
|
import { connect } from 'dva';
|
|
@@ -26,7 +27,7 @@ function merchantDataFormatter(data) {
|
|
return data.map((item) => {
|
|
return data.map((item) => {
|
|
return {
|
|
return {
|
|
text: item.name,
|
|
text: item.name,
|
|
- value: item.id,
|
|
|
|
|
|
+ value: `${item.name}||${item.id}`,
|
|
};
|
|
};
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -45,13 +46,19 @@ export default class CampusListPage extends Component {
|
|
this.state = {
|
|
this.state = {
|
|
UIParams: (state || {}).UIParams, // 组件的状态参数
|
|
UIParams: (state || {}).UIParams, // 组件的状态参数
|
|
Queryers: (state || {}).Queryers, // 查询的条件参数
|
|
Queryers: (state || {}).Queryers, // 查询的条件参数
|
|
|
|
+ merchants: (state || {}).merchants || [], // 记录筛选渠道
|
|
filterModalDestroy: true,
|
|
filterModalDestroy: true,
|
|
};
|
|
};
|
|
}
|
|
}
|
|
componentDidMount() {
|
|
componentDidMount() {
|
|
|
|
+ const { merchants } = this.state;
|
|
|
|
+ let merchantId;
|
|
|
|
+ if (merchants && merchants.length) {
|
|
|
|
+ merchantId = merchants[0].split('||')[1];
|
|
|
|
+ }
|
|
this.props.dispatch({
|
|
this.props.dispatch({
|
|
type: 'campus/fetchCampusList',
|
|
type: 'campus/fetchCampusList',
|
|
- payload: { ...this.state.Queryers },
|
|
|
|
|
|
+ payload: { merchantId, ...this.state.Queryers },
|
|
});
|
|
});
|
|
}
|
|
}
|
|
handleCreateOperation = () => {
|
|
handleCreateOperation = () => {
|
|
@@ -59,44 +66,54 @@ export default class CampusListPage extends Component {
|
|
pathname: '/campus/create',
|
|
pathname: '/campus/create',
|
|
state: this.state,
|
|
state: this.state,
|
|
}));
|
|
}));
|
|
- }
|
|
|
|
|
|
+ };
|
|
handleEditOperation = (item) => {
|
|
handleEditOperation = (item) => {
|
|
this.props.dispatch(routerRedux.push({
|
|
this.props.dispatch(routerRedux.push({
|
|
pathname: `/campus/edit/${item.id}`,
|
|
pathname: `/campus/edit/${item.id}`,
|
|
state: this.state,
|
|
state: this.state,
|
|
}));
|
|
}));
|
|
- }
|
|
|
|
|
|
+ };
|
|
handleFilterOperation = (params, states) => {
|
|
handleFilterOperation = (params, states) => {
|
|
|
|
+ const { merchants } = this.state;
|
|
|
|
+ let merchantId;
|
|
|
|
+ if (merchants && merchants.length) {
|
|
|
|
+ merchantId = merchants[0].split('||')[1];
|
|
|
|
+ }
|
|
this.props.dispatch({
|
|
this.props.dispatch({
|
|
type: 'campus/fetchCampusList',
|
|
type: 'campus/fetchCampusList',
|
|
- payload: params,
|
|
|
|
|
|
+ payload: { merchantId, ...params },
|
|
});
|
|
});
|
|
this.setState({
|
|
this.setState({
|
|
UIParams: states,
|
|
UIParams: states,
|
|
Queryers: params,
|
|
Queryers: params,
|
|
});
|
|
});
|
|
- }
|
|
|
|
|
|
+ };
|
|
handleModalFilterOperation = () => {
|
|
handleModalFilterOperation = () => {
|
|
const { getFieldValue } = this.props.form;
|
|
const { getFieldValue } = this.props.form;
|
|
- const value = getFieldValue('merchantId');
|
|
|
|
|
|
+ const merchants = getFieldValue('merchants');
|
|
|
|
+ let merchantId;
|
|
|
|
+ if (merchants && merchants.length) {
|
|
|
|
+ merchantId = merchants[0].split('||')[1];
|
|
|
|
+ }
|
|
this.props.dispatch({
|
|
this.props.dispatch({
|
|
type: 'campus/fetchCampusList',
|
|
type: 'campus/fetchCampusList',
|
|
payload: {
|
|
payload: {
|
|
|
|
+ merchantId,
|
|
...this.state.Queryers,
|
|
...this.state.Queryers,
|
|
- merchantId: value[0],
|
|
|
|
},
|
|
},
|
|
});
|
|
});
|
|
|
|
+ this.setState({ merchants });
|
|
this.handleFilterModalDestroy();
|
|
this.handleFilterModalDestroy();
|
|
- }
|
|
|
|
|
|
+ };
|
|
handleBatchOperation = () => {
|
|
handleBatchOperation = () => {
|
|
Message.info('暂不支持批量操作!');
|
|
Message.info('暂不支持批量操作!');
|
|
- }
|
|
|
|
|
|
+ };
|
|
handleFilterModalShow = () => {
|
|
handleFilterModalShow = () => {
|
|
this.setState({ filterModalDestroy: false });
|
|
this.setState({ filterModalDestroy: false });
|
|
- }
|
|
|
|
|
|
+ };
|
|
handleFilterModalDestroy = () => {
|
|
handleFilterModalDestroy = () => {
|
|
this.setState({ filterModalDestroy: true });
|
|
this.setState({ filterModalDestroy: true });
|
|
- }
|
|
|
|
|
|
+ };
|
|
handleRemoteSelectSearch = (value) => {
|
|
handleRemoteSelectSearch = (value) => {
|
|
this.props.dispatch({
|
|
this.props.dispatch({
|
|
type: 'merchant/fetchMerchantList',
|
|
type: 'merchant/fetchMerchantList',
|
|
@@ -105,9 +122,10 @@ export default class CampusListPage extends Component {
|
|
name: value,
|
|
name: value,
|
|
},
|
|
},
|
|
});
|
|
});
|
|
- }
|
|
|
|
|
|
+ };
|
|
|
|
|
|
render() {
|
|
render() {
|
|
|
|
+ const { merchants } = this.state;
|
|
const { loading, fetching, form, campus, merchant } = this.props;
|
|
const { loading, fetching, form, campus, merchant } = this.props;
|
|
const { list, totalSize, pageSize, pageNo } = campus;
|
|
const { list, totalSize, pageSize, pageNo } = campus;
|
|
const { getFieldDecorator } = form;
|
|
const { getFieldDecorator } = form;
|
|
@@ -218,8 +236,8 @@ export default class CampusListPage extends Component {
|
|
>
|
|
>
|
|
<Form>
|
|
<Form>
|
|
<Form.Item label="所属商户" {...formItemLayout}>
|
|
<Form.Item label="所属商户" {...formItemLayout}>
|
|
- {getFieldDecorator('merchantId', {
|
|
|
|
- initialValue: [],
|
|
|
|
|
|
+ {getFieldDecorator('merchants', {
|
|
|
|
+ initialValue: merchants,
|
|
})(
|
|
})(
|
|
<AXRemoteSelect
|
|
<AXRemoteSelect
|
|
fetching={fetching}
|
|
fetching={fetching}
|