From e01179605b45c49eba6a0508551e60d9e02b97b0 Mon Sep 17 00:00:00 2001 From: zhenxianyimeng <1920405993@qq.com> Date: Sun, 21 Jul 2019 15:05:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E6=96=B0=E5=A2=9E=20?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=83=A8=E9=97=A8=20=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin-web/src/pages/Admin/DeptmentList.js | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/admin-web/src/pages/Admin/DeptmentList.js b/admin-web/src/pages/Admin/DeptmentList.js index 512c8bdfe..621d86539 100644 --- a/admin-web/src/pages/Admin/DeptmentList.js +++ b/admin-web/src/pages/Admin/DeptmentList.js @@ -107,13 +107,23 @@ export default class DepetmentList extends PureComponent { componentDidMount() { const { dispatch } = this.props; dispatch({ - type: 'deptmentList/getDeptmentList', + type: 'deptmentList/getDeptmentAll', payload: { ...PaginationHelper.defaultPayload, }, }); } + initFetch = () => { + const { dispatch } = this.props; + dispatch({ + type: 'deptmentList/getDeptmentAll', + payload: { + ...PaginationHelper.defaultPayload, + }, + }); + }; + handleModalVisible = (flag, modalType, initValues) => { this.setState({ modalVisible: !!flag, @@ -132,6 +142,7 @@ export default class DepetmentList extends PureComponent { handleDelete(row) { const { dispatch } = this.props; + const _this = this; Modal.confirm({ title: `确认删除?`, content: `${row.name}`, @@ -144,7 +155,7 @@ export default class DepetmentList extends PureComponent { }, onSuccess: () => { message.success('删除成功'); - this.handleModalVisible(); + _this.initFetch(); }, onFail: response => { message.warn('删除失败' + response.message); @@ -168,6 +179,7 @@ export default class DepetmentList extends PureComponent { onSuccess: () => { message.success('添加成功'); this.handleModalVisible(); + this.initFetch(); }, onFail: response => { message.warn('添加失败' + response.message); @@ -185,6 +197,7 @@ export default class DepetmentList extends PureComponent { onSuccess: () => { message.success('更新成功成功'); this.handleModalVisible(); + this.initFetch(); }, onFail: response => { message.warn('更新失败' + response.message); @@ -195,7 +208,7 @@ export default class DepetmentList extends PureComponent { }; render() { - const { deptmentData, deptmentList } = this.props; + const { deptmentData, deptmentList, loading } = this.props; const { selectTree } = deptmentList; const { modalVisible, modalType, initValues } = this.state; const parentMethods = { @@ -255,8 +268,9 @@ export default class DepetmentList extends PureComponent {