角色页面增加了与后端接口的交互
This commit is contained in:
@@ -3,34 +3,64 @@ import type { ReqPage } from '@/api/interface'
|
||||
// 角色管理模块
|
||||
export namespace Role {
|
||||
|
||||
//资源接口
|
||||
export interface Permission{
|
||||
key: string; //权限名称
|
||||
label: string; //权限ID
|
||||
disabled:boolean; //是否拥有该权限
|
||||
id: string; //资源ID
|
||||
name: string; //资源名称
|
||||
code: string; //资源代码
|
||||
}
|
||||
|
||||
//角色接口
|
||||
export interface RoleBO {
|
||||
id?: string; //角色类型ID
|
||||
name: string; //角色类型名称
|
||||
code: string; //角色代码
|
||||
type: number; //角色类型
|
||||
remark:string; //角色描述
|
||||
}
|
||||
|
||||
//角色+资源
|
||||
export interface ReqRoleAndPermission extends RoleBO{
|
||||
permissionList?:Permission[]; //角色权限列表
|
||||
}
|
||||
|
||||
// 角色+分页
|
||||
export interface ReqRoleParams extends ReqPage,RoleBO {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// export interface Permission{
|
||||
// key: string; //权限名称
|
||||
// label: string; //权限ID
|
||||
// disabled:boolean; //是否拥有该权限
|
||||
// }
|
||||
|
||||
// 角色列表
|
||||
export interface ResRoleList {
|
||||
id: string; //角色类型ID
|
||||
rolename: string; //角色类型名称
|
||||
status: number; //角色类型状态
|
||||
describe:string; //角色描述
|
||||
permissionList?:Permission[]; //角色权限列表
|
||||
}
|
||||
// export interface ResRoleList {
|
||||
// id: string; //角色类型ID
|
||||
// rolename: string; //角色类型名称
|
||||
// status: number; //角色类型状态
|
||||
// describe:string; //角色描述
|
||||
// permissionList?:Permission[]; //角色权限列表
|
||||
// }
|
||||
|
||||
// 角色参数
|
||||
export interface ReqRoleParams extends ReqPage {
|
||||
id: string; //角色类型ID
|
||||
rolename: string; //角色类型名称
|
||||
status: number; //角色类型状态
|
||||
describe:string; //角色描述
|
||||
permissionList?:Permission[]; //角色权限列表
|
||||
}
|
||||
|
||||
|
||||
|
||||
// export interface ReqRoleParams extends ReqPage {
|
||||
// id: string; //角色类型ID
|
||||
// rolename: string; //角色类型名称
|
||||
// status: number; //角色类型状态
|
||||
// describe:string; //角色描述
|
||||
// permissionList?:Permission[]; //角色权限列表
|
||||
// }
|
||||
// 角色字典
|
||||
export interface ResStatus {
|
||||
roleLabel: string;
|
||||
roleValue: number;
|
||||
}
|
||||
// export interface ResStatus {
|
||||
// roleLabel: string;
|
||||
// roleValue: number;
|
||||
// }
|
||||
|
||||
// export interface ResGender {
|
||||
// genderLabel: string;
|
||||
@@ -38,11 +68,11 @@ export namespace Role {
|
||||
// }
|
||||
|
||||
//角色权限列表
|
||||
export interface ResPermissionList {
|
||||
key: string;
|
||||
label: string;
|
||||
disable?: Permission[];
|
||||
}
|
||||
// export interface ResPermissionList {
|
||||
// key: string;
|
||||
// label: string;
|
||||
// disable?: Permission[];
|
||||
// }
|
||||
|
||||
// export interface ResRole {
|
||||
// id: string;
|
||||
|
||||
@@ -8,40 +8,60 @@ import http from '@/api'
|
||||
*/
|
||||
// 获取角色列表
|
||||
export const getRoleList = (params: Role.ReqRoleParams) => {
|
||||
return http.post<ResPage<Role.ResRoleList>>(`/RoleList_Post`, params)
|
||||
// return http.post<ResPage<Role.ResRoleList>>(`${rePrefix}/role/list`, params)
|
||||
return http.post<ResPage<Role.RoleBO>>(`/role/list`, params)
|
||||
|
||||
// return http.post<ResPage<Role.ResRoleList>>(`/RoleList_Post`, params)
|
||||
// return http.post<ResPage<Role.ResRoleList>>(`${rePrefix}/role/list`, params)
|
||||
}
|
||||
|
||||
// 新增角色
|
||||
export const addRole = (params: Role.RoleBO) => {
|
||||
return http.post(`/role/add`, params)
|
||||
}
|
||||
|
||||
// 编辑角色
|
||||
export const editRole = (params: Role.RoleBO) => {
|
||||
return http.post(`/role/edit`, params)
|
||||
}
|
||||
|
||||
// 删除角色
|
||||
export const deleteRole = (params: { id: string[] }) => {
|
||||
return http.post(`/role/del`, params)
|
||||
}
|
||||
|
||||
|
||||
// 编辑角色资源
|
||||
export const editRoleAndPermission = (params: Role.ReqRoleAndPermission) => {
|
||||
return http.post(`/role/edit_RoleAndPermission`, params)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// // 获取树形用户列表
|
||||
// export const getRoleTreeList = (params: Role.ReqRoleParams) => {
|
||||
// return http.post<ResPage<Role.ResRoleList>>(`${rePrefix}/role/tree/list`, params)
|
||||
// }
|
||||
|
||||
// 新增角色
|
||||
export const addRole = (params: { id: string }) => {
|
||||
return http.post(`/RoleList_Add`, params)
|
||||
}
|
||||
// export const addRole = (params: { id: string ; rolename: string;status: number; describe:string; }) => {
|
||||
// return http.post(`/RoleList_Add`, params)
|
||||
// }
|
||||
|
||||
// 批量添加角色
|
||||
export const BatchAddRole = (params: FormData) => {
|
||||
return http.post(`${rePrefix}/role/import`, params)
|
||||
}
|
||||
// export const BatchAddRole = (params: FormData) => {
|
||||
// return http.post(`${rePrefix}/role/import`, params)
|
||||
// }
|
||||
|
||||
// 编辑角色
|
||||
export const editRole = (params: { id: string }) => {
|
||||
return http.post(`${rePrefix}/role/edit`, params)
|
||||
}
|
||||
|
||||
// 删除角色
|
||||
export const deleteRole = (params: { id: string[] }) => {
|
||||
return http.post(`/RoleList_Del`, params)
|
||||
}
|
||||
|
||||
// 切换角色状态
|
||||
export const changeRoleStatus = (params: { id: string; status: number }) => {
|
||||
return http.post(`${rePrefix}/role/change`, params)
|
||||
}
|
||||
// // 切换角色状态
|
||||
// export const changeRoleStatus = (params: { id: string; status: number }) => {
|
||||
// return http.post(`${rePrefix}/role/change`, params)
|
||||
// }
|
||||
|
||||
// 重置用户密码
|
||||
// export const resetUserPassWord = (params: { id: string }) => {
|
||||
@@ -49,14 +69,14 @@ export const changeRoleStatus = (params: { id: string; status: number }) => {
|
||||
// }
|
||||
|
||||
// 导出角色数据
|
||||
export const exportRoleInfo = (params: Role.ReqRoleParams) => {
|
||||
return http.download(`${rePrefix}/role/export`, params)
|
||||
}
|
||||
// export const exportRoleInfo = (params: Role.ReqRoleParams) => {
|
||||
// return http.download(`${rePrefix}/role/export`, params)
|
||||
// }
|
||||
|
||||
// 获取角色状态字典
|
||||
export const getRoleStatus = () => {
|
||||
return http.get<Role.ResStatus[]>(`${rePrefix}/role/status`)
|
||||
}
|
||||
// export const getRoleStatus = () => {
|
||||
// return http.get<Role.ResStatus[]>(`${rePrefix}/role/status`)
|
||||
// }
|
||||
|
||||
// 获取用户性别字典
|
||||
// export const getUserGender = () => {
|
||||
@@ -64,9 +84,9 @@ export const getRoleStatus = () => {
|
||||
// }
|
||||
|
||||
// 获取角色权限列表
|
||||
export const getRoleDepartment = () => {
|
||||
return http.get<Role.ResPermissionList[]>(`${rePrefix}/role/permission`)
|
||||
}
|
||||
// export const getRoleDepartment = () => {
|
||||
// return http.get<Role.ResPermissionList[]>(`${rePrefix}/role/permission`)
|
||||
// }
|
||||
|
||||
// 获取用户角色字典
|
||||
// export const getUserRole = () => {
|
||||
|
||||
@@ -65,6 +65,28 @@ const dictData: Dict[] = [
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "4",
|
||||
code: 'roleType',
|
||||
label: '角色类型',
|
||||
children: [
|
||||
{
|
||||
id: "0",
|
||||
label: '超级管理员',
|
||||
code: 0,
|
||||
},
|
||||
{
|
||||
id: "1",
|
||||
label: '管理员',
|
||||
code: 1,
|
||||
},
|
||||
{
|
||||
id: "2",
|
||||
label: '普通角色',
|
||||
code: 2,
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
|
||||
export default dictData
|
||||
Reference in New Issue
Block a user