mirror of
https://github.com/APIParkLab/APIPark.git
synced 2026-06-14 20:41:15 +08:00
fix: Modify member transfer icon and department
This commit is contained in:
@@ -2,11 +2,10 @@
|
||||
import { TransferProps, TreeDataNode, Tree, Spin, Input } from "antd";
|
||||
import { DataNode } from "antd/es/tree";
|
||||
import { Ref, forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
||||
import { LoadingOutlined } from "@ant-design/icons";
|
||||
import { ApartmentOutlined, LoadingOutlined, UserOutlined } from "@ant-design/icons";
|
||||
import { ColumnsType } from "antd/es/table";
|
||||
import { $t } from "@common/locales";
|
||||
import { useGlobalContext } from "@common/contexts/GlobalStateContext";
|
||||
import Search from "antd/es/input/Search";
|
||||
|
||||
export type TransferTableProps<T> = {
|
||||
request?:(k?:string)=>Promise<{data:T[],success:boolean}>
|
||||
@@ -107,20 +106,23 @@ const generateTree = (
|
||||
...item,
|
||||
title,
|
||||
disableCheckbox:disabledData.indexOf(item.key as string) !== -1,
|
||||
icon:<ApartmentOutlined />,
|
||||
children: loop(item.children as T[]) };
|
||||
}
|
||||
|
||||
return {
|
||||
...item,
|
||||
title,
|
||||
icon:<UserOutlined />,
|
||||
isLeaf:true,
|
||||
disableCheckbox:disabledData.indexOf(item.key as string) !== -1
|
||||
};
|
||||
});
|
||||
console.log(searchWord, dataSource)
|
||||
return loop(dataSource);
|
||||
},[dataSource, state.language, searchWord])
|
||||
|
||||
console.log(dataSource)
|
||||
|
||||
const getInitExpandKeys = (data:T[], expandKeys:string[] = [])=>{
|
||||
data.forEach((item)=>{
|
||||
if(item.children?.length){
|
||||
@@ -160,6 +162,7 @@ const generateTree = (
|
||||
onExpand={setExpandedKeys}
|
||||
treeData={translatedDataSource}
|
||||
blockNode
|
||||
showIcon
|
||||
/>
|
||||
|
||||
</Spin>
|
||||
|
||||
@@ -6,7 +6,6 @@ import { MemberDropdownModalHandle, MemberDropdownModalProps, DepartmentListItem
|
||||
import WithPermission from "@common/components/aoplatform/WithPermission.tsx";
|
||||
import { $t } from "@common/locales/index.ts";
|
||||
import { useGlobalContext } from "@common/contexts/GlobalStateContext.tsx";
|
||||
import { DataNode } from "antd/es/tree/index";
|
||||
|
||||
export const MemberDropdownModal = forwardRef<MemberDropdownModalHandle,MemberDropdownModalProps>((props,ref)=>{
|
||||
const { message} = App.useApp()
|
||||
|
||||
@@ -100,23 +100,27 @@ const TeamInsideMember:FC = ()=>{
|
||||
]
|
||||
: [...departmentMap.get('_withoutDepartment') || []];
|
||||
|
||||
|
||||
let allMemberSelectedFlag:boolean = true
|
||||
for(const [k,v] of departmentMap){
|
||||
if(k !== '_withoutDepartment' && allMemberIds.length > 0 ){
|
||||
// 筛选出部门内没被勾选的用户,如果不存在没勾选用户,需要将部门id放入ids中
|
||||
if(v.filter(m => allMemberIds.indexOf(m.id) === -1).length === 0){
|
||||
setAllMemberSelectedDepartIds((pre)=>[...pre, k])
|
||||
}else if(['unknown','disable'].indexOf(k) === -1){
|
||||
allMemberSelectedFlag = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!finalData[0].children || finalData[0].children.filter(m => allMemberIds.indexOf(m.id) === -1).length === 0){
|
||||
setAllMemberSelectedDepartIds((pre)=>[...pre, topDepartmentId])
|
||||
|
||||
if(departmentMap.get('_withoutDepartment')?.filter(x=>allMemberIds.indexOf(x)!==-1).length === 0 && allMemberSelectedFlag){
|
||||
setAllMemberSelectedDepartIds((pre)=>[...pre, topDepartmentId])
|
||||
}
|
||||
|
||||
|
||||
return {data:finalData, success: true}
|
||||
}).catch(()=>({data:[], success:false}))
|
||||
}
|
||||
|
||||
|
||||
const getMemberList = ()=>{
|
||||
return fetchData<BasicResponse<{members:TeamMemberTableListItem}>>('team/members',{method:'GET',eoParams:{keyword:searchWord, team:teamId},eoTransformKeys:['attach_time','is_delete']}).then(response=>{
|
||||
@@ -331,7 +335,8 @@ const TeamInsideMember:FC = ()=>{
|
||||
disabledData={treeDisabledData}
|
||||
request={()=>getDepartmentMemberList()}
|
||||
onSelect={(selectedData: Set<string>) => {
|
||||
setAddMemberBtnDisabled((selectedData.length === 0));
|
||||
const memberKeyFromModal = Array.from(selectedData)?.filter(x => allMemberIds.indexOf(x) === -1 &&selectableMemberIds.has(x)) || [];
|
||||
setAddMemberBtnDisabled((memberKeyFromModal.length === 0));
|
||||
}}
|
||||
searchPlaceholder={$t("输入名称查找用户")}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user