使用方法:
在SFSchema的properties中加入
file: {
type: 'string',
title: '上传文件',
ui: {
widget: 'upload',
action: '/reporter/upload_file',
resReName: 'resource_id',
urlReName: 'url',
fileSize: 40960,
data:{deptId:this.activatedRouter.queryParams['_value']['deptId'],createId:this.activatedRouter.queryParams['_value']['createId']},
change: v => this.onChangeStatus({uploadChangeParam:v})
}
}as any,
注意change属性的使用方法
//上传文件完成回调函数
onChangeStatus(value:any){
console.log(value);
const uploadChangeParam = value.uploadChangeParam;
if (uploadChangeParam.type === 'progress' ){
}else if (uploadChangeParam.type === 'success'){
}
}
type分为4中类型:start,progress,success,error
后台接口返回的参数在uploadChangeParam.file.response中
后台接口入参为:
@RequestParam(required = true, value = "file") MultipartFile file,
@RequestParam(required = true, value = "deptId") String deptId,
@RequestParam(required = true, value = "createId") String createId
出参为自定义对象