/** [handleSubmit]表单提交数据函数 */
handleSubmit = (e)=>{
let self = this;
e.preventDefault();
this.props.form.validateFieldsAndScroll((err, values) => {
if(typeof values.consultationDate != "string"){
var consultationDate = values['consultationDate'].format('YYYY-MM-DD HH:mm:ss');
values['consultationDate']=consultationDate;
}
if (!err) {
this.addFollowUp(values);
}
});
}
/** [addFollowUp] 获取表单数据并传输到后台进行保存 */
addFollowUp = (formData)=>{
let followUpReplyDetails = [];
console.log("followUpReplyDetails",followUpReplyDetails)
formData.answerList.map((answer,index)=>{
let followUpReplyDetail = {
'replyid':this.props.data.id,
'deptcode': window.sessionStorage.getItem('deptid'),
'doctorid': window.sessionStorage.getItem('userid'),
'doctorname': window.sessionStorage.getItem('username'),
'creator': window.sessionStorage.getItem('userid'),
'updator': window.sessionStorage.getItem('userid'),
'questionname': this.state.symptomsData[index].questionname,
'questionid': this.state.symptomsData[index].questionid,
'answer': answer.vname?answer.vname:answer.answer,
'answerid': answer.valueid?answer.valueid:answer.answerid,
}
followUpReplyDetails.push(followUpReplyDetail)
})
let dataSource={
'id':this.props.data.id,
'followupid':this.props.data.followupid,
'orgid':this.props.data.orgid,
'registerid':this.props.data.registerid,
"doctorid": window.sessionStorage.getItem('userid'),
"doctorname": window.sessionStorage.getItem('username'),
"deptcode":this.props.data.deptcode,
"creator":window.sessionStorage.getItem('userid'),
"updator": window.sessionStorage.getItem('userid'),
"advice":formData.allergichistory,
"ispatient":formData.patientReport,
"writeTime":this.props.data.writeTime,
"useflag":this.props.data.useflag,
"ctstamp":this.props.data.ctstamp,
"followUpReplyDetails":followUpReplyDetails,
}
let params = {
url: 'BuFollowUpReplyReplyController/putData',
contentType: "application/json;charset=UTF-8",
type: 'PUT',
data: JSON.stringify(dataSource),
};
let than = this;
function callBack(res){
if(res.result){
notification.info({
message: "提示",
description: "提交成功",
placement: "bottomRight",
duration: 2
});
than.setState({disabled:true})
// than.props.setModule({module:''})
}else{
notification.error({
message: "提示",
description: "提交失败",
placement: "bottomRight",
duration: 2
});
}
};
ajaxGetResource(params, callBack);
}
react提交表单数据到后台保存后,页面为什么不显示数据
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
2条回答 默认 最新
- 崽崽的谷雨 2021-06-29 10:00关注
提交成功后,后台应该会返回值,如果不是后端返回,需要,前端记录下来,提交的值。然后接口提交成功后,拿到这个值。渲染就行,用标签渲染
let value={ //这个是提交的值 id:111, name:"00" } //渲染 <div>{{value.id}}</div> <div>{{value.name}}</div>
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥20 有谁能看看我coe文件到底哪儿有问题吗?
- ¥20 我的这个coe文件到底哪儿出问题了
- ¥15 matlab使用自定义函数时一直报错输入参数过多
- ¥15 设计一个温度闭环控制系统
- ¥100 rtmpose姿态评估
- ¥15 java 通过反射找路径下的类,打包后就找不到
- ¥15 通联支付网上收银统一下单接口
- ¥15 angular有偿编写,
- ¥15 centos7系统下abinit安装时make出错
- ¥15 hbuildex运行微信小程序报错