Commit 14445fa0 by zhangleyuan

feat:处理刷新列表

parent 024f23bc
......@@ -185,7 +185,7 @@ function EmployeeManage() {
// return <span><WWOpenDataCom type="departmentName" openid={item}/>{index<(record.depNameList.length -1)?';':''}</span>;
// })
return <Tooltip title={<div>{handleDepName(record.depNameList)}</div>} placement='top' arrowPointAtCenter><div className="post-name"> {record.depNameList.map((item, index) => {
return <span><WWOpenDataCom type="departmentName" openid={item}/>{index<(record.depNameList.length -1)?';':''}</span>
return <span><WWOpenDataCom type="departmentName" openid={item}/>{index<(record.depNameList.length -1)?'':''}</span>
})}
</div>
</Tooltip>
......@@ -242,7 +242,7 @@ function EmployeeManage() {
function handleDepName(depArray:any):any{
const depArrayDom = depArray.map((item:any, index:any) => {
return <WWOpenDataCom type="departmentName" openid={item}/>
return <span><WWOpenDataCom type="departmentName" openid={item}/></span>
});
return depArrayDom;
};
......@@ -352,10 +352,10 @@ function EmployeeManage() {
userType:'USER'
}
StoreService.syncWorkWeChatDepartment(params).then((res) => {
getEmployeeList();
message.success('已更新');
});
}
return (
<div className="page employee-manage-page">
<div className="content-header">员工管理</div>
......
......@@ -80,7 +80,7 @@ function DepartMentTabCon(props) {
return <span>-</span>
}
return <Tooltip title={handleDepName(record.depNameList)} placement='top' arrowPointAtCenter><div className="post-name"> {record.depNameList.map((item, index) => {
return <span>{item}{index!==record.depNameList.length-1 && <span>;</span>}</span>;
return <span>{item}{index!==record.depNameList.length-1 && <span></span>}</span>
})}
</div>
</Tooltip>
......@@ -127,7 +127,7 @@ function DepartMentTabCon(props) {
let depStr = '';
depArray.forEach((item, index) => {
if (index < depArray.length - 1) {
depStr = depStr + item + '';
depStr = depStr + item + '';
} else {
depStr = depStr + item;
}
......
......@@ -24,10 +24,32 @@ function LeftStructureTree(props) {
const [currentGroupData,setCurrentGroupData] = useState({});
const [completeOptions,setCompleteOption] = useState([]);
const [selectedKeys,setSelectedKeys]= useState([]); // 设置选中的部门key值
const [queryName,setQueryName] = useState('');
const [queryName,setQueryName] = useState(''); // 搜索框内的值
const [selctQueryName,setSelctQueryName]= useState(''); // 搜索出结果后最终选择的名字
const [postGroupTreeData,setPostGroupTreeData] = useState([]); // 为了判定创建和编辑时的数据会不会重明
const [open,setOpen]=useState(false);
useEffect(()=>{
setQueryName(''); //切换tab时搜索置空
setCompleteOption([]);
setOpen(false); //切换tab时搜索的下拉框置为空
getTreeData().then((res)=>{
const _defaultSelectedKeys = [];
if(res.length > 0){
_defaultSelectedKeys.push(res[0].id);
setSelectedKeys(_defaultSelectedKeys);
props.onChangeSelectDep(res[0])
props.searchUserList(res[0],treeType,1);
}
});
},[props.treeType]);
useEffect(()=>{
Bus.bind("addCustomer",(record)=>{addCustomer(record.treeType,record.query)})
},[]);
useEffect(()=>{
Bus.bind("changeTreeData",(record)=>{getTreeData(record.treeType)})
},[]);
const renderTitle = (title) => (
<span>
{title}
......@@ -80,9 +102,10 @@ function LeftStructureTree(props) {
return placeholder
}
function confirmSearchSelect(value,option){
console.log('option',option);
setOpen(false);
setQueryName(value);
// console.log('option',option);
// setSelctQueryName(option)
props.searchUserList({queryName:value},treeType,1);
}
......@@ -160,27 +183,7 @@ function LeftStructureTree(props) {
});
}
useEffect(()=>{
setQueryName(''); //切换tab时搜索置空
setCompleteOption([]);
setOpen(false); //切换tab时搜索的下拉框置为空
getTreeData().then((res)=>{
const _defaultSelectedKeys = [];
if(res.length > 0){
_defaultSelectedKeys.push(res[0].id);
setSelectedKeys(_defaultSelectedKeys);
props.onChangeSelectDep(res[0])
props.searchUserList(res[0],treeType,1);
}
});
},[props.treeType]);
useEffect(()=>{
Bus.bind("addCustomer",(record)=>{addCustomer(record.treeType,record.query)})
},[]);
useEffect(()=>{
Bus.bind("changeTreeData",(record)=>{getTreeData(record.treeType)})
},[]);
async function addCustomer(treeType,query){
await getTreeData(treeType);
props.searchUserList(query,treeType,1);
......@@ -359,9 +362,10 @@ function LeftStructureTree(props) {
return;
}
}
console.log("record.sonDepartmentVOList",record.sonDepartmentVOList)
if(level===1){
if(record.sonDepartmentVOList){
if(record.sonDepartmentVOList.lenght > 19){
if(record.sonDepartmentVOList.length > 19){
message.error("自定义分组数量已达20个上限");
return;
}
......@@ -484,81 +488,108 @@ function LeftStructureTree(props) {
</div>
)}
<div className="tree-con">
<DirectoryTree
defaultExpandAll
showIcon={false}
treeData={treeData}
selectedKeys={selectedKeys}
onSelect={selectUserList}
titleRender={(nodeData) => {
return (
<div
className="node-title-div"
onMouseOver={(e) => {
if((props.treeType==='postGrouptab' || props.treeType=== 'customGroupTab')){
if (nodeData.key === "null") return;
let moreDiv = e.currentTarget.getElementsByClassName(
"item-more"
)[0];
let countDiv = e.currentTarget.getElementsByClassName(
"item-count"
)[0];
if (moreDiv) {
moreDiv.style.visibility = "visible";
}
if (countDiv) {
countDiv.style.visibility = "hidden";
}
}
}}
onMouseOut={(e) => {
if((props.treeType==='postGrouptab' || props.treeType=== 'customGroupTab')){
if (nodeData.key === "null") return;
let moreDiv = e.currentTarget.getElementsByClassName(
"item-more"
)[0];
let countDiv = e.currentTarget.getElementsByClassName(
"item-count"
)[0];
if (moreDiv) {
moreDiv.style.visibility = "hidden";
}
if (countDiv) {
countDiv.style.visibility = "visible";
}
{!selctQueryName ?
<DirectoryTree
defaultExpandAll
showIcon={false}
treeData={treeData}
selectedKeys={selectedKeys}
onSelect={selectUserList}
titleRender={(nodeData) => {
return (
<div
className="node-title-div"
onMouseOver={(e) => {
if((props.treeType==='postGrouptab' || props.treeType=== 'customGroupTab')){
if (nodeData.key === "null") return;
let moreDiv = e.currentTarget.getElementsByClassName(
"item-more"
)[0];
let countDiv = e.currentTarget.getElementsByClassName(
"item-count"
)[0];
if (moreDiv) {
moreDiv.style.visibility = "visible";
}
if (countDiv) {
countDiv.style.visibility = "hidden";
}
}
}}
onMouseOut={(e) => {
if((props.treeType==='postGrouptab' || props.treeType=== 'customGroupTab')){
if (nodeData.key === "null") return;
let moreDiv = e.currentTarget.getElementsByClassName(
"item-more"
)[0];
let countDiv = e.currentTarget.getElementsByClassName(
"item-count"
)[0];
if (moreDiv) {
moreDiv.style.visibility = "hidden";
}
if (countDiv) {
countDiv.style.visibility = "visible";
}
}
}}
>
<div className="item-icon">
<span className="icon iconfont title-icon">&#xe604;</span>
</div>
<div
className="item-title"
style={{
width:
leftBoxWidth <= "240px"
? "35%"
: leftBoxWidth <= "304px"
? "60%"
: "78%",
}}
>
{ props.treeType==='departMentTab'?
<span><WWOpenDataCom type="departmentName" openid={nodeData.name}/></span>
:
<span>{nodeData.name}</span>
}
</div>
<div className="item-count">({nodeData.departmentCount || 0})</div>
{ (props.treeType==='postGrouptab' || props.treeType=== 'customGroupTab') && (
<Dropdown overlay={moreOpenGroupOperate(nodeData)}>
<div className="item-more icon iconfont">&#xe927;</div>
</Dropdown>
)}
</div>
);
}}
/>
:
<div>
{ (props.treeType==='departMentTab') &&
<div>
{ option.name?
<WWOpenDataCom type="departmentName" openid={option.name}/>
:
<WWOpenDataCom type="userName" openid={option.userName}/>
}
}}
>
<div className="item-icon">
<span className="icon iconfont title-icon">&#xe604;</span>
</div>
<div
className="item-title"
style={{
width:
leftBoxWidth <= "240px"
? "35%"
: leftBoxWidth <= "304px"
? "60%"
: "78%",
}}
>
{ props.treeType==='departMentTab'?
<span><WWOpenDataCom type="departmentName" openid={nodeData.name}/></span>
}
{ (props.treeType==='postGrouptab' || props.treeType=== 'customGroupTab') &&
<div>
{ option.name?
<span>{option.name}</span>
:
<span>{nodeData.name}</span>
<span>{option.userName}</span>
}
</div>
<div className="item-count">({nodeData.departmentCount || 0})</div>
{ (props.treeType==='postGrouptab' || props.treeType=== 'customGroupTab') && (
<Dropdown overlay={moreOpenGroupOperate(nodeData)}>
<div className="item-more icon iconfont">&#xe927;</div>
</Dropdown>
)}
</div>
);
}}
/>
}
</div>
}
</div>
</div>
{addOrEditPostGroupShow && (
......
......@@ -2,7 +2,7 @@
* @Author: wufan
* @Date: 2020-11-27 16:21:49
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-08-06 15:07:53
* @LastEditTime: 2021-08-06 17:10:50
* @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
......@@ -24,7 +24,7 @@ function AddOrEditPostGroupModal(props) {
setIsError(false)
setValidateStatus('success');
setNameErrorMsg('');
if((!postGroupName) || /^\s+$/.test(postGroupName)){
if((!e.target.value) || /^\s+$/.test(e.target.value)){
setValidateStatus('error');
setNameErrorMsg(`${props.label}不能为空`);
setIsError(true)
......
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