Commit f89d8610 by ethanlamzs

树形数据 选择逻辑

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