From d7a4b99380838e5c8d11b059432e0e8294524ab1 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Tue, 23 Jul 2019 12:02:18 +0800 Subject: [PATCH] filter --- public/react/src/modules/user/account/AccountBasicEdit.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/user/account/AccountBasicEdit.js b/public/react/src/modules/user/account/AccountBasicEdit.js index 432673bd2..8af24022d 100644 --- a/public/react/src/modules/user/account/AccountBasicEdit.js +++ b/public/react/src/modules/user/account/AccountBasicEdit.js @@ -201,7 +201,7 @@ class AccountBasic extends Component { this.props.form.setFieldsValue({ org2:e }) - let arr = this.state.departments ? this.state.departments.filter(function(item){ + let arr = this.state.departments && this.state.departments.filter ? this.state.departments.filter(function(item){ return item.name.indexOf(e) > -1 }) : [] this.setState({ @@ -213,9 +213,9 @@ class AccountBasic extends Component { // 选择部门、学院 changeDepartment=(e)=>{ - let arr=this.state.departments.filter(function(item){ + let arr= this.state.departments && this.state.departments.filter ? this.state.departments.filter(function(item){ return item.name == e; - }); + }) : []; this.setState({ departmentsName:e, department_id:arr[0].id