This commit is contained in:
sjl
2024-11-18 09:02:57 +08:00
parent a8eaccc53e
commit 5cdbee88b4
54 changed files with 375 additions and 836 deletions

View File

@@ -0,0 +1,34 @@
import http from "@/api";
import type { Function } from "@/api/user/interface/function";
// 获取资源
export const getFunctionList = () => {
return http.get<Function.ResFunction>(`/sysFunction/functionTree`)
}
// 获取资源不包括按钮
export const getFunctionListNoButton = () => {
return http.get<Function.ResFunction>(`/sysFunction/functionTreeNoButton`)
}
//添加菜单列表
export const addFunction = (params: Function.ResFunction) => {
return http.post(`/sysFunction/add`,params);
};
//删除菜单列表
export const deleteFunction = (params: Function.ResFunction) => {
return http.post(`/sysFunction/delete?id=${params.id}`);
};
//编辑菜单列表
export const updateFunction = (params: Function.ResFunction) => {
return http.post(`/sysFunction/update`, params);
};

View File

@@ -0,0 +1,45 @@
import type { ReqPage, ResPage } from '@/api/interface'
// 菜单管理模块
export namespace Function {
/**
* 菜单管理表格分页查询参数
*/
export interface ReqFunctionParams extends ReqPage{
name?: string; // 名称
code?: string; // 编码
}
/**
* 菜单管理新增、修改、根据id查询返回的对象
*/
export interface ResFunction {
id: string;//资源表Id
pid:string;//节点0为根节点
pids?:string | null;//节点上层所有节点
name: string;//名称
code:string;//资源标识
path:string;//路由路径
component:string ;//组件地址
icon?:string;//图标
sort:number;//排序
type:number;//资源类型0-菜单、1-按钮、2-公共资源、3-服务间调用资源
remark?: string | null;//权限资源描述
state:number;//权限资源状态
create_By?:string | null;//创建人
create_Time?:string | null;//创建时间
update_By?:string | null;//更新人
update_Time?:string | null;//更新时间
children?: ResFunction[] | null;
}
/**
* 菜单管理表格查询分页返回的对象;
*/
export interface ResFunctionPage extends ResPage<ResFunction> {
}
}

View File

@@ -0,0 +1,93 @@
import type { ReqPage, ResPage } from '@/api/interface'
// 角色管理模块
export namespace Role {
/**
* 用户数据表格分页查询参数
*/
export interface ReqRoleParams extends ReqPage{
id: string; // 装置序号用户ID 必填
name?: string; //用户名(别名)
code?: string; //角色代码
}
//角色接口
export interface RoleBO {
id: string; //角色类型ID
name: string; //角色类型名称
code: string; //角色代码
type: number; //角色类型
remark?:string; //角色描述
state:number;
createBy?:string; //
createTime?: string; // 创建时间
updateBy?: string; //
updateTime?: string; // 更新时间
}
//角色接口
export interface RoleFunctionId {
id: string[]; //菜单id
}
/**
* 用户表格查询分页返回的对象;
*/
export interface ResRolePage extends ResPage<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 ReqRoleParams extends ReqPage {
// id: string; //角色类型ID
// rolename: string; //角色类型名称
// status: number; //角色类型状态
// describe:string; //角色描述
// permissionList?:Permission[]; //角色权限列表
// }
// 角色字典
// export interface ResStatus {
// roleLabel: string;
// roleValue: number;
// }
// export interface ResGender {
// genderLabel: string;
// genderValue: number;
// }
//角色权限列表
// export interface ResPermissionList {
// key: string;
// label: string;
// disable?: Permission[];
// }
// export interface ResRole {
// id: string;
// name: string;
// children?: ResDepartment[];
// }
}

View File

@@ -1,7 +1,7 @@
import type { Login } from './interface'
import { ADMIN as rePrefix } from '@/api/config/serviceName'
import type { Login } from '@/api/user/interface/user'
import { ADMIN as rePrefix } from '@/api/system/config/serviceName'
import http from '@/api'
import type { Dict } from '../interface'
import type { Dict } from '@/api/interface'
/**
* @name
*/

View File

@@ -0,0 +1,46 @@
import type { Role } from '@/api/user/interface/role'
import type { Function } from '@/api/user/interface/function'
import http from '@/api'
/**
* @name 角色管理模块
*/
// 获取角色列表
export const getRoleList = (params: Role.ReqRoleParams) => {
return http.post(`/sysRole/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(`/sysRole/add`, params)
}
// 编辑角色
export const editRole = (params: Role.RoleBO) => {
return http.post(`/sysRole/update`, params)
}
// 删除角色
export const deleteRole = (params: { id: string[] }) => {
return http.post(`/sysRole/delete`, params)
}
// 获取资源
export const getFunctionList = () => {
return http.get<Function.ResFunction>(`/sysFunction/functionTree`)
}
//获取角色id绑定的菜单
export const getRoleFunction = (params:Role.RoleBO) => {
return http.post(`/sysRole/getFunctionsByRoleId?id=${params.id}`)
}
//角色分配菜单
export const assignFunction = (params:Role.RoleBO,param:Role.RoleFunctionId) => {
return http.post(`/sysFunction/assignFunctionByRoleId`,{ roleId: params.id,functionIds:param.id })
}

View File

@@ -1,7 +1,5 @@
import type { Role } from './../role/interface/index';
import type { ResPage } from '@/api/interface'
import type { User} from './interface'
import { ADMIN as rePrefix } from '@/api/config/serviceName'
import type { Role } from '@/api/user/interface/role'
import type { User } from '@/api/user/interface/user'
import http from '@/api'
/**

View File

@@ -1,133 +0,0 @@
const data = [
{
'id': '623689732233728549',
'username': 'admin_A',
'password': '12345678',
'realname': '薛霞',
'status': 0,
'rolename': '管理员',
},
{
'id': '621003764863621316',
'username': 'admin_B',
'password': '12345678',
'realname': '冯敏',
'status': 1,
'rolename': '管理员',
},
// {
// 'id': '652286556713195552',
// 'username': 'operator_A',
// 'password': '12345678',
// 'realname': '潘霞',
// 'status': 1,
// 'rolename': '操作员',
// },
// {
// 'id': '373930342176416776',
// 'username': 'operator_B',
// 'password': '12345678',
// 'realname': '郝秀英',
// 'status': 0,
// 'rolename': '操作员',
// },
// {
// 'id': '429621442453555775',
// 'username': 'operator_C',
// 'password': '12345678',
// 'realname': '吕洋',
// 'status': 1,
// 'rolename': '操作员',
// },
// {
// 'id': '387231964476618937',
// 'username': 'operator_D',
// 'password': '12345678',
// 'realname': '江磊',
// 'status': 0,
// 'rolename': '操作员',
// },
// {
// 'id': '604013348875476647',
// 'username': 'operator_E',
// 'password': '12345678',
// 'realname': '姚静',
// 'status': 0,
// 'rolename': '操作员',
// },
// {
// 'id': '028222596330483467',
// 'username': 'operator_F',
// 'password': '12345678',
// 'realname': '龙艳',
// 'status': 1,
// 'rolename': '操作员',
// },
// {
// 'id': '739427478368274267',
// 'username': 'operator_G',
// 'password': '12345678',
// 'realname': '武涛',
// 'status': 1,
// 'rolename': '操作员',
// },
// {
// 'id': '448686878612127243',
// 'username': 'operator_H',
// 'password': '12345678',
// 'realname': '孙芳',
// 'status': 0,
// 'rolename': '操作员',
// },
// {
// 'id': '448686878612127244',
// 'username': 'operator_I',
// 'password': '12345678',
// 'realname': '孙芳1',
// 'status': 0,
// 'rolename': '操作员',
// },
// {
// 'id': '448686878612127245',
// 'username': 'operator_J',
// 'password': '12345678',
// 'realname': '孙芳2',
// 'status': 1,
// 'rolename': '操作员',
// },
// {
// 'id': '448686878612127245',
// 'username': 'operator_J',
// 'password': '12345678',
// 'realname': '孙芳2',
// 'status': 1,
// 'rolename': '操作员',
// },
// {
// 'id': '448686878612127245',
// 'username': 'operator_J',
// 'password': '12345678',
// 'realname': '孙芳2',
// 'status': 1,
// 'rolename': '操作员',
// },
// {
// 'id': '448686878612127245',
// 'username': 'operator_J',
// 'password': '12345678',
// 'realname': '孙芳2',
// 'status': 1,
// 'rolename': '操作员',
// },
// {
// 'id': '448686878612127245',
// 'username': 'operator_J',
// 'password': '12345678',
// 'realname': '孙芳2',
// 'status': 1,
// 'rolename': '操作员',
// }
]
export default data