import { ApiClientFactory } from '../core/api.client.factory'; import { SortCreateModel, SortCreateSecondModel, ScreenMenuModel, MenuTemplate, ScreenConfigInfo, ConfigMenuInfo, FirstLevleMenu, SecondaryMenu, ICopyTemplateByFromProjectIdParams, ITemplateSearchParams } from '../model/createMent.model'; export class CreateMenuClient { constructor(private factory: ApiClientFactory) {} // 跨项目模板复制 async copyTemplateByFromProjectId(projectId: string, params: ICopyTemplateByFromProjectIdParams): Promise { const url = `/template/${projectId}/copyTemplate/fromAnotherProject`; const result = await this.factory.entityMenu.post(url, params || {}) return result; } // 通过检索搜索模板列表 async loadTemplateBySearch(projectId: string, params?: ITemplateSearchParams): Promise { const url = `/template/${projectId}`; const result = await this.factory.entityMenu.get(url, params || {}) return result; } // 一级菜单排序 async loadCreateSort(data: SortCreateModel): Promise { const url = `/admin/menu/first/sort`; const createSote = await this.factory.entityMenu.post(url, data); return createSote; } // 二菜单排序 async loadCreateSortSecond(data: SortCreateSecondModel): Promise { const url = `/admin/menu/second/sort`; const createSote = await this.factory.entityMenu.post(url, data); return createSote; } async loadGetFirstLevleMenuList(projectId: string) { const url = `/admin/menu/first/list`; const FirstLevleMenuList = await this.factory.entityMenu.get(url, { projectId }); return FirstLevleMenuList; } async loadSecondaryMenuList(projectId: string, firstClassMenuId: string) { const url = `/admin/menu/second/list`; const SecondaryMenuList = await this.factory.entityMenu.get(url, { projectId, firstClassMenuId, }); return SecondaryMenuList; } // 新增编辑大屏菜单 async loadAddScreenMenu(projectId: string, requestBody: any): Promise { const url = `/api/web/projects/${projectId}/largeScreen/menu`; const addScreenMenuResult = await this.factory.entity.post(url, requestBody); return addScreenMenuResult; } // 获取大屏菜单 async loadGetScreenMenu(projectId: string): Promise { const url = `/api/web/projects/${projectId}/largeScreen/menus`; const ScreenMenuResult = await this.factory.entity.get(url); return ScreenMenuResult; } // 删除大屏菜单 async loadDeleteScreenMenu(projectId: string, id: string): Promise { const url = `/api/web/projects/${projectId}/largeScreen/menu/${id}`; const DeleteScreenMenuResult = await this.factory.entity.delete(url); return DeleteScreenMenuResult; } // 获取大屏基本配置 async loadGetScreenBasicConfig(projectId: string): Promise { const url = `/api/web/projects/${projectId}/largeScreenConfig`; const result = await this.factory.entity.get(url); return result; } // 配置大屏基本配置 async loadSetScreenBasicConfig(projectId: string, params: ScreenConfigInfo): Promise { const url = `/api/web/projects/${projectId}/largeScreenConfig/saveOrUpdate`; const result = await this.factory.entity.post(url, { ...params, }); return result; } // 上传中央视频配置 async upLoadVideo(projectId: string, params: any): Promise { const url = `/api/web/projects/${projectId}/subgroupConfig/centreVideo/save`; const result = await this.factory.entity.post(url, { ...params, }); return result; } // 获取中央视频配置 async getVideoConfig(projectId: string, params: ScreenConfigInfo): Promise { const url = `/api/web/projects/${projectId}/subgroupConfig/centreVideo/info`; const result = await this.factory.entity.get(url, { ...params, }); return result; } // 获取菜单模板 async loadMenuTemplateList(projectId: string, userId: number): Promise { const url = `/template/${projectId}?userId=${userId}`; const result = await this.factory.entityMenu.get(url); return result; } // 创建修改菜单模板 async setMenuTemplate(projectId: string, params: MenuTemplate): Promise { const url = `/template/${projectId}`; const result = await this.factory.entityMenu.post(url, params); return result; } // 删除菜单模板 async deleteMenuTemplate(projectId: string, id: string): Promise { const url = `/template/${projectId}?id=${id}`; const result = await this.factory.entityMenu.delete(url); return result; } // 复制菜单模板 async copyMenuTemplate(projectId: string, params: MenuTemplate): Promise { const url = `/template/${projectId}/copyTemplate`; const result = await this.factory.entityMenu.post(url, params); return result; } // 根据菜单模板id 查询 async getMenuByTemlateId(projectId: string, id: string): Promise { const url = `/template/${projectId}/id?id=${id}`; const result = await this.factory.entityMenu.get(url); return result; } // --- 项目中之前的接口 // 获取可配置菜单列表 async loadCanConfigMenu(projectId: string, params: ConfigMenuInfo): Promise { const url = `/api/web/projects/${projectId}/authMenu`; const result = await this.factory.entity.get(url, params); return result; } // 获取一级菜单 async loadCreateFirstLevleMenu(projectId: string, params: FirstLevleMenu): Promise { const url = '/admin/menu/first'; const newParams = { projectId, ...params, }; const result = await this.factory.entityMenu.put(url, newParams); return result; } // 更新一级菜单 async loadUpdateCreateFirstLevleMenu(projectId: string, params: FirstLevleMenu): Promise { const url = '/admin/menu/first'; const newParams = { projectId, ...params, }; const result = await this.factory.entityMenu.post(url, newParams); return result; } // 删除一级菜单 async loadDeleteFirstMenu(projectId: string, id: string, templateId: string): Promise { const url = '/admin/menu/first'; const newParams = { projectId, id, templateId, }; const result = await this.factory.entityMenu.delete(url, newParams); return result; } // 获取一级菜单 async loadGetCreateFirstLevleMenu(projectId: string, id: string): Promise { const url = '/admin/menu/first'; const newParams = { projectId, id, }; const result = await this.factory.entityMenu.get(url, newParams); return result; } // 获取一级菜单列表 async loadGetCreateFirstLevleMenuList(projectId: string): Promise { const url = '/admin/menu/first/list'; const newParams = { projectId, }; const result = await this.factory.entityMenu.get(url, newParams); return result; } // 获取二级菜单列表 async loadGetCreateSecondaryMenuList(projectId: string, firstClassMenuId: string, templateId: string) { const url = '/admin/menu/second/list'; const newParams = { projectId, firstClassMenuId, templateId, }; const result = await this.factory.entityMenu.get(url, newParams); return result; } // 创建二级菜单 async loadCreateSecondaryMenu(projectId: string, params: SecondaryMenu) { const url = '/admin/menu/second'; const newParams = { projectId, ...params, }; const result = await this.factory.entityMenu.put(url, newParams); return result; } // 更新二级菜单 async loadUpdateCreateSecondaryMenu(projectId: string, params: SecondaryMenu) { const url = '/admin/menu/second'; const newParams = { projectId, ...params, }; const result = await this.factory.entityMenu.post(url, newParams); return result; } // 删除二级菜单 async loadDeleteSecondaryMenu(projectId: string, id: string, templateId: string) { const url = '/admin/menu/second'; const newParams = { projectId, id, templateId, }; const result = await this.factory.entityMenu.delete(url, newParams); return result; } // 获取二级菜单 async loadGetSecondaryMenu(projectId: string, id: string) { const url = '/admin/menu/second'; const newParams = { projectId, id, }; const result = await this.factory.entityMenu.get(url, newParams); return result; } }