Commit 78c20d35 by zhangleyuan

feat:处理搜索

parent b664a146
/*
* @Author: 陈剑宇
* @Date: 2020-05-07 14:43:01
* @LastEditTime: 2021-06-22 16:49:06
* @LastEditTime: 2021-08-11 22:52:04
* @LastEditors: Please set LastEditors
* @Description:
* @FilePath: /wheat-web-demo/src/domains/basic-domain/constants.ts
......
......@@ -2,7 +2,7 @@
* @Author: 吴文洁
* @Date: 2020-08-20 09:21:40
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-06-11 15:17:56
* @LastEditTime: 2021-08-11 22:50:48
* @Description:
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
......
import React, { useEffect, useState } from "react";
import React, { useEffect, useState ,useRef} from "react";
import { withRouter } from "react-router-dom";
import { Tree, Input, Dropdown, Menu,Button,Modal,message,AutoComplete,Tooltip} from "antd";
import AddOrEditPostGroupModal from "../modal/AddOrEditPostGroupModal";
......@@ -28,6 +28,7 @@ function LeftStructureTree(props) {
const [selctQueryName,setSelctQueryName]= useState(''); // 搜索出结果后最终选择的名字
const [postGroupTreeData,setPostGroupTreeData] = useState([]); // 为了判定创建和编辑时的数据会不会重明
const [open,setOpen]=useState(false);
const timer =useRef(null)
useEffect(()=>{
setQueryName(''); //切换tab时搜索置空
......@@ -501,6 +502,14 @@ function LeftStructureTree(props) {
props.searchUserList(e.selectedNodes[0],treeType,1);
}
function changeName(value){
clearTimeout(timer)
timer.current= setTimeout(()=>{
setQueryName(value);setOpen(true);getCompleteOptionData(value)
},500)
}
return (
<div className="left-structure-tree">
<div className="organization">
......@@ -510,7 +519,7 @@ function LeftStructureTree(props) {
dropdownClassName="certain-category-search-dropdown"
dropdownMatchSelectWidth={250}
allowClear
onChange={(value)=>{setQueryName(value);setOpen(true);getCompleteOptionData(value)}}
onChange={changeName}
// onSearch={(value)=>{getCompleteOptionData(value)}}
notFoundContent={notFoundContentNode()}
value={queryName}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment