| | |
| | | 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' |
| | |
| | | _data = initdata || [] |
| | | _sync = false |
| | | } |
| | | |
| | | _config.wrap.contentHeight = config.wrap.title || config.wrap.searchable === 'true' ? 'calc(100% - 45px)' : '100%' |
| | | |
| | | this.setState({ |
| | | config: _config, |
| | |
| | | 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 |
| | |
| | | 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 /> |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | if (selected) { |
| | | delete _data.children |
| | | MKEmitter.emit('resetSelectLine', config.uuid, (_data ? _data.$key : ''), _data) |
| | | } |
| | | |
| | |
| | | <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} |