mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 01:49:19 +08:00
refactor: 调整api和页面组件位置
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
import type { DepartmentDTO, DepartmentVO } from './types';
|
||||
|
||||
import type { PageQueryDTO, PageResultVO } from '#/types/common';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/**
|
||||
* 部门管理API
|
||||
*/
|
||||
|
||||
/**
|
||||
* 分页获取部门列表
|
||||
*/
|
||||
export async function getDepartmentPageApi(
|
||||
params: PageQueryDTO<DepartmentDTO.DepartmentFiltersDTO>,
|
||||
) {
|
||||
return requestClient.post<PageResultVO<DepartmentVO.DepartmentInfoVO>>(
|
||||
'/department/list',
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建部门
|
||||
*/
|
||||
export async function createDepartmentApi(
|
||||
data: DepartmentDTO.CreateDepartmentDTO,
|
||||
) {
|
||||
return requestClient.post<DepartmentVO.DepartmentInfoVO>(
|
||||
'/department/create',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新部门
|
||||
*/
|
||||
export async function updateDepartmentApi(
|
||||
id: number,
|
||||
data: DepartmentDTO.UpdateDepartmentDTO,
|
||||
) {
|
||||
return requestClient.put<DepartmentVO.DepartmentInfoVO>(
|
||||
`/department/update/${id}`,
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除部门
|
||||
*/
|
||||
export async function deleteDepartmentApi(id: number) {
|
||||
return requestClient.delete(`/department/delete/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全部部门
|
||||
*/
|
||||
export async function getAllDepartmentsApi() {
|
||||
return requestClient.get<DepartmentVO.DepartmentInfoVO[]>('/department/all');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门树
|
||||
*/
|
||||
export async function getDepartmentTreeApi() {
|
||||
return requestClient.get<DepartmentVO.DepartmentInfoVO[]>('/department/tree');
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* 部门管理模块API导出
|
||||
*/
|
||||
|
||||
export * from './apis';
|
||||
export * from './types';
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* 部门管理模块类型定义导出
|
||||
*/
|
||||
|
||||
export * from './types.dto';
|
||||
export * from './types.vo';
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* 部门管理模块DTO类型定义
|
||||
*/
|
||||
|
||||
export namespace DepartmentDTO {
|
||||
/** 创建部门参数 */
|
||||
export interface CreateDepartmentDTO {
|
||||
/** 部门名称 */
|
||||
name: string;
|
||||
/** 父部门ID */
|
||||
parentId?: number;
|
||||
/** 备注 */
|
||||
remark?: string;
|
||||
/** 状态 */
|
||||
status?: number;
|
||||
}
|
||||
|
||||
/** 更新部门参数 */
|
||||
export interface UpdateDepartmentDTO {
|
||||
/** 部门名称 */
|
||||
name: string;
|
||||
/** 父部门ID */
|
||||
parentId?: number;
|
||||
/** 备注 */
|
||||
remark?: string;
|
||||
/** 状态 */
|
||||
status?: number;
|
||||
}
|
||||
|
||||
/** 部门过滤条件 */
|
||||
export interface DepartmentFiltersDTO {
|
||||
/** 部门名称(模糊查询) */
|
||||
name?: string;
|
||||
/** 父级部门ID */
|
||||
parentId?: number;
|
||||
/** 状态 */
|
||||
status?: number;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* 部门管理模块VO类型定义
|
||||
*/
|
||||
|
||||
export namespace DepartmentVO {
|
||||
/** 部门信息 */
|
||||
export interface DepartmentInfoVO {
|
||||
/** 部门ID */
|
||||
id: number;
|
||||
/** 部门名称 */
|
||||
name: string;
|
||||
/** 父部门ID */
|
||||
parentId?: number;
|
||||
/** 公司ID */
|
||||
companyId: number;
|
||||
/** 备注 */
|
||||
remark?: string;
|
||||
/** 状态 */
|
||||
status: number;
|
||||
/** 创建时间 */
|
||||
createTime: string;
|
||||
/** 更新时间 */
|
||||
updateTime: string;
|
||||
/** 创建人ID */
|
||||
createBy?: number;
|
||||
/** 更新人ID */
|
||||
updateBy?: number;
|
||||
/** 子部门 */
|
||||
children?: DepartmentInfoVO[];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
import type { PositionDTO, PositionVO } from './types';
|
||||
|
||||
import type { PageQueryDTO, PageResultVO } from '#/types/common';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/**
|
||||
* 岗位管理API
|
||||
*/
|
||||
|
||||
/**
|
||||
* 分页获取岗位列表
|
||||
*/
|
||||
export async function getPositionPageApi(
|
||||
params: PageQueryDTO<PositionDTO.PositionFiltersDTO>,
|
||||
) {
|
||||
return requestClient.post<PageResultVO<PositionVO.PositionInfoVO>>(
|
||||
'/position/list',
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建岗位
|
||||
*/
|
||||
export async function createPositionApi(data: PositionDTO.CreatePositionDTO) {
|
||||
return requestClient.post<PositionVO.PositionInfoVO>(
|
||||
'/position/create',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新岗位
|
||||
*/
|
||||
export async function updatePositionApi(
|
||||
id: number,
|
||||
data: PositionDTO.UpdatePositionDTO,
|
||||
) {
|
||||
return requestClient.put<PositionVO.PositionInfoVO>(
|
||||
`/position/update/${id}`,
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除岗位
|
||||
*/
|
||||
export async function deletePositionApi(id: number) {
|
||||
return requestClient.delete(`/position/delete/${id}`);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* 岗位管理模块API导出
|
||||
*/
|
||||
|
||||
export * from './apis';
|
||||
export * from './types';
|
||||
@@ -0,0 +1,62 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/**
|
||||
* 职位权限分配API
|
||||
* 用于管理职位分配的精确权限码(控制接口访问)
|
||||
*/
|
||||
|
||||
/**
|
||||
* 获取岗位所有权限ID列表
|
||||
*/
|
||||
export async function getPositionPermissionIdsApi(positionId: number) {
|
||||
return requestClient.get<number[]>(`/position-permission/permission-ids/${positionId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取岗位所有权限码列表
|
||||
*/
|
||||
export async function getPositionPermissionCodesApi(positionId: number) {
|
||||
return requestClient.get<string[]>(`/position-permission/permission-codes/${positionId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取职位权限列表(含详情)
|
||||
*/
|
||||
export async function getPositionPermissionsApi(positionId: number) {
|
||||
return requestClient.get<any[]>(`/position-permission/permissions/${positionId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量更新职位权限
|
||||
*/
|
||||
export async function batchUpdatePositionPermissionsApi(
|
||||
positionId: number,
|
||||
permissionIds: number[],
|
||||
) {
|
||||
return requestClient.post<void>(
|
||||
`/position-permission/batch-update/${positionId}`,
|
||||
permissionIds,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查岗位是否有指定权限
|
||||
*/
|
||||
export async function checkPositionPermissionApi(
|
||||
positionId: number,
|
||||
permissionId: number,
|
||||
) {
|
||||
return requestClient.get<boolean>(
|
||||
`/position-permission/check/${positionId}/${permissionId}`,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取系统所有权限(用于分配)
|
||||
*/
|
||||
export async function getAllPermissionsApi() {
|
||||
return requestClient.post<any>('/permission/list', {
|
||||
page: 1,
|
||||
pageSize: 1000,
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* 职位权限分配相关类型
|
||||
*/
|
||||
|
||||
export namespace PositionPermissionAssignVO {
|
||||
/**
|
||||
* 职位权限关联信息
|
||||
*/
|
||||
export interface PositionPermissionInfo {
|
||||
/** 主键ID */
|
||||
id: number;
|
||||
/** 职位ID */
|
||||
positionId: number;
|
||||
/** 职位名称 */
|
||||
positionName: string;
|
||||
/** 权限ID */
|
||||
permissionId: number;
|
||||
/** 权限码 */
|
||||
permissionCode: string;
|
||||
/** 权限名称 */
|
||||
permissionName: string;
|
||||
/** 权限类型 */
|
||||
permissionType: string;
|
||||
/** 创建时间 */
|
||||
createTime: string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/**
|
||||
* 职位菜单管理API
|
||||
* 用于管理职位分配的菜单(控制侧边栏展示)
|
||||
*/
|
||||
|
||||
/**
|
||||
* 获取岗位所有菜单ID
|
||||
*/
|
||||
export async function getPositionMenuIdsApi(positionId: number) {
|
||||
return requestClient.get<number[]>(`/position-menu/menu-ids/${positionId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量更新职位菜单
|
||||
*/
|
||||
export async function batchUpdatePositionMenusApi(positionId: number, menuIds: number[]) {
|
||||
return requestClient.post<void>(`/position-menu/batch-update/${positionId}`, menuIds);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from './apis';
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* 岗位管理模块类型定义导出
|
||||
*/
|
||||
|
||||
export * from './types.dto';
|
||||
export * from './types.vo';
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* 岗位管理模块DTO类型定义
|
||||
*/
|
||||
|
||||
export namespace PositionDTO {
|
||||
/** 创建岗位参数 */
|
||||
export interface CreatePositionDTO {
|
||||
/** 岗位名称 */
|
||||
name: string;
|
||||
/** 岗位编码 */
|
||||
code?: string;
|
||||
/** 部门ID */
|
||||
departmentId?: number;
|
||||
/** 备注 */
|
||||
remark?: string;
|
||||
/** 状态 */
|
||||
status?: number;
|
||||
}
|
||||
|
||||
/** 更新岗位参数 */
|
||||
export interface UpdatePositionDTO {
|
||||
/** 岗位名称 */
|
||||
name: string;
|
||||
/** 岗位编码 */
|
||||
code?: string;
|
||||
/** 部门ID */
|
||||
departmentId?: number;
|
||||
/** 备注 */
|
||||
remark?: string;
|
||||
/** 状态 */
|
||||
status?: number;
|
||||
}
|
||||
|
||||
/** 岗位过滤条件 */
|
||||
export interface PositionFiltersDTO {
|
||||
/** 岗位名称(模糊查询) */
|
||||
name?: string;
|
||||
/** 状态 */
|
||||
status?: number;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* 岗位管理模块VO类型定义
|
||||
*/
|
||||
|
||||
export namespace PositionVO {
|
||||
/** 岗位信息 */
|
||||
export interface PositionInfoVO {
|
||||
/** 岗位ID */
|
||||
id: number;
|
||||
/** 岗位名称 */
|
||||
name: string;
|
||||
/** 岗位编码 */
|
||||
code?: string;
|
||||
/** 部门ID */
|
||||
departmentId?: number;
|
||||
/** 备注 */
|
||||
remark?: string;
|
||||
/** 状态 */
|
||||
status: number;
|
||||
/** 公司ID */
|
||||
companyId: number;
|
||||
/** 创建时间 */
|
||||
createTime: string;
|
||||
/** 更新时间 */
|
||||
updateTime: string;
|
||||
/** 创建人ID */
|
||||
createBy?: number;
|
||||
/** 更新人ID */
|
||||
updateBy?: number;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user