Browse Source

enhance TableList: auto search after editing (#3380)

pull/3416/head
何乐 7 years ago
committed by 陈帅
parent
commit
bdc92d5c99
  1. 9
      mock/rule.js
  2. 10
      src/pages/List/TableList.js
  3. 6
      src/services/api.js

9
mock/rule.js

@ -122,14 +122,7 @@ function postRule(req, res, u, b) {
break; break;
} }
const result = { return getRule(req, res, u);
list: tableListDataSource,
pagination: {
total: tableListDataSource.length,
},
};
return res.json(result);
} }
export default { export default {

10
src/pages/List/TableList.js

@ -483,12 +483,16 @@ class TableList extends PureComponent {
handleUpdate = fields => { handleUpdate = fields => {
const { dispatch } = this.props; const { dispatch } = this.props;
const { formValues } = this.state;
dispatch({ dispatch({
type: 'rule/update', type: 'rule/update',
payload: { payload: {
name: fields.name, query: formValues,
desc: fields.desc, body: {
key: fields.key, name: fields.name,
desc: fields.desc,
key: fields.key,
},
}, },
}); });

6
src/services/api.js

@ -33,11 +33,11 @@ export async function addRule(params) {
}); });
} }
export async function updateRule(params) { export async function updateRule(params = {}) {
return request('/api/rule', { return request(`/api/rule?${stringify(params.query)}`, {
method: 'POST', method: 'POST',
body: { body: {
...params, ...params.body,
method: 'update', method: 'update',
}, },
}); });

Loading…
Cancel
Save