1. 迁移角色相关逻辑
2. admin-web 接入角色新接口
This commit is contained in:
@@ -2,13 +2,16 @@ import { message } from 'antd';
|
||||
import { arrayToStringParams } from '../../utils/request.qs';
|
||||
import { buildTreeNode, findAllNodes, findCheckedKeys } from '../../utils/tree.utils';
|
||||
import {
|
||||
addRole,
|
||||
updateRole,
|
||||
deleteRole,
|
||||
queryRole,
|
||||
queryRoleResourceTree,
|
||||
roleAssignResource,
|
||||
} from '../../services/admin';
|
||||
import {
|
||||
rolePage,
|
||||
roleAdd,
|
||||
roleUpdate,
|
||||
roleDelete,
|
||||
} from '../../services/system';
|
||||
|
||||
|
||||
export default {
|
||||
namespace: 'roleList',
|
||||
@@ -27,7 +30,7 @@ export default {
|
||||
effects: {
|
||||
*add({ payload }, { call, put }) {
|
||||
const { callback, body, queryParams } = payload;
|
||||
const response = yield call(addRole, body);
|
||||
const response = yield call(roleAdd, body);
|
||||
if (callback) {
|
||||
callback(response);
|
||||
}
|
||||
@@ -40,7 +43,7 @@ export default {
|
||||
},
|
||||
*update({ payload }, { call, put }) {
|
||||
const { callback, body, queryParams } = payload;
|
||||
const response = yield call(updateRole, body);
|
||||
const response = yield call(roleUpdate, body);
|
||||
if (callback) {
|
||||
callback(response);
|
||||
}
|
||||
@@ -53,7 +56,7 @@ export default {
|
||||
},
|
||||
*delete({ payload }, { call, put }) {
|
||||
const { queryParams, body } = payload;
|
||||
yield call(deleteRole, body);
|
||||
yield call(roleDelete, body);
|
||||
message.info('删除成功!');
|
||||
yield put({
|
||||
type: 'query',
|
||||
@@ -63,7 +66,7 @@ export default {
|
||||
});
|
||||
},
|
||||
*query({ payload }, { call, put }) {
|
||||
const response = yield call(queryRole, payload);
|
||||
const response = yield call(rolePage, payload);
|
||||
message.info('查询成功!');
|
||||
const { total, list } = response.data;
|
||||
yield put({
|
||||
|
||||
@@ -44,6 +44,12 @@ const CreateForm = Form.create()(props => {
|
||||
initialValue: initValues.name,
|
||||
})(<Input placeholder="请输入" />)}
|
||||
</FormItem>
|
||||
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="角色编码">
|
||||
{form.getFieldDecorator('code', {
|
||||
rules: [{ required: false }],
|
||||
initialValue: initValues.code,
|
||||
})(<Input placeholder="请输入" />)}
|
||||
</FormItem>
|
||||
</Modal>
|
||||
);
|
||||
});
|
||||
@@ -286,6 +292,10 @@ class RoleList extends PureComponent {
|
||||
title: '名称',
|
||||
dataIndex: 'name',
|
||||
},
|
||||
{
|
||||
title: '编码',
|
||||
dataIndex: 'code',
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
|
||||
@@ -88,30 +88,7 @@ export async function deptTreeAll() {
|
||||
|
||||
// role
|
||||
|
||||
export async function queryRole(params) {
|
||||
return request(`/admin-api/admins/role/page?${stringify(params)}`);
|
||||
}
|
||||
|
||||
export async function deleteRole(params) {
|
||||
return request(`/admin-api/admins/role/delete?${stringify(params)}`, {
|
||||
method: 'POST',
|
||||
body: {},
|
||||
});
|
||||
}
|
||||
|
||||
export async function addRole(params) {
|
||||
return request(`/admin-api/admins/role/add?${stringify(params)}`, {
|
||||
method: 'POST',
|
||||
body: {},
|
||||
});
|
||||
}
|
||||
|
||||
export async function updateRole(params) {
|
||||
return request(`/admin-api/admins/role/update?${stringify(params)}`, {
|
||||
method: 'POST',
|
||||
body: {},
|
||||
});
|
||||
}
|
||||
|
||||
export async function queryRoleResourceTree(params) {
|
||||
return request(`/admin-api/admins/role/resource_tree?${stringify(params)}`, {
|
||||
|
||||
@@ -49,3 +49,30 @@ export async function resourceDelete(params) {
|
||||
method: 'POST',
|
||||
});
|
||||
}
|
||||
|
||||
// ========== Role 模块 ==========
|
||||
|
||||
export async function rolePage(params) {
|
||||
return request(`/system-api/admins/role/page?${stringify(params)}`);
|
||||
}
|
||||
|
||||
export async function roleDelete(params) {
|
||||
return request(`/system-api/admins/role/delete?${stringify(params)}`, {
|
||||
method: 'POST',
|
||||
body: {},
|
||||
});
|
||||
}
|
||||
|
||||
export async function roleAdd(params) {
|
||||
return request(`/system-api/admins/role/add?${stringify(params)}`, {
|
||||
method: 'POST',
|
||||
body: {},
|
||||
});
|
||||
}
|
||||
|
||||
export async function roleUpdate(params) {
|
||||
return request(`/system-api/admins/role/update?${stringify(params)}`, {
|
||||
method: 'POST',
|
||||
body: {},
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user