feat:【antd】【ele】统一 codegen、file 的 API 参数
This commit is contained in:
@@ -65,7 +65,7 @@ export namespace InfraCodegenApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 更新代码生成请求 */
|
/** 更新代码生成请求 */
|
||||||
export interface CodegenUpdateReq {
|
export interface CodegenUpdateReqVO {
|
||||||
table: any | CodegenTable;
|
table: any | CodegenTable;
|
||||||
columns: CodegenColumn[];
|
columns: CodegenColumn[];
|
||||||
}
|
}
|
||||||
@@ -106,25 +106,36 @@ export function getCodegenTable(tableId: number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 修改代码生成表定义 */
|
/** 修改代码生成表定义 */
|
||||||
export function updateCodegenTable(data: InfraCodegenApi.CodegenUpdateReq) {
|
export function updateCodegenTable(data: InfraCodegenApi.CodegenUpdateReqVO) {
|
||||||
return requestClient.put('/infra/codegen/update', data);
|
return requestClient.put('/infra/codegen/update', data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 基于数据库的表结构,同步数据库的表和字段定义 */
|
/** 基于数据库的表结构,同步数据库的表和字段定义 */
|
||||||
export function syncCodegenFromDB(tableId: number) {
|
export function syncCodegenFromDB(tableId: number) {
|
||||||
return requestClient.put(`/infra/codegen/sync-from-db?tableId=${tableId}`);
|
return requestClient.put(
|
||||||
|
'/infra/codegen/sync-from-db',
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
params: { tableId },
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 预览生成代码 */
|
/** 预览生成代码 */
|
||||||
export function previewCodegen(tableId: number) {
|
export function previewCodegen(tableId: number) {
|
||||||
return requestClient.get<InfraCodegenApi.CodegenPreview[]>(
|
return requestClient.get<InfraCodegenApi.CodegenPreview[]>(
|
||||||
`/infra/codegen/preview?tableId=${tableId}`,
|
'/infra/codegen/preview',
|
||||||
|
{
|
||||||
|
params: { tableId },
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 下载生成代码 */
|
/** 下载生成代码 */
|
||||||
export function downloadCodegen(tableId: number) {
|
export function downloadCodegen(tableId: number) {
|
||||||
return requestClient.download(`/infra/codegen/download?tableId=${tableId}`);
|
return requestClient.download('/infra/codegen/download', {
|
||||||
|
params: { tableId },
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 获得表定义 */
|
/** 获得表定义 */
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export namespace InfraFileApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 文件预签名地址 */
|
/** 文件预签名地址 */
|
||||||
export interface FilePresignedUrlResp {
|
export interface FilePresignedUrlRespVO {
|
||||||
configId: number; // 文件配置编号
|
configId: number; // 文件配置编号
|
||||||
uploadUrl: string; // 文件上传 URL
|
uploadUrl: string; // 文件上传 URL
|
||||||
url: string; // 文件 URL
|
url: string; // 文件 URL
|
||||||
@@ -27,7 +27,7 @@ export namespace InfraFileApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 上传文件 */
|
/** 上传文件 */
|
||||||
export interface FileUploadReq {
|
export interface FileUploadReqVO {
|
||||||
file: globalThis.File;
|
file: globalThis.File;
|
||||||
directory?: string;
|
directory?: string;
|
||||||
}
|
}
|
||||||
@@ -52,7 +52,7 @@ export function deleteFileList(ids: number[]) {
|
|||||||
|
|
||||||
/** 获取文件预签名地址 */
|
/** 获取文件预签名地址 */
|
||||||
export function getFilePresignedUrl(name: string, directory?: string) {
|
export function getFilePresignedUrl(name: string, directory?: string) {
|
||||||
return requestClient.get<InfraFileApi.FilePresignedUrlResp>(
|
return requestClient.get<InfraFileApi.FilePresignedUrlRespVO>(
|
||||||
'/infra/file/presigned-url',
|
'/infra/file/presigned-url',
|
||||||
{
|
{
|
||||||
params: { name, directory },
|
params: { name, directory },
|
||||||
@@ -67,7 +67,7 @@ export function createFile(data: InfraFileApi.File) {
|
|||||||
|
|
||||||
/** 上传文件 */
|
/** 上传文件 */
|
||||||
export function uploadFile(
|
export function uploadFile(
|
||||||
data: InfraFileApi.FileUploadReq,
|
data: InfraFileApi.FileUploadReqVO,
|
||||||
onUploadProgress?: AxiosProgressEvent,
|
onUploadProgress?: AxiosProgressEvent,
|
||||||
) {
|
) {
|
||||||
// 特殊:由于 upload 内部封装,即使 directory 为 undefined,也会传递给后端
|
// 特殊:由于 upload 内部封装,即使 directory 为 undefined,也会传递给后端
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ export function getUploadUrl(): string {
|
|||||||
* @param file 文件
|
* @param file 文件
|
||||||
*/
|
*/
|
||||||
function createFile0(
|
function createFile0(
|
||||||
vo: InfraFileApi.FilePresignedUrlResp,
|
vo: InfraFileApi.FilePresignedUrlRespVO,
|
||||||
file: File,
|
file: File,
|
||||||
): InfraFileApi.File {
|
): InfraFileApi.File {
|
||||||
const fileVO = {
|
const fileVO = {
|
||||||
|
|||||||
@@ -112,9 +112,13 @@ export function updateCodegenTable(data: InfraCodegenApi.CodegenUpdateReqVO) {
|
|||||||
|
|
||||||
/** 基于数据库的表结构,同步数据库的表和字段定义 */
|
/** 基于数据库的表结构,同步数据库的表和字段定义 */
|
||||||
export function syncCodegenFromDB(tableId: number) {
|
export function syncCodegenFromDB(tableId: number) {
|
||||||
return requestClient.put('/infra/codegen/sync-from-db', {
|
return requestClient.put(
|
||||||
params: { tableId },
|
'/infra/codegen/sync-from-db',
|
||||||
});
|
{},
|
||||||
|
{
|
||||||
|
params: { tableId },
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 预览生成代码 */
|
/** 预览生成代码 */
|
||||||
|
|||||||
Reference in New Issue
Block a user