{
title: '是否封禁', dataIndex: 'enableStatus', key: 'enableStatus',
render: (record, item) => {
return (
<Switch checked={item['enableStatus'] === '0'} checkedChildren='是' unCheckedChildren='否' onClick={(checked) => this.handleSetStatus(checked, item)}
/>
)
}
},
handleSetStatus = (checked, item) => {
// 1启用 ;0禁用
commonConfig.ajaxNoFileMethods('/user/updateEnableStatus', {id: item.id}, res => {
console.log(res);
if (res.code === '200') {
message.success(res.message);
this.setState({checked: !checked})
}
this.props.getUserList();
}, null, null, null, true)
}
react在表格里使用Switch组件,控制权限
最新推荐文章于 2024-05-14 09:41:04 发布