修改模板生成的上传控件,上传图片报错问题

This commit is contained in:
侯炯 2025-07-14 18:32:39 +08:00
parent c3c2822efb
commit 29961bb2bc
2 changed files with 3 additions and 3 deletions

View File

@ -333,7 +333,7 @@ if(@column.EffectType == "Upload"){
@:public async Task<SysFile> Upload@(@column.PropertyName)([Required] IFormFile file)
@:{
@:var service = App.GetRequiredService<SysFileService>();
@:return await service.UploadFile(new UploadFileInput { File = file, Path = "upload/@(@column.PropertyName)" });
@:return await service.UploadFile(new UploadFileInput { File = file}, "upload/@(@column.PropertyName)" );
@:}
}
}

View File

@ -435,9 +435,9 @@ if(@column.EffectType == "Upload"){
@:// 上传@(@column.ColumnComment)
@:const upload@(@column.PropertyName)Handle = async (options: UploadRequestOptions) => {
@if (@Model.IsApiService) {
@:let res = await getAPI(@(@Model.ClassName)Api).api@(@Model.ClassName)Upload@(@column.FkEntityName)PostForm(options);
@:let res = await getAPI(@(@Model.ClassName)Api).api@(@Model.ClassName)Upload@(@column.PropertyName)PostForm(options.file);
} else {
@:let res = await upload@(@column.PropertyName)(options);
@:let res = await upload@(@column.PropertyName)(options.file);
}
@:state.ruleForm.@(column.LowerPropertyName) = res.data.result?.url;
@:};