web-apis\types

This commit is contained in:
2025-10-16 10:31:32 +08:00
parent aace132108
commit 6858899c4c
21 changed files with 2198 additions and 192 deletions

View File

@@ -5,7 +5,7 @@
*/
import { api } from '@/apis/index';
import type { SysDept, SysRole, DeptRoleVO, SysDeptRole } from '@/types';
import type { SysDept, SysRole, DeptRoleVO, SysDeptRole, ResultDomain } from '@/types';
/**
* 部门API服务
@@ -13,120 +13,120 @@ import type { SysDept, SysRole, DeptRoleVO, SysDeptRole } from '@/types';
export const deptApi = {
/**
* @description 查询所有部门
* @returns Promise<SysDept[]> 部门列表
* @returns Promise<ResultDomain<SysDept>> 部门列表
* @author yslg
* @ since 2025-10-06
*/
async getAllDepts(): Promise<SysDept[]> {
async getAllDepts(): Promise<ResultDomain<SysDept>> {
const response = await api.post<SysDept>('/depts/all');
return response.data.dataList!;
return response.data;
},
/**
* @description 查询部门列表
* @param filter 过滤条件
* @returns Promise<SysDept[]> 部门列表
* @returns Promise<ResultDomain<SysDept>> 部门列表
* @author yslg
* @ since 2025-10-06
*/
async getDeptList(filter: SysDept): Promise<SysDept[]> {
async getDeptList(filter: SysDept): Promise<ResultDomain<SysDept>> {
const response = await api.post<SysDept>('/depts/list', filter);
return response.data.dataList!;
return response.data;
},
/**
* @description 查询部门
* @param dept 部门信息
* @returns Promise<SysDept> 部门信息
* @returns Promise<ResultDomain<SysDept>> 部门信息
* @author yslg
* @ since 2025-10-06
*/
async getDeptById(dept: SysDept): Promise<SysDept> {
async getDeptById(dept: SysDept): Promise<ResultDomain<SysDept>> {
const response = await api.post<SysDept>('/depts/id', dept);
return response.data.data!;
return response.data;
},
/**
* @description 创建部门
* @param dept 部门信息
* @returns Promise<SysDept> 部门信息
* @returns Promise<ResultDomain<SysDept>> 部门信息
* @author yslg
* @ since 2025-10-06
*/
async createDept(dept: SysDept): Promise<SysDept> {
async createDept(dept: SysDept): Promise<ResultDomain<SysDept>> {
const response = await api.post<SysDept>('/depts/dept', dept);
return response.data.data!;
return response.data;
},
/**
* @description 更新部门
* @param dept 部门信息
* @returns Promise<SysDept> 部门信息
* @returns Promise<ResultDomain<SysDept>> 部门信息
* @author yslg
* @ since 2025-10-06
*/
async updateDept(dept: SysDept): Promise<SysDept> {
async updateDept(dept: SysDept): Promise<ResultDomain<SysDept>> {
const response = await api.put<SysDept>('/depts/dept', dept);
return response.data.data!;
return response.data;
},
/**
* @description 删除部门
* @param dept 部门信息
* @returns Promise<SysDept> 部门信息
* @returns Promise<ResultDomain<SysDept>> 部门信息
* @author yslg
* @ since 2025-10-06
*/
async deleteDept(dept: SysDept): Promise<SysDept> {
async deleteDept(dept: SysDept): Promise<ResultDomain<SysDept>> {
const response = await api.delete<SysDept>('/depts/dept', dept);
return response.data.data!;
return response.data;
},
/**
* @description 查询部门绑定角色
* @param dept 部门信息
* @returns Promise<SysRole[]> 角色列表
* @returns Promise<ResultDomain<SysRole>> 角色列表
* @author yslg
* @ since 2025-10-06
*/
async getDeptByRole(dept: SysDept): Promise<SysRole[]> {
async getDeptByRole(dept: SysDept): Promise<ResultDomain<SysRole>> {
const response = await api.post<SysRole>('/depts/role', dept);
return response.data.dataList!;
return response.data;
},
/**
* @description 查询部门角色列表
* @param dept 部门角色信息
* @returns Promise<SysDeptRole[]> 部门角色列表
* @returns Promise<ResultDomain<SysDeptRole>> 部门角色列表
* @author yslg
* @ since 2025-10-06
*/
async getDeptRoleList(dept: SysDeptRole): Promise<SysDeptRole[]> {
async getDeptRoleList(dept: SysDeptRole): Promise<ResultDomain<SysDeptRole>> {
const response = await api.post<SysDeptRole>('/depts/role/list', dept);
return response.data.dataList!;
return response.data;
},
/**
* @description 绑定部门角色
* @param deptRole 部门角色VO
* @returns Promise<SysDeptRole> 部门角色信息
* @returns Promise<ResultDomain<SysDeptRole>> 部门角色信息
* @author yslg
* @ since 2025-10-06
*/
async bindDeptRole(deptRole: DeptRoleVO): Promise<SysDeptRole> {
async bindDeptRole(deptRole: DeptRoleVO): Promise<ResultDomain<SysDeptRole>> {
const response = await api.post<SysDeptRole>('/depts/bind/role', deptRole);
return response.data.data!;
return response.data;
},
/**
* @description 解绑部门角色
* @param deptRole 部门角色VO
* @returns Promise<SysDeptRole> 部门角色信息
* @returns Promise<ResultDomain<SysDeptRole>> 部门角色信息
* @author yslg
* @ since 2025-10-06
*/
async unbindDeptRole(deptRole: DeptRoleVO): Promise<SysDeptRole> {
async unbindDeptRole(deptRole: DeptRoleVO): Promise<ResultDomain<SysDeptRole>> {
const response = await api.post<SysDeptRole>('/depts/unbind/role', deptRole);
return response.data.data!;
return response.data;
}
};