diff --git a/src/pages/system/station/main.js b/src/pages/system/station/main.js index 2316e991..d985a7da 100644 --- a/src/pages/system/station/main.js +++ b/src/pages/system/station/main.js @@ -43,11 +43,14 @@ export default class station extends React.Component{ if(placeholder=='公司'){ this.setState({'companyBtn':true,companyName:1}); this.getCompanyFn(); - this.getDepartmentFn(this.state.company_id); + this.getDepartmentFn(this.state.companyName); }else if(placeholder=='部门'){ this.setState({'departmentBtn':true}); - this.getDepartmentFn(this.state.company_id); - this.getDepartmentJobFn(this.state.departmentName); + this.getDepartmentFn(this.state.companyName); + if(this.state.departmentName){ + this.getDepartmentJobFn(this.state.departmentName); + } + }else if(placeholder=='岗位'){ this.setState({'postBtn':true}); @@ -127,6 +130,11 @@ export default class station extends React.Component{ }); }else if(placeholder=='部门'){ + if(!this.state.companyName){ + Notify.clear() + Notify.error('请选择归属公司'); + return false; + } let dinfo={ department_name:iptval, company_id:this.state.companyName @@ -145,6 +153,11 @@ export default class station extends React.Component{ }).catch(err=>{ }); }else if(placeholder=='岗位'){ + if(!this.state.departmentName){ + Notify.clear() + Notify.error('请选择归属部门'); + return false; + } let pinfo={ job_name:iptval, department_id:this.state.departmentName @@ -474,14 +487,25 @@ export default class station extends React.Component{ this.setState({departmentData:[]}); this.setState({post:[]}); this.setState({companyName:null}); + }else if(disbtn=='departmentBtn'){ flag=this.state.departmentBtn; place="部门" this.setState({post:[]}); this.setState({departmentName:null}); + if(!this.state.companyName){ + Notify.clear(); + Notify.warn('请先补全公司信息!'); + return; + } }else if(disbtn=='postBtn'){ flag=this.state.postBtn; place="岗位" + if(!this.state.departmentName){ + Notify.clear(); + Notify.warn('请先补全归属部门信息!'); + return; + } } if(flag){ if( place=="岗位"&&this.state.departmentData.length<1){ @@ -495,7 +519,7 @@ export default class station extends React.Component{ let addipt=document.createElement('div'); addipt.className=disbtn+" newitem"; addipt.innerHTML=` - +

取消保存

`; nextDom.appendChild(addipt); @@ -578,7 +602,7 @@ export default class station extends React.Component{ } ) - }):
暂无数据,请添加吧!
+ }):(this.state.departmentName?
暂无数据,请添加吧!
:null) }