From 324a39152ba0f6d2b8e3b05dda0c2d7310a56522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Mon, 26 Aug 2019 10:00:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=90=88=E4=BD=9C=E8=80=85?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../paths/PathDetail/addCollaborators.js | 27 ++++++++++++--- .../Collaborators/Collaborators.js | 33 +++++++++++++++---- 2 files changed, 48 insertions(+), 12 deletions(-) diff --git a/public/react/src/modules/paths/PathDetail/addCollaborators.js b/public/react/src/modules/paths/PathDetail/addCollaborators.js index 0b99fd467..056e69b31 100644 --- a/public/react/src/modules/paths/PathDetail/addCollaborators.js +++ b/public/react/src/modules/paths/PathDetail/addCollaborators.js @@ -14,7 +14,8 @@ class addCollaborators extends Component{ search:'', partnerListid:[], checkAll: false, - optionss:[] + optionss:[], + useristrue:false } } addBox=()=>{ @@ -70,6 +71,13 @@ class addCollaborators extends Component{ let {partnerListid} =this.state; let id=this.props.match.params.pathId; let url="/paths/"+id+"/add_subject_members.json" + + if(partnerListid.length===0){ + this.setState({ + useristrue:true + }) + return + } axios.post(url,{ user_ids:partnerListid }).then((response) => { @@ -87,9 +95,17 @@ class addCollaborators extends Component{ } addCollaboratorsid=(id)=>{ - this.setState({ - partnerListid:id - }) + if(id.length===0){ + this.setState({ + partnerListid:id, + }) + }else{ + this.setState({ + partnerListid:id, + useristrue:false + }) + } + } onCheckAllChange = (e) => { @@ -145,7 +161,7 @@ class addCollaborators extends Component{ } render(){ - let {addPartner,search,partnerList,optionss,checkAll,partnerListid} = this.state; + let {addPartner,search,partnerList,optionss,checkAll,partnerListid,useristrue} = this.state; return( this.props.detailInfoList===undefined?"":this.props.detailInfoList.allow_add_member===true? @@ -199,6 +215,7 @@ class addCollaborators extends Component{ } + {useristrue===true?请先选择用户:""}
取消 确定 diff --git a/public/react/src/modules/tpm/shixunchild/Collaborators/Collaborators.js b/public/react/src/modules/tpm/shixunchild/Collaborators/Collaborators.js index 1662635ba..ea99b740d 100644 --- a/public/react/src/modules/tpm/shixunchild/Collaborators/Collaborators.js +++ b/public/react/src/modules/tpm/shixunchild/Collaborators/Collaborators.js @@ -45,7 +45,8 @@ class Collaborators extends Component { collaboratorListsumtype:true, user_name:undefined, school_name:undefined, - spinnings:false + spinnings:false, + useristrue:false } } componentDidMount() { @@ -217,10 +218,20 @@ class Collaborators extends Component { } else { alltype = false } - this.setState({ - Searchadmin: newlist, - allChangechecked: alltype - }) + + if(newlist.length===0){ + this.setState({ + Searchadmin: newlist, + allChangechecked: alltype, + }) + }else{ + this.setState({ + Searchadmin: newlist, + allChangechecked: alltype, + useristrue:false + }) + } + } allChange = (e) => { @@ -260,6 +271,13 @@ class Collaborators extends Component { } } } + + if(user_ids.length===0){ + this.setState({ + useristrue:true + }) + return + } let url = "/shixuns/" + id + "/shixun_members_added.json"; axios.post(url, { user_ids: user_ids @@ -405,7 +423,8 @@ class Collaborators extends Component { collaboratorListsum, collaboratorListsumtype, user_name, - school_name + school_name, + useristrue } = this.state; let {loadingContent} = this.props; const radioStyle = { @@ -547,7 +566,7 @@ class Collaborators extends Component {
- + {useristrue===true?请先选择用户:""}
this.CollaboratorsshowModal("cooperation")}>取消