参数格式
<el-upload :http-request="upload" class="upload" :show-file-list="false" :on-success="handleUploadSuccess">
<el-button size="default" type="primary" style="margin:0 20px;">上传文件</el-button>
</el-upload>
const baseUrl = TM.API.ENV.BASE_URL; //服务地址
// 上传
const upload = async (param: any) => {
tableData.length = 0;
tableData = [];
const formData = new FormData()
formData.append('file', param.file)
request.post(
`${baseUrl}api/v1/admin/file/add`,
formData,
{
params: {
PId: ids.value,
FilePath: filePathsValue.value,
DocumentType: 2
}
}
).then(async (res) => {
if (ids.value === 0) {
filePathFlag.value = false
filePathNext.value = '' //只展示当前层级名称
await getTableData()
} else {
await getNextTableList()
}
})
}