componentDidMount()

in src/routes/System/Role/AddModal.js [38:61]


  componentDidMount() {
    let {
      allPermissionInfo: { treeList = [] },
      rolePermissionList = [],
    } = this.props;
    if (treeList && treeList.length > 0) {
      let checkedKeys = [];
      if (rolePermissionList && rolePermissionList.length > 0) {
        treeList.forEach((treeNode) =>
          filterTree(treeNode, (node) => {
            rolePermissionList.forEach((key) => {
              if (node.id === key && node.isLeaf) {
                checkedKeys.push(key);
              }
            });
          }),
        );
      }
      this.setState({
        expandedKeys: treeList.map((e) => e.id),
        checkedKeys,
      });
    }
  }