//文件导入后台需要使用formData()
let data = new FormData()
//多文件导入需要循环导入
for (let i = 0; i < this.spectrumFiles.length; i++) {
data.append('spectrumFiles', this.spectrumFiles[i])
}
data.append('proFile', this.proFile)
// 不能直接打印formdata的内容
// console.log(11111, data.getAll('spectrumFiles'));
// console.log(222222, data.getAll('proFile'));
this.axios.request({
url: ' ',
data,
method: 'post'
}).then(response => {
if (response.data.Check) {
this.$Message.success('导入成功')
this.spectrumModal = false
this.getSamplingListData()
} else {
this.$Message.error(response.data.Msg)
}
}, response => {
this.$Message.error('服务器错误!')
})
07-02
1635
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)