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