import { AppAuthNodes, CurrentProjectAuthTree, MenuTreeModel, PersonApiParams, PersonModel, DeviceAlarmModel, AddUser, } from '../model/authConfig.model'; import { ApiClientFactory } from '../core/api.client.factory'; export class AuthConfigService { constructor(private factory: ApiClientFactory) {} // 当前租户组织机构列表 async loadCurrentProjectAuthTree(projectId: string, orgId: string): Promise { const url = `/api/web/projects/${projectId}/menu/navigateTree?productCode=gss&orgId=${orgId}`; const result = await this.factory.entity.get(url); return result; } // 选中组织人员列表 async loadPersonFromTreeNode(projectId: string, params: PersonApiParams): Promise { const url = `/api/web/projects/${projectId}/menu/users`; const result = await this.factory.entity.get(url, params); return result; } // 菜单树 async loadMenuTree(projectId: string, templateId: string): Promise { const url = `/admin/menu/list?projectId=${projectId}&templateId=${templateId}`; const result = await this.factory.entityMenu.get(url); return result; } // 批量添加菜单 async putMenuAuth(projectId: string, menuIds: string[], userIds: string[], templateId: string): Promise { const url = `/admin/menu/userMenu/batch`; const result = await this.factory.entityMenu.put(url, { projectId, menuIds, userIds, templateId }); return result; } // 获取某个人设置好的权限(增加了模板过滤) async getSomebodyMenuAuth(projectId: string, userId: string, templateId: string): Promise { const url = `/admin/menu/userAuthMenus`; const result = await this.factory.entityMenu.get(url, { projectId, userId, templateId }); return result; } // 获取App所有菜单 async loadAppAuthNodes(): Promise { const url = '/admin/menu/app/init'; const result = await this.factory.entityMenu.get(url); return result; } // 获取App某个人设置好的权限 async loadAppPersonAuthNodes(projectId: string, userId: string): Promise { const url = '/admin/menu/app/userAuthMenus'; const result = await this.factory.entityMenu.get(url, { projectId, userId }); return result; } // 批量添加App菜单 async postAppMenuAuth(projectId: string, menuIds: string[], userIds: string[]): Promise { const url = `/admin/menu/app/batch`; const result = await this.factory.entityMenu.post(url, { projectId, menuIds, userIds }); return result; } // 权限管理设备告警权限 async loadListDeviceInfo(projectId: string): Promise { const url = `/api/web/projects/${projectId}/allDevice/listDeviceInfo`; const result = await this.factory.entity.get(url); return result; } // 权限管理设备告警权限 async loadDeviceByUserId(projectId: string, userId: string): Promise { const url = `/api/web/projects/${projectId}/allDevice/getByUserId`; const result = await this.factory.entity.get(url, { userId }); return result; } // 权限管理设备告警权限 async loadAddUserDevice(projectId: string, params: AddUser[]): Promise { const url = `/api/web/projects/${projectId}/allDevice/addUserDevice`; const result = await this.factory.entity.post(url, params); return result; } }