规格页面,列表

This commit is contained in:
zhenxianyimeng
2019-08-26 23:44:16 +08:00
parent 37d85b37ca
commit 795314ca04
9 changed files with 238 additions and 32 deletions

View File

@@ -1,11 +1,14 @@
import { message } from 'antd';
import { productAttrTree, productAttrValueAdd } from '../../services/product';
import { productAttrTree, productAttrValueAdd, productAttrPage } from '../../services/product';
import PaginationHelper from '../../../helpers/PaginationHelper';
export default {
namespace: 'productAttrList',
state: {
list: [],
attrData: [],
pagination: PaginationHelper.defaultPaginationConfig,
},
effects: {
@@ -51,6 +54,21 @@ export default {
// });
// },
*page({ payload }, { call, put }) {
const result = yield call(productAttrPage, payload);
let attrData = {};
if (result.code === 0) {
attrData = result.data;
}
yield put({
type: 'save',
payload: {
attrData,
pagination: PaginationHelper.formatPagination(attrData, payload),
},
});
},
*tree({ payload }, { call, put }) {
const { queryParams } = payload;
const response = yield call(productAttrTree, queryParams);
@@ -84,10 +102,16 @@ export default {
callback(response.data);
}
}
}
},
},
reducers: {
save(state, action) {
return {
...state,
...action.payload,
};
},
treeSuccess(state, { payload }) {
return {
...state,