Commit f89d8610 by ethanlamzs

树形数据 选择逻辑

1 parent b270d3cf
......@@ -165,6 +165,9 @@ export default class linkmanadm extends PureComponent {
const { schools: {data}, loading } = this.props;
const { selectedRows, modalVisible, addInputValue } = this.state;
console.log('schlist');
console.log(this.props);
const columns = [
{
title: '学校',
......
......@@ -15,7 +15,8 @@ import {
Tooltip,
Menu,
Dropdown,
Tree
Tree,
Button
} from 'antd';
import {
......@@ -46,15 +47,14 @@ const TreeNode = Tree.TreeNode;
export default class schoolmgr extends Component{
state = {
checkedKeys:[],
};
componentDidMount() {
const { dispatch } = this.props;
//console.log(this.props);
//console.log(this.state);
let schoolCode = this.props.match.params.schcode;
this.setState({
......@@ -68,7 +68,7 @@ export default class schoolmgr extends Component{
}
//初始化对应的树节点数据
onLoadData = (treeNode) => {
return new Promise((resolve) => {
if (treeNode.props.children) {
......@@ -89,6 +89,7 @@ export default class schoolmgr extends Component{
}
//加载所有数节点
renderTreeNodes = (data) => {
return data.map((item) => {
if (item.children) {
......@@ -104,6 +105,7 @@ export default class schoolmgr extends Component{
});
}
//加载对应的联系人节点
renderTreeLefs = (groupid)=>{
const {linkman:{linkmanMap}} = this.props;
if(linkmanMap['g_'+groupid]){
......@@ -116,6 +118,17 @@ export default class schoolmgr extends Component{
return "";
}
onCheck = (checkedKeys) => {
console.log('onCheck', checkedKeys);
this.setState({ checkedKeys });
}
//根据当前选择的对象,删除指定的联系人
removelkman = () => {
console.log('removelkman');
}
render(){
......@@ -159,13 +172,27 @@ export default class schoolmgr extends Component{
<Col xl={16} lg={24} md={24} sm={24} xs={24}>
<div >
<div><span>企业号通讯录结构</span></div>
<Tree checkable loadData={this.onLoadData}>
<Tree
checkable
loadData={this.onLoadData}
onCheck={this.onCheck}
checkedKeys={this.state.checkedKeys}
>
{this.renderTreeNodes(groups)}
</Tree>
</div>
</Col>
<Col xl={8} lg={24} md={24} sm={24} xs={24}>
<div> two </div>
<div>
<ChartCard
bordered={false}
title='操作/功能区'
contentHeight={46} >
<div>
<Button style={{ marginLeft: 8 }} onClick={this.removelkman}>删除联系人</Button>
</div>
</ChartCard>
</div>
</Col>
</Row>
</div>;
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!