|
@@ -31,7 +31,7 @@ export default class GroupDetail extends PureComponent {
|
|
payload: {
|
|
payload: {
|
|
pageNo: 1,
|
|
pageNo: 1,
|
|
pageSize: 1000,
|
|
pageSize: 1000,
|
|
- status: Codes.CODE_NORMAL
|
|
|
|
|
|
+ // status: Codes.CODE_NORMAL 不对状态进行过滤
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -61,7 +61,6 @@ export default class GroupDetail extends PureComponent {
|
|
form: {
|
|
form: {
|
|
validateFields,
|
|
validateFields,
|
|
getFieldsValue,
|
|
getFieldsValue,
|
|
- resetFields
|
|
|
|
},
|
|
},
|
|
groupDetail: {
|
|
groupDetail: {
|
|
operType,
|
|
operType,
|
|
@@ -70,15 +69,32 @@ export default class GroupDetail extends PureComponent {
|
|
}
|
|
}
|
|
} = this.props;
|
|
} = this.props;
|
|
validateFields((errors) => {
|
|
validateFields((errors) => {
|
|
- if (errors) { return; }
|
|
|
|
- const data = {
|
|
|
|
- ...currentItem,
|
|
|
|
- ...getFieldsValue(),
|
|
|
|
- };
|
|
|
|
|
|
+ if (errors) return;
|
|
|
|
+
|
|
|
|
+ let data = {};
|
|
|
|
+ if (operType === 'create') {
|
|
|
|
+ data = {
|
|
|
|
+ ...getFieldsValue(),
|
|
|
|
+ status: Codes.CODE_NORMAL
|
|
|
|
+ };
|
|
|
|
+ } else if (operType === 'update') {
|
|
|
|
+ const { id, merchantId, status, tagList, name, code } = currentItem;
|
|
|
|
+ data = {
|
|
|
|
+ id,
|
|
|
|
+ merchantId,
|
|
|
|
+ status,
|
|
|
|
+ name,
|
|
|
|
+ code,
|
|
|
|
+ tagList: (tagList || []).map(item => item.id),
|
|
|
|
+ ...getFieldsValue(),
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+
|
|
dispatch({
|
|
dispatch({
|
|
type: `groupDetail/${operType}`,
|
|
type: `groupDetail/${operType}`,
|
|
payload: data,
|
|
payload: data,
|
|
callback: () => {
|
|
callback: () => {
|
|
|
|
+ dispatch({ type: 'groupDetail/initState' });
|
|
dispatch(
|
|
dispatch(
|
|
routerRedux.push({
|
|
routerRedux.push({
|
|
pathname: '/tag/tagGroup',
|
|
pathname: '/tag/tagGroup',
|
|
@@ -87,13 +103,12 @@ export default class GroupDetail extends PureComponent {
|
|
);
|
|
);
|
|
}
|
|
}
|
|
})
|
|
})
|
|
- resetFields();
|
|
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
handlePageCancel = () => {
|
|
handlePageCancel = () => {
|
|
const { dispatch, groupDetail: { filters } } = this.props;
|
|
const { dispatch, groupDetail: { filters } } = this.props;
|
|
- dispatch({ type: 'groupDetail/clearPage' });
|
|
|
|
|
|
+ dispatch({ type: 'groupDetail/initState' });
|
|
dispatch(
|
|
dispatch(
|
|
routerRedux.push({
|
|
routerRedux.push({
|
|
pathname: '/tag/tagGroup',
|
|
pathname: '/tag/tagGroup',
|
|
@@ -104,8 +119,8 @@ export default class GroupDetail extends PureComponent {
|
|
|
|
|
|
render() {
|
|
render() {
|
|
const { dispatch, form: { getFieldDecorator }, groupDetail, merchant } = this.props;
|
|
const { dispatch, form: { getFieldDecorator }, groupDetail, merchant } = this.props;
|
|
- const { itemLoading, currentItem, filters, modalVisible } = groupDetail;
|
|
|
|
- const { tagList = [], name, code, merchantId } = currentItem;
|
|
|
|
|
|
+ const { itemLoading, currentItem, filters, modalVisible, operType } = groupDetail;
|
|
|
|
+ const { tagList, name, code, merchantId } = currentItem;
|
|
const { list } = merchant;
|
|
const { list } = merchant;
|
|
|
|
|
|
const tagTableColumns = [{
|
|
const tagTableColumns = [{
|
|
@@ -155,13 +170,13 @@ export default class GroupDetail extends PureComponent {
|
|
{getFieldDecorator('code', {
|
|
{getFieldDecorator('code', {
|
|
rules: [{ required: true, type: 'string', message: "编号为必填项!" }],
|
|
rules: [{ required: true, type: 'string', message: "编号为必填项!" }],
|
|
initialValue: code,
|
|
initialValue: code,
|
|
- })(<Input />)}
|
|
|
|
|
|
+ })(<Input placeholder="请输入" />)}
|
|
</FormItem>
|
|
</FormItem>
|
|
<FormItem label="标签组名称:" hasFeedback {...formItemLayout}>
|
|
<FormItem label="标签组名称:" hasFeedback {...formItemLayout}>
|
|
{getFieldDecorator('name', {
|
|
{getFieldDecorator('name', {
|
|
rules: [{ required: true, type: 'string', message: "名称为必填项!" }],
|
|
rules: [{ required: true, type: 'string', message: "名称为必填项!" }],
|
|
initialValue: name,
|
|
initialValue: name,
|
|
- })(<Input />)}
|
|
|
|
|
|
+ })(<Input placeholder="请输入" />)}
|
|
</FormItem>
|
|
</FormItem>
|
|
<FormItem label="渠道平台" hasFeedback {...formItemLayout}>
|
|
<FormItem label="渠道平台" hasFeedback {...formItemLayout}>
|
|
{getFieldDecorator('merchantId', {
|
|
{getFieldDecorator('merchantId', {
|
|
@@ -173,6 +188,7 @@ export default class GroupDetail extends PureComponent {
|
|
allowClear
|
|
allowClear
|
|
placeholder="请输入渠道编号或者名称进行筛选"
|
|
placeholder="请输入渠道编号或者名称进行筛选"
|
|
optionFilterProp="children"
|
|
optionFilterProp="children"
|
|
|
|
+ disabled={operType === 'update' ? true : false}
|
|
filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
|
|
filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
|
|
>
|
|
>
|
|
{list.map(item => <Option value={item.id} key={item.id}>{`${item.code}/${item.name}`}</Option>)}
|
|
{list.map(item => <Option value={item.id} key={item.id}>{`${item.code}/${item.name}`}</Option>)}
|
|
@@ -180,14 +196,14 @@ export default class GroupDetail extends PureComponent {
|
|
)}
|
|
)}
|
|
</FormItem>
|
|
</FormItem>
|
|
<FormItem label="标签排序" {...formItemLayout}>
|
|
<FormItem label="标签排序" {...formItemLayout}>
|
|
- <Button onClick={this.handleModalShow} disabled={!tagList.length} type="primary" size="small" icon="edit">排序</Button>
|
|
|
|
|
|
+ <Button onClick={this.handleModalShow} disabled={!tagList || !tagList.length} type="primary" size="small" icon="edit">排序</Button>
|
|
</FormItem>
|
|
</FormItem>
|
|
<FormItem wrapperCol={{ offset: 7, span: 12 }}>
|
|
<FormItem wrapperCol={{ offset: 7, span: 12 }}>
|
|
<Table
|
|
<Table
|
|
locale={{
|
|
locale={{
|
|
emptyText: <span style={{ color: "#C6D0D6" }}> <Icon type="frown-o"/>该标签组下不包含任何标签,无法排序,请先去关联标签吧!</span>
|
|
emptyText: <span style={{ color: "#C6D0D6" }}> <Icon type="frown-o"/>该标签组下不包含任何标签,无法排序,请先去关联标签吧!</span>
|
|
}}
|
|
}}
|
|
- dataSource={tagList}
|
|
|
|
|
|
+ dataSource={tagList || []}
|
|
columns={tagTableColumns}
|
|
columns={tagTableColumns}
|
|
rowKey={record => record.id}
|
|
rowKey={record => record.id}
|
|
bordered
|
|
bordered
|
|
@@ -200,7 +216,7 @@ export default class GroupDetail extends PureComponent {
|
|
</FormItem>
|
|
</FormItem>
|
|
</Form>
|
|
</Form>
|
|
<TagSortModal
|
|
<TagSortModal
|
|
- tagList={tagList}
|
|
|
|
|
|
+ tagList={tagList || []}
|
|
rowKeyName="id"
|
|
rowKeyName="id"
|
|
modalVisible={modalVisible}
|
|
modalVisible={modalVisible}
|
|
onCancel={this.handleModalCancel}
|
|
onCancel={this.handleModalCancel}
|