confirmEvent(){
//得到详情页面的id
let id = this.props.match.params.id;
//得到用户名的id,因为我是存在本地localStroage,因此,我直接取出来
let adminId = localStorage.getItem('id');
//传基本参数
let param = {
id:id,
distributePersonId: adminId,
//计划执行人id
planExecutiveId: this.state.planExecutiveId,
remark: this.state.remark
}
//new 一个formData对象
let fromData = new FormData();
this.state.form.files.forEach(f=>{
formData.append("file",f);
})
formData.append("workOrder",
new Blob([JSON.stringify(param)],type:"application/json"));
//调用接口的地址
let url = '';
return fetch(url,{
method: 'PUT',
header: {
'Authorization':"Bearer "+localStorage.getItem('jwt_token'),
},
body: formData,
mode: "cors"
}).then(res=>{
return res.json()
}).then(data=>{
console.log("data");
}).catch(err=>{
console.log("数据请求失败!");
})
}
code
最新推荐文章于 2024-08-03 20:06:12 发布