king
2021-12-22 5223edbcccfed84a33a706e5637ee65a61f377aa
src/tabviews/custom/components/tree/antd-tree/index.jsx
@@ -1,7 +1,8 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import { Spin, Empty, notification, Input, Tree, Icon } from 'antd'
import { Spin, Empty, notification, Input, Tree } from 'antd'
import { FolderOpenOutlined, FolderOutlined, FileOutlined } from '@ant-design/icons'
import moment from 'moment'
import Api from '@/api'
@@ -48,6 +49,8 @@
      _data = initdata || []
      _sync = false
    }
    _config.wrap.contentHeight = config.wrap.title || config.wrap.searchable === 'true' ? 'calc(100% - 45px)' : '100%'
    this.setState({
      config: _config,
@@ -252,14 +255,14 @@
      logMap.set(val, true)
      if (pval === config.wrap.mark) {
        parentNodes.push({
          // ...item,
          ...item,
          $title: item[config.wrap.labelField] || '',
          $key: val,
          $parentId: ''
        })
      } else if (pval) {
        _options.push({
          // ...item,
          ...item,
          $title: item[config.wrap.labelField] || '',
          $key: val,
          $parentId: pval
@@ -363,12 +366,12 @@
    return nodes.map(item => {
      if (item.children) {
        return (
          <TreeNode icon={<span><Icon type="folder-open" /><Icon type="folder" /></span>} title={item.$title} key={item.$key} dataRef={item}>
          <TreeNode icon={<span><FolderOpenOutlined /><FolderOutlined /></span>} title={item.$title} key={item.$key} dataRef={item}>
            {this.renderTreeNodes(item.children)}
          </TreeNode>
        )
      }
      return <TreeNode icon={<Icon type="file" />} key={item.$key} title={item.$title} dataRef={item} isLeaf />
      return <TreeNode icon={<FileOutlined />} key={item.$key} title={item.$title} dataRef={item} isLeaf />
    })
  }
@@ -416,6 +419,7 @@
    }
    if (selected) {
      delete _data.children
      MKEmitter.emit('resetSelectLine', config.uuid, (_data ? _data.$key : ''), _data)
    }
@@ -440,7 +444,7 @@
          <span className="title">{config.wrap.title}</span>
          {config.wrap.searchable === 'true' ? <Search allowClear onSearch={this.treeFilter} /> : null}
        </div> : null}
        {treeNodes && treeNodes.length > 0 ? <div className="tree-box">
        {treeNodes && treeNodes.length > 0 ? <div className="tree-box" style={{height: config.wrap.contentHeight}}>
          <Tree
            blockNode
            onSelect={this.selectTreeNode}