const { formData, formItems, formRef, resetData } = useForm<any>(
{},
[
{
type: 'input',
label: '变更金额',
name: 'changeAmount',
col: 24,
rules: [{ required: true, message: '必填项' }],
},
{
type: 'upload',
label: '上传文件:',
name: 'changeData',
uploadMultiple: false,
col: 24,
rules: [{ required: true, message: '必填项' }],
uploadAccept: '.xlsx',
uploadTips: '支持扩展名: .xlsx',
},
],
{
commonItem: {
async uploadSend(file: File) {
const uploadData = await uploadMultipleFileAPI(file, UploadFileType.支出合同)
return {
url: uploadData.shortUrl,
name: uploadData.originalName,
}
},
},
},
)
<EncForm v-model:data="formData" :items="formItems" ref="formRef" :label-width="200" />