Commit 3db3e5a0 by zhangleyuan

feat:处理搜索模块

parent c7471eda
...@@ -200,36 +200,47 @@ function DepartMentTabCon(props) { ...@@ -200,36 +200,47 @@ function DepartMentTabCon(props) {
}; };
function updateListData(){ function updateListData(){
let num = 1; let num;
if(num<3){ const params = {
return confirm({ enterpriseId:User.getEnterpriseId(),
title: "确定更新列表数据吗?", storeId:User.getStoreId(),
content: `员工数据来源企微通讯录,一天只能更新3次,今日还能更新${3-num}次。`, userType:'CUSTOMER'
icon: (
<span className="icon iconfont default-confirm-icon">&#xe839; </span>
),
okText: "确定",
cancelText: "取消",
onOk: () => {
confirmUpdateListData()
},
});
}else{
Modal.warning({
title: '提示',
okText: '我知道了',
content: '员工数据今日更新次数已达上限(3次),无法继续更新。',
icon: (
<span className='icon iconfont default-confirm-icon' style={{ color: '#FFBB54 !important' }}>
&#xe834;
</span>
),
});
} }
StoreService.getSyncCount(params).then((res) => {
num = res.result;
if(num<3){
return confirm({
title: "确定更新列表数据吗?",
content: `学员数据来源企微通讯录,一天只能更新3次,今日还能更新${3-num}次。`,
icon: (
<span className="icon iconfont default-confirm-icon">&#xe839; </span>
),
okText: "确定",
cancelText: "取消",
onOk: () => {
confirmUpdateListData()
},
});
}else{
Modal.warning({
title: '提示',
okText: '我知道了',
content: '学员数据今日更新次数已达上限(3次),无法继续更新。',
icon: (
<span className='icon iconfont default-confirm-icon' style={{ color: '#FFBB54 !important' }}>
&#xe834;
</span>
),
});
}
});
} }
function confirmUpdateListData(){ function confirmUpdateListData(){
const params = { const params = {
enterpriseId:User.getEnterpriseId(), enterpriseId:User.getEnterpriseId(),
storeId:User.getStoreId(),
userType:'CUSTOMER'
} }
StoreService.syncWorkWeChatDepartment(params).then((res) => { StoreService.syncWorkWeChatDepartment(params).then((res) => {
message.success('已更新'); message.success('已更新');
......
...@@ -23,7 +23,7 @@ function LeftStructureTree(props) { ...@@ -23,7 +23,7 @@ function LeftStructureTree(props) {
const [selectDepParams,setSelectDepParams] = useState({}); // 设置选择的部门、岗位组、自定分组的参数 const [selectDepParams,setSelectDepParams] = useState({}); // 设置选择的部门、岗位组、自定分组的参数
const [completeOptions,setCompleteOption] = useState([]); const [completeOptions,setCompleteOption] = useState([]);
const [selectedKeys,setSelectedKeys]= useState([]); // 设置选中的部门key值 const [selectedKeys,setSelectedKeys]= useState([]); // 设置选中的部门key值
const [queryName,setQueryName] = useState('');
const renderTitle = (title) => ( const renderTitle = (title) => (
<span> <span>
{title} {title}
...@@ -62,6 +62,7 @@ function LeftStructureTree(props) { ...@@ -62,6 +62,7 @@ function LeftStructureTree(props) {
dropdownClassName="certain-category-search-dropdown" dropdownClassName="certain-category-search-dropdown"
dropdownMatchSelectWidth={250} dropdownMatchSelectWidth={250}
allowClear allowClear
value={queryName}
onChange={getCompleteOptionData} onChange={getCompleteOptionData}
notFoundContent={notFoundContentNode()} notFoundContent={notFoundContentNode()}
style={{ style={{
...@@ -69,12 +70,13 @@ function LeftStructureTree(props) { ...@@ -69,12 +70,13 @@ function LeftStructureTree(props) {
}} }}
options={completeOptions} options={completeOptions}
> >
<Input size="large" placeholder="搜索部门/学员姓名" /> <Input.Search size="large" placeholder="input here" enterButton />
</AutoComplete> </AutoComplete>
); );
// 获取关键词的搜索结果 // 获取关键词的搜索结果
function getCompleteOptionData(value){ function getCompleteOptionData(value){
setQueryName(value)
const params = { const params = {
depType:DepType[props.treeType], depType:DepType[props.treeType],
queryName:value, queryName:value,
...@@ -89,7 +91,7 @@ function LeftStructureTree(props) { ...@@ -89,7 +91,7 @@ function LeftStructureTree(props) {
const userObj = {}; const userObj = {};
const departmentGroupObj = {}; const departmentGroupObj = {};
const postobj = {}; const postobj = {};
const {departmentUserVOList,departmentVOList} = res.result; const {departmentUserVOList=[],departmentVOList=[]} = res.result;
if(departmentUserVOList.records.length>0){ if(departmentUserVOList.records.length>0){
userObj.label=renderTitle('员工'); userObj.label=renderTitle('员工');
userObj.options=departmentUserVOList.records.map((item,index)=>{ userObj.options=departmentUserVOList.records.map((item,index)=>{
...@@ -121,7 +123,14 @@ function LeftStructureTree(props) { ...@@ -121,7 +123,14 @@ function LeftStructureTree(props) {
_completeOptions.push(departmentGroupObj); _completeOptions.push(departmentGroupObj);
} }
console.log('_completeOptions',_completeOptions); console.log('_completeOptions',_completeOptions);
// setCompleteOption(_completeOptions); const options = [
{
label: renderTitle('Libraries'),
options: [renderItem({name:'张乐园'}, 'department')],
}
];
setCompleteOption(_completeOptions);
}); });
} }
...@@ -356,12 +365,6 @@ function LeftStructureTree(props) { ...@@ -356,12 +365,6 @@ function LeftStructureTree(props) {
<div className="left-structure-tree"> <div className="left-structure-tree">
<div className="organization"> <div className="organization">
<div className="search-con"> <div className="search-con">
{/* <Search
placeholder="搜索部门/学员姓名"
className="search search-input"
style={{ width: 245 }}
enterButton={<span className="icon iconfont">&#xe832;</span>}
/> */}
<Complete/> <Complete/>
</div> </div>
{ (props.treeType==='postGrouptab' || props.treeType=== 'customGroupTab') && ( { (props.treeType==='postGrouptab' || props.treeType=== 'customGroupTab') && (
......
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