/* * @Author: lusx * @Date: 2020-03-03 09:17:39 * @Last Modified by: lusx * @Last Modified time: 2020-04-24 16:50:30 */ import React from "react"; import { Input, Menu } from "antd"; import { withRouter } from 'react-router'; import { WeaLocaleProvider } from 'ecCom'; const getLabel = WeaLocaleProvider.getLabel; @withRouter export default class Content extends React.Component { static defaultProps = { //React.PureComponent prefixCls: 'prj-select', hasSearch: true, hasAll: true, notFoundContent: "无匹配项", goText: "查看所有项目" }; constructor() { super(); this.state = { value: '' } } componentWillUnmount() { this.setState({ value: '' }) } render() { const { options, prefixCls, hasSearch , hasAll , _inputChangeFun, onChange, notFoundContent, goText, _clearFun, selectedKey } = this.props; // console.log("options--",options) const { value } = this.state; return (
{hasSearch &&
}
this._onChange({ key })}> { options.menus && options.menus.map(item => ( { item.datas.length > 0 ? item.datas && item.datas.map(i => ( {i.name} )) : {notFoundContent} } )) } {hasAll && {getLabel('518319','查看所有项目')}({options.total}) }
) } inputChange = (ev) => { const oEvent = ev || event; oEvent.preventDefault(); this.setState({ value: oEvent.target.value, }); } clearFun = () => { this.setState({ value: '' }) } _onChange = (id, ev) => { const { handleVisibleChange, _clearFun } = this.props; if (id.key === "noone") { handleVisibleChange(false); return false; } const oEvent = ev || event; oEvent.preventDefault(); this.props.onChange(id.key) handleVisibleChange(false); _clearFun(); this.setState({ value: '' }); } allFun = () => { this.props.router.push({pathname: "/main/prj/portal"}); } }