forked from Gitlink/forgeplus-react
添加成员-删了后不能重复添加成员
This commit is contained in:
parent
1292019aac
commit
d4f0d21608
|
@ -66,9 +66,10 @@ function AddMember({getID,login,showNotification}){
|
|||
};
|
||||
|
||||
function addCollaborator(){
|
||||
if(source && source.length>0){
|
||||
if(source && source.length>0&&searchKey){
|
||||
getID && getID(id);
|
||||
setSearchKey(undefined);
|
||||
setID(undefined)
|
||||
}else{
|
||||
showNotification("请选择存在的用户!");
|
||||
}
|
||||
|
|
|
@ -8,15 +8,16 @@ import Group from './CollaboratorGroup';
|
|||
function Collaborator(props){
|
||||
const [ nav , setNav] = useState("1");
|
||||
const [ newId , setNewId] = useState(undefined);
|
||||
const [ newIdFlag , setNewIdFlag ] = useState(false);
|
||||
const [ addOperation , setAddOperation] = useState(true);
|
||||
const [ newGroupId , setNewGroupId] = useState(undefined);
|
||||
const {projectsId ,owner} = props.match.params;
|
||||
|
||||
|
||||
const author = props && props.projectDetail && props.projectDetail.author;
|
||||
|
||||
function getID(id){
|
||||
setNewId(id);
|
||||
setNewIdFlag(!newIdFlag);
|
||||
}
|
||||
function getGroupID(id){
|
||||
setNewGroupId(id);
|
||||
|
@ -47,7 +48,7 @@ function Collaborator(props){
|
|||
<div>
|
||||
{
|
||||
nav === "1" ?
|
||||
<Member newId={newId} projectsId={projectsId} owner={owner} project_id={props.project_id} author={props.projectDetail && props.projectDetail.author} showNotification={props.showNotification}/>
|
||||
<Member newId={newId} flag={newIdFlag} projectsId={projectsId} owner={owner} project_id={props.project_id} author={props.projectDetail && props.projectDetail.author} showNotification={props.showNotification}/>
|
||||
:
|
||||
<Group setAddOperation={setAddOperation} owner={owner} projectsId={projectsId} newGroupId={newGroupId}/>
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, { useEffect, useState } from 'react';
|
||||
import React, { useEffect, useState , useImperativeHandle , forwardRef } from 'react';
|
||||
import { Dropdown, Menu, Icon , Input , Spin , Table , Tooltip , Pagination , Popconfirm } from "antd";
|
||||
import axios from 'axios';
|
||||
import NoneData from "../Nodata";
|
||||
|
@ -12,7 +12,7 @@ const MENU_LIST = [
|
|||
{id: "Developer",name: "开发者"},
|
||||
{id: "Reporter",name: "报告者"}
|
||||
];
|
||||
function CollaboratorMember({projectsId,owner,project_id,author,showNotification,newId}){
|
||||
function CollaboratorMember({projectsId,owner,project_id,author,showNotification,newId,flag}){
|
||||
const [ roleName , setRoleName ] = useState(undefined);
|
||||
const [ search , setSearch ] = useState(undefined);
|
||||
const [ page , setPage ] = useState(1);
|
||||
|
@ -20,11 +20,12 @@ function CollaboratorMember({projectsId,owner,project_id,author,showNotification
|
|||
const [ role , setRole ] = useState(undefined);
|
||||
const [ listData , setListData ] = useState(undefined);
|
||||
const [ total , setTotal ] = useState(0);
|
||||
|
||||
useEffect(()=>{
|
||||
if(newId){
|
||||
addCollaborator(newId);
|
||||
}
|
||||
},[newId])
|
||||
},[flag])
|
||||
// 增加协作者
|
||||
function addCollaborator(id){
|
||||
if(id){
|
||||
|
@ -276,4 +277,4 @@ function CollaboratorMember({projectsId,owner,project_id,author,showNotification
|
|||
</React.Fragment>
|
||||
)
|
||||
}
|
||||
export default CollaboratorMember;
|
||||
export default forwardRef(CollaboratorMember);
|
Loading…
Reference in New Issue