修改 新增 删除部门 刷新页面
This commit is contained in:
parent
5c4cff4db2
commit
e01179605b
@ -107,13 +107,23 @@ export default class DepetmentList extends PureComponent {
|
|||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { dispatch } = this.props;
|
const { dispatch } = this.props;
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'deptmentList/getDeptmentList',
|
type: 'deptmentList/getDeptmentAll',
|
||||||
payload: {
|
payload: {
|
||||||
...PaginationHelper.defaultPayload,
|
...PaginationHelper.defaultPayload,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initFetch = () => {
|
||||||
|
const { dispatch } = this.props;
|
||||||
|
dispatch({
|
||||||
|
type: 'deptmentList/getDeptmentAll',
|
||||||
|
payload: {
|
||||||
|
...PaginationHelper.defaultPayload,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
handleModalVisible = (flag, modalType, initValues) => {
|
handleModalVisible = (flag, modalType, initValues) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
modalVisible: !!flag,
|
modalVisible: !!flag,
|
||||||
@ -132,6 +142,7 @@ export default class DepetmentList extends PureComponent {
|
|||||||
|
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const { dispatch } = this.props;
|
const { dispatch } = this.props;
|
||||||
|
const _this = this;
|
||||||
Modal.confirm({
|
Modal.confirm({
|
||||||
title: `确认删除?`,
|
title: `确认删除?`,
|
||||||
content: `${row.name}`,
|
content: `${row.name}`,
|
||||||
@ -144,7 +155,7 @@ export default class DepetmentList extends PureComponent {
|
|||||||
},
|
},
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
message.success('删除成功');
|
message.success('删除成功');
|
||||||
this.handleModalVisible();
|
_this.initFetch();
|
||||||
},
|
},
|
||||||
onFail: response => {
|
onFail: response => {
|
||||||
message.warn('删除失败' + response.message);
|
message.warn('删除失败' + response.message);
|
||||||
@ -168,6 +179,7 @@ export default class DepetmentList extends PureComponent {
|
|||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
message.success('添加成功');
|
message.success('添加成功');
|
||||||
this.handleModalVisible();
|
this.handleModalVisible();
|
||||||
|
this.initFetch();
|
||||||
},
|
},
|
||||||
onFail: response => {
|
onFail: response => {
|
||||||
message.warn('添加失败' + response.message);
|
message.warn('添加失败' + response.message);
|
||||||
@ -185,6 +197,7 @@ export default class DepetmentList extends PureComponent {
|
|||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
message.success('更新成功成功');
|
message.success('更新成功成功');
|
||||||
this.handleModalVisible();
|
this.handleModalVisible();
|
||||||
|
this.initFetch();
|
||||||
},
|
},
|
||||||
onFail: response => {
|
onFail: response => {
|
||||||
message.warn('更新失败' + response.message);
|
message.warn('更新失败' + response.message);
|
||||||
@ -195,7 +208,7 @@ export default class DepetmentList extends PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { deptmentData, deptmentList } = this.props;
|
const { deptmentData, deptmentList, loading } = this.props;
|
||||||
const { selectTree } = deptmentList;
|
const { selectTree } = deptmentList;
|
||||||
const { modalVisible, modalType, initValues } = this.state;
|
const { modalVisible, modalType, initValues } = this.state;
|
||||||
const parentMethods = {
|
const parentMethods = {
|
||||||
@ -255,8 +268,9 @@ export default class DepetmentList extends PureComponent {
|
|||||||
<Table
|
<Table
|
||||||
defaultExpandAllRows={true}
|
defaultExpandAllRows={true}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
dataSource={deptmentData.list ? deptmentData.list : []}
|
dataSource={deptmentList.list ? deptmentList.list : []}
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
|
loading={loading}
|
||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
<CreateForm {...parentMethods} selectTree={selectTree} modalVisible={modalVisible} />
|
<CreateForm {...parentMethods} selectTree={selectTree} modalVisible={modalVisible} />
|
||||||
|
Loading…
Reference in New Issue
Block a user