fix: c
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
CI / CI OK (push) Has been cancelled
Deploy Website on push / Rerun on failure (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled
Close stale issues / stale (push) Has been cancelled

This commit is contained in:
2025-12-24 14:42:57 +08:00
parent 08e79c60e7
commit 7743cdc29a
49 changed files with 2179 additions and 4575 deletions

View File

@@ -25,6 +25,37 @@ export namespace FeatureApi {
api_id?: string;
name?: string;
}
export interface FeatureExampleItem {
id: number;
feature_id: number;
api_id: string;
data: string;
create_time: string;
update_time: string;
}
export interface ConfigFeatureExampleRequest {
feature_id: number;
data: string;
}
export interface ConfigFeatureExampleResponse {
success: boolean;
}
export interface GetFeatureExampleRequest {
feature_id: number;
}
export interface GetFeatureExampleResponse {
id: number;
feature_id: number;
api_id: string;
data: string;
create_time: string;
update_time: string;
}
}
/**
@@ -72,10 +103,35 @@ async function deleteFeature(id: number) {
return requestClient.delete<{ success: boolean }>(`/feature/delete/${id}`);
}
/**
* 配置功能示例数据
* @param data 示例数据配置
*/
async function configFeatureExample(
data: FeatureApi.ConfigFeatureExampleRequest,
) {
return requestClient.post<FeatureApi.ConfigFeatureExampleResponse>(
'/feature/config-example',
data,
);
}
/**
* 获取功能示例数据
* @param featureId 功能ID
*/
async function getFeatureExample(featureId: number) {
return requestClient.get<FeatureApi.GetFeatureExampleResponse>(
`/feature/example/${featureId}`,
);
}
export {
configFeatureExample,
createFeature,
deleteFeature,
getFeatureDetail,
getFeatureExample,
getFeatureList,
updateFeature,
};

View File

@@ -0,0 +1,165 @@
import type { Recordable } from '@vben/types';
import { requestClient } from '#/api/request';
export namespace SystemApiApi {
export interface SystemApiItem {
id: number;
role_id?: number;
api_id?: number;
api_name: string;
api_code: string;
method: string;
url: string;
status: 0 | 1;
description?: string;
create_time?: string;
update_time?: string;
}
export interface SystemApi {
list: SystemApiItem[];
total: number;
}
export interface SystemApiAllResponse {
items: SystemApiItem[];
}
export interface SystemRoleApiResponse {
items: null | SystemApiItem[];
}
export interface RoleApiItem {
id: number;
role_id: number;
api_id: number;
api_name: string;
api_code: string;
method: string;
url: string;
status: 0 | 1;
description?: string;
}
export interface RoleApi {
list: RoleApiItem[];
}
}
/**
* 获取API列表数据
*/
async function getApiList(params: Recordable<any>) {
return requestClient.get<SystemApiApi.SystemApi>('/api/list', {
params,
});
}
/**
* 获取API详情
* @param id API ID
*/
async function getApiDetail(id: number) {
return requestClient.get<SystemApiApi.SystemApiItem>(`/api/detail/${id}`);
}
/**
* 创建API
* @param data API数据
*/
async function createApi(
data: Omit<SystemApiApi.SystemApiItem, 'create_time' | 'id' | 'update_time'>,
) {
return requestClient.post('/api/create', data);
}
/**
* 更新API
* @param id API ID
* @param data API数据
*/
async function updateApi(
id: number,
data: Omit<SystemApiApi.SystemApiItem, 'create_time' | 'id' | 'update_time'>,
) {
return requestClient.put(`/api/update/${id}`, data);
}
/**
* 删除API
* @param id API ID
*/
async function deleteApi(id: number) {
return requestClient.delete(`/api/delete/${id}`);
}
/**
* 批量更新API状态
* @param data.ids API ID数组
* @param data.status 状态值
*/
async function batchUpdateApiStatus(data: { ids: number[]; status: 0 | 1 }) {
return requestClient.put('/api/batch-update-status', data);
}
/**
* 获取角色API权限列表
* @param roleId 角色ID
*/
async function getRoleApiList(roleId: number) {
return requestClient.get<SystemApiApi.SystemRoleApiResponse>(
`/role/${roleId}/api/list`,
);
}
/**
* 分配角色API权限
* @param data.api_ids API ID数组
* @param data.role_id 角色ID
*/
async function assignRoleApi(data: { api_ids: number[]; role_id: number }) {
return requestClient.post('/role/api/assign', data);
}
/**
* 移除角色API权限
* @param data.api_ids API ID数组
* @param data.role_id 角色ID
*/
async function removeRoleApi(data: { api_ids: number[]; role_id: number }) {
return requestClient.post('/role/api/remove', data);
}
/**
* 更新角色API权限全量更新
* @param data.api_ids API ID数组
* @param data.role_id 角色ID
*/
async function updateRoleApi(data: { api_ids: number[]; role_id: number }) {
return requestClient.put('/role/api/update', data);
}
/**
* 获取所有API列表用于权限分配
* @param params.status 状态过滤
*/
async function getAllApiList(params?: { status?: number }) {
return requestClient.get<SystemApiApi.SystemApiAllResponse>('/api/all', {
params,
});
}
export {
assignRoleApi,
batchUpdateApiStatus,
createApi,
deleteApi,
getAllApiList,
getApiDetail,
getApiList,
getRoleApiList,
removeRoleApi,
updateApi,
updateRoleApi,
};

View File

@@ -1,3 +1,4 @@
export * from './api';
export * from './dept';
export * from './menu';
export * from './role';

View File

@@ -51,4 +51,14 @@ async function deleteUser(id: string) {
return requestClient.delete(`/user/delete/${id}`);
}
export { createUser, deleteUser, getUserList, updateUser };
/**
* 重置用户密码
* @param id 用户 ID
* @param data 新密码数据
* @param data.password 新密码
*/
async function resetPassword(id: string, data: { password: string }) {
return requestClient.post(`/reset-password/${id}`, data);
}
export { createUser, deleteUser, getUserList, resetPassword, updateUser };