Merge remote-tracking branch 'origin/master'

This commit is contained in:
xiaofeng 2019-07-16 23:50:32 +08:00
commit 5c4cff4db2
4 changed files with 47 additions and 1 deletions

View File

@ -1,5 +1,11 @@
import { message } from 'antd'; import { message } from 'antd';
import { deptTreePage, deptTreeAll, addDeptment, updateDeptment } from '../../services/admin'; import {
deptTreePage,
deptTreeAll,
addDeptment,
updateDeptment,
deleteDeptment,
} from '../../services/admin';
const buildSelectTree = list => { const buildSelectTree = list => {
return list.map(item => { return list.map(item => {
@ -35,6 +41,13 @@ export default {
onSuccess && onSuccess(); onSuccess && onSuccess();
} }
}, },
*delete({ payload }, { call, put }) {
const { onSuccess, body } = payload;
const response = yield call(deleteDeptment, body);
if (response && response.code === 0) {
onSuccess && onSuccess();
}
},
*update({ payload }, { call, put }) { *update({ payload }, { call, put }) {
const { onSuccess, body } = payload; const { onSuccess, body } = payload;
const response = yield call(updateDeptment, body); const response = yield call(updateDeptment, body);

View File

@ -130,6 +130,32 @@ export default class DepetmentList extends PureComponent {
} }
}; };
handleDelete(row) {
const { dispatch } = this.props;
Modal.confirm({
title: `确认删除?`,
content: `${row.name}`,
onOk() {
dispatch({
type: 'deptmentList/delete',
payload: {
body: {
id: row.id,
},
onSuccess: () => {
message.success('删除成功');
this.handleModalVisible();
},
onFail: response => {
message.warn('删除失败' + response.message);
},
},
});
},
onCancel() {},
});
}
handleAdd = ({ fields, modalType, initValues }) => { handleAdd = ({ fields, modalType, initValues }) => {
const { dispatch } = this.props; const { dispatch } = this.props;
if (modalType === 'add') { if (modalType === 'add') {

View File

@ -74,6 +74,12 @@ export async function updateDeptment(params) {
}); });
} }
export async function deleteDeptment(params) {
return request(`/admin-api/admins/dept/delete?${stringify(params)}`, {
method: 'POST',
});
}
export async function deptTreePage(params) { export async function deptTreePage(params) {
return request(`/admin-api/admins/dept/tree/page?${stringify(params)}`, { return request(`/admin-api/admins/dept/tree/page?${stringify(params)}`, {
method: 'GET', method: 'GET',

View File

@ -313,6 +313,7 @@ INSERT INTO `resource` VALUES (50, 2, 3, '删除字典', 19, '', NULL, 'system.d
INSERT INTO `resource` VALUES (51, 1, -1, '短信ss', 0, '', 'user', '', '2019-05-26 12:00:31', '2019-06-03 13:54:54', b'0'); INSERT INTO `resource` VALUES (51, 1, -1, '短信ss', 0, '', 'user', '', '2019-05-26 12:00:31', '2019-06-03 13:54:54', b'0');
INSERT INTO `resource` VALUES (52, 1, 1, '短信签名', 51, '/sms/sign-list', 'user', '', '2019-05-26 12:01:56', '2019-05-26 12:01:56', b'0'); INSERT INTO `resource` VALUES (52, 1, 1, '短信签名', 51, '/sms/sign-list', 'user', '', '2019-05-26 12:01:56', '2019-05-26 12:01:56', b'0');
INSERT INTO `resource` VALUES (53, 1, 2, '短信模板', 51, '/sms/template-list', 'user', '', '2019-05-26 12:02:19', '2019-05-26 12:02:18', b'0'); INSERT INTO `resource` VALUES (53, 1, 2, '短信模板', 51, '/sms/template-list', 'user', '', '2019-05-26 12:02:19', '2019-05-26 12:02:18', b'0');
INSERT INTO `resource` VALUES (54, 1, 3, '部门管理', 13, '/admin/dept-list', 'user', '', '2019-06-27 23:41:19', '2019-06-27 23:41:51', b'0')
COMMIT; COMMIT;
-- ---------------------------- -- ----------------------------