Commit 78c20d35 by zhangleyuan

feat:处理搜索

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