角色管理

This commit is contained in:
sjl
2024-11-14 11:34:25 +08:00
parent 44e7598b68
commit 39cbe0ff35
19 changed files with 873 additions and 359 deletions

View File

@@ -31,7 +31,7 @@ export namespace Device {
protocol:string; //通讯协议
ip: string; //IP地址
port: number; //端口号
encryption: number; //装置是否为加密版本
encryptionFlag: number; //装置是否为加密版本
series?: string| null; //装置识别码3ds加密
devKey?: string| null; //装置秘钥3ds加密
sampleID?: string| null; //样品编号

View File

@@ -8,6 +8,7 @@ export const functionList : Function.ResFunction[] = [
'name': '检测计划',
'code':'route',
'path':'/plan/planList/index',
'component':'planList',
'icon':'',
'sort':100,
'type':0,
@@ -21,6 +22,7 @@ export const functionList : Function.ResFunction[] = [
name: '台账管理',
code:'route',
path:'/machine',
'component':'planList',
icon:'',
sort:100,
type:0,
@@ -33,6 +35,7 @@ export const functionList : Function.ResFunction[] = [
name: '检测脚本',
code:'route',
path:'/machine/testScript/index',
'component':'planList',
icon:'',
sort:100,
type:1,
@@ -46,6 +49,7 @@ export const functionList : Function.ResFunction[] = [
name: '被检设备',
code:'route',
path:'/plan/planList/index',
'component':'planList',
icon:'',
sort:100,
type:1,
@@ -59,6 +63,7 @@ export const functionList : Function.ResFunction[] = [
name: '误差体系',
code:'route',
path:'/plan/planList/index',
'component':'planList',
icon:'',
sort:100,
type:1,
@@ -72,6 +77,7 @@ export const functionList : Function.ResFunction[] = [
name: '检测源',
code:'route',
path:'/plan/planList/index',
'component':'planList',
icon:'',
sort:100,
type:1,
@@ -86,6 +92,7 @@ export const functionList : Function.ResFunction[] = [
name: '权限管理',
code:'route',
path:'/plan/planList/index',
'component':'planList',
icon:'',
sort:100,
type:0,
@@ -98,6 +105,7 @@ export const functionList : Function.ResFunction[] = [
name: '用户管理',
code:'route',
path:'/plan/planList/index',
'component':'planList',
icon:'',
sort:100,
type:0,
@@ -111,6 +119,7 @@ export const functionList : Function.ResFunction[] = [
name: '角色管理',
code:'route',
path:'/plan/planList/index',
'component':'planList',
icon:'',
sort:100,
type:0,
@@ -124,6 +133,7 @@ export const functionList : Function.ResFunction[] = [
name: '菜单管理',
code:'route',
path:'/plan/planList/index',
'component':'planList',
icon:'',
sort:100,
type:0,
@@ -138,6 +148,7 @@ export const functionList : Function.ResFunction[] = [
name: '系统配置',
code:'route',
path:'/plan/planList/index',
'component':'planList',
icon:'',
sort:100,
type:0,
@@ -150,6 +161,7 @@ export const functionList : Function.ResFunction[] = [
name: '通用配置',
code:'route',
path:'/plan/planList/index',
'component':'planList',
icon:'',
sort:100,
type:0,
@@ -163,6 +175,7 @@ export const functionList : Function.ResFunction[] = [
name: '数据字典',
code:'route',
path:'/plan/planList/index',
'component':'planList',
icon:'',
sort:100,
type:0,
@@ -176,6 +189,7 @@ export const functionList : Function.ResFunction[] = [
name: '报告模版',
code:'route',
path:'/plan/planList/index',
'component':'planList',
icon:'',
sort:100,
type:0,
@@ -189,6 +203,7 @@ export const functionList : Function.ResFunction[] = [
name: '版本注册',
code:'route',
path:'/plan/planList/index',
'component':'planList',
icon:'',
sort:100,
type:0,
@@ -203,6 +218,7 @@ export const functionList : Function.ResFunction[] = [
name: '日志管理',
code:'route',
path:'/plan/planList/index',
'component':'planList',
icon:'',
sort:100,
type:0,
@@ -216,6 +232,7 @@ export const functionList : Function.ResFunction[] = [
name: '统计分析',
code:'route',
path:'/plan/planList/index',
'component':'planList',
icon:'',
sort:100,
type:0,
@@ -229,6 +246,7 @@ export const functionList : Function.ResFunction[] = [
name: '示例',
code:'route',
path:'/plan/planList/index',
'component':'planList',
icon:'',
sort:100,
type:0,
@@ -241,6 +259,7 @@ export const functionList : Function.ResFunction[] = [
name: '普通表格',
code:'route',
path:'/plan/planList/index',
'component':'planList',
icon:'',
sort:100,
type:0,
@@ -254,6 +273,7 @@ export const functionList : Function.ResFunction[] = [
name: '表格树',
code:'route',
path:'/plan/planList/index',
'component':'planList',
icon:'',
sort:100,
type:0,

View File

@@ -2,24 +2,25 @@ import http from "@/api";
import { ADMIN as rePrefix } from "@/api/config/serviceName";
import type { Function } from "@/api/function/interface";
//获取菜单列表
export const getFunctionList = (params: Function.ReqFunctionParams) => {
return http.post(`${rePrefix}/function/list`, params);
return http.post(`/function/list`, params);
};
//添加菜单列表
export const addFunction = (params: Function.ReqFunctionParams) => {
return http.post(`${rePrefix}/function/add`,params);
export const addFunction = (params: Function.ResFunction) => {
return http.post(`/function/add`,params);
};
//删除菜单列表
export const deleteFunction = (params: { id: string[] }) => {
return http.post(`${rePrefix}/function/delete`, { data: params });
return http.post(`/function/delete`, { data: params });
};
//编辑菜单列表
export const updateFunction = (params: Function.ReqFunctionParams) => {
return http.post(`${rePrefix}/function/update`, params);
export const updateFunction = (params: Function.ResFunction) => {
return http.put(`/function/update`, params);
};

View File

@@ -21,10 +21,11 @@ export namespace Function {
pids?:string | null;//节点上层所有节点
name: string;//名称
code:string;//资源标识
path:string;//路径
icon?:string | null;//图标
path:string;//路由路
component:string ;//组件地址
icon?:string;//图标
sort:number;//排序
type:number | null;//资源类型0-菜单、1-按钮、2-公共资源、3-服务间调用资源
type:number;//资源类型0-菜单、1-按钮、2-公共资源、3-服务间调用资源
remark?: string | null;//权限资源描述
state:number;//权限资源状态
create_By?:string | null;//创建人

View File

@@ -21,6 +21,7 @@ const config = {
withCredentials: true,
// post请求指定数据类型以及编码
headers: { 'Content-Type': 'application/json;charset=utf-8' }
//headers : {'Content-Type': 'multipart/form-data'}
};
class RequestHttp {
@@ -107,6 +108,16 @@ class RequestHttp {
download(url: string, params?: object, _object = {}): Promise<BlobPart> {
return this.service.post(url, params, { ..._object, responseType: "blob" });
}
/**
* @description 批量导入专用请求方法
*/
batchImport<T>(url: string, formData: FormData, _object = {}): Promise<ResultData<T>> {
return this.service.post(url, formData, {
..._object,
headers: { 'Content-Type': 'multipart/form-data' }
});
}
}
export default new RequestHttp(config);

View File

@@ -1,15 +1,17 @@
import type { ReqPage } from '@/api/interface'
import type { ReqPage, ResPage } from '@/api/interface'
// 角色管理模块
export namespace Role {
//资源接口
export interface Permission{
id: string; //资源ID
name: string; //资源名称
code: string; //资源代码
}
/**
* 用户数据表格分页查询参数
*/
export interface ReqRoleParams extends ReqPage{
id: string; // 装置序号用户ID 必填
name?: string; //用户名(别名)
code?: string; //角色代码
}
//角色接口
export interface RoleBO {
id: string; //角色类型ID
@@ -24,15 +26,19 @@ export namespace Role {
updateTime?: string; // 更新时间
}
//角色+资源
export interface ReqRoleAndPermission extends RoleBO{
permissionList?:Permission[]; //角色权限列表
}
//角色接口
export interface RoleFunctionId {
id: string[]; //菜单id
}
/**
* 用户表格查询分页返回的对象;
*/
export interface ResRolePage extends ResPage<RoleBO> {
}
// 角色+分页
export interface ReqRoleParams extends ReqPage,RoleBO {
}

View File

@@ -1,5 +1,6 @@
import type { ResPage } from '@/api/interface'
import type { Role } from './interface'
import type { Function } from './../function/interface/index';
import { ADMIN as rePrefix } from '@/api/config/serviceName'
import http from '@/api'
@@ -8,7 +9,7 @@ import http from '@/api'
*/
// 获取角色列表
export const getRoleList = (params: Role.ReqRoleParams) => {
return http.get(`/sysRole/list`, params)
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)
@@ -21,17 +22,27 @@ export const addRole = (params: Role.RoleBO) => {
// 编辑角色
export const editRole = (params: Role.RoleBO) => {
return http.put(`/sysRole/edit`, params)
return http.put(`/sysRole/update`, params)
}
// 删除角色
export const deleteRole = (params: { id: string[] }) => {
return http.post(`/sysRole/del`, params)
return http.post(`/sysRole/delete`, params)
}
// 编辑角色资源
export const editRoleAndPermission = (params: Role.ReqRoleAndPermission) => {
return http.post(`/role/edit_RoleAndPermission`, 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.put(`/sysFunction/assignFunctionByRoleId`,{ roleId: params.id,functionIds:param.id })
}