更改岗位bug

This commit is contained in:
red-deng-deng 2021-11-24 17:38:50 +08:00
parent b32506ec68
commit eb135e3457
1 changed files with 20 additions and 0 deletions

View File

@ -38,6 +38,7 @@ export default class adduserinfo extends React.Component{
componentDidMount(e){
}
componentWillMount(){
console.log(this.state);
let _self=this;
let companys=JSON.parse(sessionStorage.getItem('company'));
this.getCompanyFn();//获取公司
@ -192,6 +193,13 @@ export default class adduserinfo extends React.Component{
});
//调部门的数据
if(e){
let model3=this.state.model;
model3.deparment=""
model3.post=""
_self.setState({departmentList:[]});
_self.setState({departmentJob:[]});
_self.setState({model:model3});
getDepartment({company_id:e.key}).then(res=>{
handelResponse(res,(response,msg)=>{
let departmentList=response.map(item=>{
@ -206,6 +214,7 @@ export default class adduserinfo extends React.Component{
});
}else{
_self.setState({departmentList:[]});
_self.setState({departmentJob:[]});
}
};
onDepartmentChange(e){
@ -223,6 +232,7 @@ export default class adduserinfo extends React.Component{
this.setState({
model:model2
});
_self.setState({departmentJob:[]});
if(e){
//调岗位
getDepartmentJob({department_id:e.key}).then(res=>{
@ -231,6 +241,9 @@ export default class adduserinfo extends React.Component{
return {key:item.id,text:item.job_name}
});
_self.setState({departmentJob});
let model3=this.state.model;
model3.post=""
_self.setState({model:model3});
},(err)=>{
})
@ -302,6 +315,13 @@ export default class adduserinfo extends React.Component{
parentComponent: this
});
}
// 监听组件内部状态的变化:
// componentDidUpdate(prevProps,prevState){
// // 参数分别为改变之前的数据状态对象
// if(prevState.department!=this.state.department){
// this.setState({post:{}});
// }
// }
render(){
//校验规则
const rules = {