|
|
|
@ -60,26 +60,16 @@ class Collaborator extends Component{
|
|
|
|
|
console.log(error);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
// 选择用户
|
|
|
|
|
// 输入用户
|
|
|
|
|
changeInputUser=(e)=>{
|
|
|
|
|
console.log(e);
|
|
|
|
|
this.setState({
|
|
|
|
|
user:e
|
|
|
|
|
})
|
|
|
|
|
this.getUserList(e);
|
|
|
|
|
}
|
|
|
|
|
changeUser=(e)=>{
|
|
|
|
|
console.log("click",e);
|
|
|
|
|
this.setState({
|
|
|
|
|
user_id:e,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
serachUser=(e)=>{
|
|
|
|
|
console.log("select",e);
|
|
|
|
|
// 选择用户
|
|
|
|
|
selectInputUser=(e,option)=>{
|
|
|
|
|
this.setState({
|
|
|
|
|
user:e.item.props.children
|
|
|
|
|
user_id:e
|
|
|
|
|
})
|
|
|
|
|
this.getUserList(option.props.children);
|
|
|
|
|
}
|
|
|
|
|
getUserList=(e)=>{
|
|
|
|
|
const url = `/users/list.json`;
|
|
|
|
@ -98,6 +88,22 @@ class Collaborator extends Component{
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 增加协作者
|
|
|
|
|
addCollaborator=()=>{
|
|
|
|
|
const { project_id } = this.props;
|
|
|
|
|
const { user_id } = this.state;
|
|
|
|
|
const url = `/projects/${project_id}/members.json`;
|
|
|
|
|
axios.post(url,{
|
|
|
|
|
user_id
|
|
|
|
|
}).then(result=>{
|
|
|
|
|
if(result){
|
|
|
|
|
this.getMember(project_id);
|
|
|
|
|
}
|
|
|
|
|
}).catch(error=>{
|
|
|
|
|
console.log(error);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 修改权限
|
|
|
|
|
changeOperaiton=(e,id)=>{
|
|
|
|
|
const { project_id } = this.props;
|
|
|
|
@ -120,23 +126,6 @@ class Collaborator extends Component{
|
|
|
|
|
console.log(error);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 增加协作者
|
|
|
|
|
addCollaborator=()=>{
|
|
|
|
|
const { projectsId } = this.props.match.params;
|
|
|
|
|
const { project_id } = this.props;
|
|
|
|
|
const { user_id } = this.state;
|
|
|
|
|
const url = `/projects/${projectsId}/members.json`;
|
|
|
|
|
axios.post(url,{
|
|
|
|
|
user_id
|
|
|
|
|
}).then(result=>{
|
|
|
|
|
if(result){
|
|
|
|
|
this.getMember(project_id);
|
|
|
|
|
}
|
|
|
|
|
}).catch(error=>{
|
|
|
|
|
console.log(error);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
render(){
|
|
|
|
|
const { user , userDataSource , listData , isSpin } = this.state;
|
|
|
|
|
|
|
|
|
@ -154,7 +143,7 @@ class Collaborator extends Component{
|
|
|
|
|
|
|
|
|
|
const source = userDataSource && userDataSource.map((item,key)=>{
|
|
|
|
|
return(
|
|
|
|
|
<Option key={key} value={`${item.user_id}`} onClick={this.serachUser}>{item.username}</Option>
|
|
|
|
|
<Option key={key} value={`${item.user_id}`}>{item.username}</Option>
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
return(
|
|
|
|
@ -189,12 +178,11 @@ class Collaborator extends Component{
|
|
|
|
|
</Spin>
|
|
|
|
|
<div className="addPanel">
|
|
|
|
|
<AutoComplete
|
|
|
|
|
value={user}
|
|
|
|
|
dataSource={source}
|
|
|
|
|
style={{ width: 200 }}
|
|
|
|
|
onChange={this.changeInputUser}
|
|
|
|
|
onSelect={this.selectInputUser}
|
|
|
|
|
placeholder="搜索用户"
|
|
|
|
|
onSelect={this.changeUser}
|
|
|
|
|
/>
|
|
|
|
|
<a className="small_submitBtn ml20" onClick={this.addCollaborator}>增加协作者</a>
|
|
|
|
|
</div>
|
|
|
|
|