1.显示
getColumns = () => {
const { roleKV } = this.props.content;
const { checkedChildren,unCheckedChildren,switchflag,textflag} = this.state;
return [
{title:'商户名称',dataIndex:'f_merchtname'},
{title:'渠道类型',
dataIndex:'f_name',
},
{title:'开通状态',align:'center',dataIndex:'fUse',
render: (text, record, index) => (
console.log("text = " + text),
<Switch defaultChecked={text} onChange={(switchflag)=>this.handleSwitch(switchflag,record)}/>
)}
]
}
2.提交
handleSwitch = (switchflag,record) => {
console.log("merctchannelupdate record = " + record.fUse);
// const {switchBox} = this.state;
// this.setState({
// switchflag: true
// });
ajax({
url: 'merctchannel_update',
fUse: switchflag ? "1" : "0",
fChaneltype:record.fChaneltype,
listKey:'merctchannelupdate'
},
()=>{
this.handleSearch();
message.success("更新成功")
});
}
3.效果
4.日志