/* * 自定义浏览框组件 * 选择框右边 * @Author: 黎永顺 * @Date: 2024/8/30 * @Wechat: * @Email: 971387674@qq.com * @description: */ import React, { Component } from "react"; import { WeaInputSearch, WeaLocaleProvider, WeaNewScroll } from "ecCom"; import { Tree } from "antd"; const getLabel = WeaLocaleProvider.getLabel; const TreeNode = Tree.TreeNode; let timeout = null; class CustomBrowserMutiRight extends Component { constructor(props) { super(props); this.state = { key: "" }; this.nodeIds = []; this.nodeObj = {}; } generateTreeNodes = () => { const { data } = this.props, { key } = this.state; const treeNodes = []; let showData = [...data]; if (_.trim(key)) { showData = showData.filter((item) => { return item.name.indexOf(_.trim(key)) > -1; }); } showData = _.uniqBy(showData, "id"); this.nodeIds = []; this.nodeObj = {}; showData.map((item) => { let title = (
{item.name}
); treeNodes.push(); this.nodeIds.push(item["id"]); this.nodeObj[item["id"]] = item; }); return treeNodes; }; handleSearchChange = (v) => this.setState({ key: v }); checkHandler = (v) => { clearTimeout(timeout); timeout = setTimeout(() => { this.props.checkedCb && this.props.checkedCb(v); }, 200); }; onDoubleClick = (key) => { clearTimeout(timeout); this.props.onDoubleClick && this.props.onDoubleClick(key); }; render() { const { height, checkedKeys } = this.props; return (
{this.generateTreeNodes()}
); } } export default CustomBrowserMutiRight;