|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
import React, { Component } from 'react';
|
|
|
|
|
|
|
|
|
|
import { SnackbarHOC, getImageUrl, City, ConditionToolTip } from 'educoder';
|
|
|
|
|
import { Form, Button, Input, Radio, Select, Tooltip, Icon } from 'antd'
|
|
|
|
|
import { Form, Button, Input, Radio, Select, Tooltip, Icon, AutoComplete } from 'antd'
|
|
|
|
|
import ApplyForAddOrgModal from '../modal/ApplyForAddOrgModal'
|
|
|
|
|
import ApplyForAddChildOrgModal from '../modal/ApplyForAddChildOrgModal'
|
|
|
|
|
import axios from 'axios'
|
|
|
|
@ -70,28 +70,44 @@ class AccountBasic extends Component {
|
|
|
|
|
job2:basicInfo && basicInfo.identity=="professional" ? basicInfo.technical_title:"企业管理者",
|
|
|
|
|
})
|
|
|
|
|
}, 100)
|
|
|
|
|
|
|
|
|
|
//if(basicInfo.nickname){
|
|
|
|
|
this.setState({
|
|
|
|
|
forDisable: true,
|
|
|
|
|
nameLength:basicInfo.nickname?basicInfo.nickname.length:0,
|
|
|
|
|
showRealName:basicInfo.show_realname,
|
|
|
|
|
realName: basicInfo.name,
|
|
|
|
|
identity:basicInfo.identity
|
|
|
|
|
identity:basicInfo.identity,
|
|
|
|
|
school_id:basicInfo.school_id,
|
|
|
|
|
department_id:basicInfo.department_id
|
|
|
|
|
})
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取学校、单位
|
|
|
|
|
getSchoolList=(basicInfo)=>{
|
|
|
|
|
getSchoolList=(basicInfo, selectedName)=>{
|
|
|
|
|
let url=`/schools/for_option.json`;
|
|
|
|
|
axios.get(url).then((result)=>{
|
|
|
|
|
if(result){
|
|
|
|
|
this.setState({
|
|
|
|
|
schoolList:result.data.schools
|
|
|
|
|
})
|
|
|
|
|
if(basicInfo && basicInfo.school_name){
|
|
|
|
|
if (selectedName) {
|
|
|
|
|
let school_id
|
|
|
|
|
result.data.schools.reverse().some( item => {
|
|
|
|
|
if (item.name == selectedName) {
|
|
|
|
|
school_id = item.id
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.props.form.setFieldsValue({
|
|
|
|
|
org: selectedName
|
|
|
|
|
})
|
|
|
|
|
this.setState({
|
|
|
|
|
school_id,
|
|
|
|
|
school: selectedName
|
|
|
|
|
})
|
|
|
|
|
} else if(basicInfo && basicInfo.school_name){
|
|
|
|
|
this.setState({
|
|
|
|
|
school:basicInfo.school_name,
|
|
|
|
|
filterSchoolList:this.state.schoolList.filter(function(item){
|
|
|
|
@ -119,6 +135,15 @@ class AccountBasic extends Component {
|
|
|
|
|
console.log(values);
|
|
|
|
|
let {basicInfo}=this.props;
|
|
|
|
|
if(!err ){
|
|
|
|
|
if (!this.state.school_id) {
|
|
|
|
|
this.props.showNotification('请先选择学校/单位')
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!this.state.department_id) {
|
|
|
|
|
this.props.showNotification('请先选择院系/部门')
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let url=`/users/accounts/${basicInfo.id}.json`
|
|
|
|
|
axios.put((url),{
|
|
|
|
|
nickname:values.nickname,
|
|
|
|
@ -187,6 +212,10 @@ class AccountBasic extends Component {
|
|
|
|
|
school:e,
|
|
|
|
|
filterSchoolList:arr
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
this.setState({
|
|
|
|
|
school: '',
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
// else{
|
|
|
|
|
// let {school}=this.state;
|
|
|
|
@ -208,17 +237,30 @@ class AccountBasic extends Component {
|
|
|
|
|
filterDepartments:arr,
|
|
|
|
|
departmentsName:e
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
this.setState({
|
|
|
|
|
filterDepartments: this.state.departments
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 选择部门、学院
|
|
|
|
|
changeDepartment=(e)=>{
|
|
|
|
|
let arr= this.state.departments && this.state.departments.filter ? 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;
|
|
|
|
|
}) : [];
|
|
|
|
|
if (!arr[0]) {
|
|
|
|
|
this.setState({
|
|
|
|
|
department_id: '',
|
|
|
|
|
departmentsName: e,
|
|
|
|
|
})
|
|
|
|
|
this.this_department_id = ''
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.this_department_id = arr[0].id
|
|
|
|
|
this.setState({
|
|
|
|
|
departmentsName:e,
|
|
|
|
|
department_id:arr[0].id
|
|
|
|
|
department_id: arr[0].id
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -231,20 +273,58 @@ class AccountBasic extends Component {
|
|
|
|
|
let arr=this.state.schoolList.filter(function(item){
|
|
|
|
|
return item.name == e;
|
|
|
|
|
});
|
|
|
|
|
if (!arr[0]) {
|
|
|
|
|
// 没找到学校,清空部门
|
|
|
|
|
this.setState({
|
|
|
|
|
departments: [],
|
|
|
|
|
filterDepartments: [],
|
|
|
|
|
departmentsName: '',
|
|
|
|
|
school_id: '',
|
|
|
|
|
department_id: '',
|
|
|
|
|
})
|
|
|
|
|
this.this_school_id = ''
|
|
|
|
|
this.props.form.setFieldsValue({
|
|
|
|
|
org2: ''
|
|
|
|
|
})
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.props.form.setFieldsValue({
|
|
|
|
|
org: arr[0].name
|
|
|
|
|
})
|
|
|
|
|
this.filterList(e)
|
|
|
|
|
// 保存选择的学校id
|
|
|
|
|
this.this_school_id = arr[0].id
|
|
|
|
|
this.setState({
|
|
|
|
|
school_id:arr[0].id,
|
|
|
|
|
school_id: arr[0].id,
|
|
|
|
|
school:e,
|
|
|
|
|
})
|
|
|
|
|
let url=`/schools/${arr[0].id}/departments/for_option.json`;
|
|
|
|
|
this._getDepartments(arr[0].id, flag)
|
|
|
|
|
}
|
|
|
|
|
_getDepartments = (schoolId, flag, selectedName) => {
|
|
|
|
|
let url=`/schools/${schoolId || this.state.school_id}/departments/for_option.json`;
|
|
|
|
|
axios.get(url).then((result)=>{
|
|
|
|
|
if(result){
|
|
|
|
|
this.setState({
|
|
|
|
|
departments:result.data.departments,
|
|
|
|
|
filterDepartments:result.data.departments
|
|
|
|
|
})
|
|
|
|
|
// 切换学校后,部门默认选择第一个
|
|
|
|
|
if(result.data.departments && result.data.departments.length>0 && flag==true){
|
|
|
|
|
if (selectedName) {
|
|
|
|
|
let department_id
|
|
|
|
|
result.data.departments.reverse().some( item => {
|
|
|
|
|
if (item.name == selectedName) {
|
|
|
|
|
department_id = item.id
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.props.form.setFieldsValue({
|
|
|
|
|
org2: selectedName
|
|
|
|
|
})
|
|
|
|
|
this.setState({
|
|
|
|
|
department_id,
|
|
|
|
|
// school: selectedName
|
|
|
|
|
})
|
|
|
|
|
} else if(result.data.departments && result.data.departments.length>0 && flag==true){
|
|
|
|
|
// 切换学校后,部门默认选择第一个
|
|
|
|
|
this.props.form.setFieldsValue({
|
|
|
|
|
org2:result.data.departments[0].name
|
|
|
|
|
})
|
|
|
|
@ -273,6 +353,23 @@ class AccountBasic extends Component {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addOrgSuccess = (name) => {
|
|
|
|
|
// const schoolList = this.state.schoolList.slice(0)
|
|
|
|
|
// schoolList.push({ id: schoolList.length + 2000, name: name})
|
|
|
|
|
// this.setState({ schoolList })
|
|
|
|
|
|
|
|
|
|
this.getSchoolList(this.props.basicInfo, name);
|
|
|
|
|
|
|
|
|
|
this.props.form.setFieldsValue({
|
|
|
|
|
name: name
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addChildOrgSuccess = (deptName) => {
|
|
|
|
|
|
|
|
|
|
this._getDepartments(this.state.school_id, false, deptName);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
showApplyForAddOrgModal = () => {
|
|
|
|
|
this.applyForAddOrgForm.setVisible(true)
|
|
|
|
@ -309,19 +406,22 @@ class AccountBasic extends Component {
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
<ApplyForAddOrgModal ref="applyForAddOrgModal" wrappedComponentRef={(form) => this.applyForAddOrgForm = form} schoolName={school}
|
|
|
|
|
{...propsWithoutForm}></ApplyForAddOrgModal>
|
|
|
|
|
{...propsWithoutForm} addOrgSuccess={this.addOrgSuccess}
|
|
|
|
|
></ApplyForAddOrgModal>
|
|
|
|
|
<ApplyForAddChildOrgModal ref="applyForAddChildOrgModal" schoolName={school} schoolId={school_id} departmentName={departmentsName}
|
|
|
|
|
{...propsWithoutForm} wrappedComponentRef={(form) => this.applyForAddChildOrgForm = form} ></ApplyForAddChildOrgModal>
|
|
|
|
|
{...propsWithoutForm} wrappedComponentRef={(form) => this.applyForAddChildOrgForm = form}
|
|
|
|
|
addChildOrgSuccess={this.addChildOrgSuccess}
|
|
|
|
|
></ApplyForAddChildOrgModal>
|
|
|
|
|
|
|
|
|
|
<div className="basicForm">
|
|
|
|
|
<div className="basicForm courseNormalForm">
|
|
|
|
|
<style>{`
|
|
|
|
|
.formItemInline {
|
|
|
|
|
display: flex;
|
|
|
|
|
margin-bottom: 20px;
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
position:relative;
|
|
|
|
|
}
|
|
|
|
|
.formItemInline .ant-form-explain{
|
|
|
|
|
position:absolute;
|
|
|
|
|
/* position:absolute;*/
|
|
|
|
|
bottom:-20px;
|
|
|
|
|
left:0px;
|
|
|
|
|
width:100%;
|
|
|
|
@ -349,9 +449,7 @@ class AccountBasic extends Component {
|
|
|
|
|
.basicForm .cancelBtn {
|
|
|
|
|
margin-left: 0px;
|
|
|
|
|
}
|
|
|
|
|
.basicForm .ant-input-lg {
|
|
|
|
|
height: 32px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.basicForm .ant-form-item-label {
|
|
|
|
|
width: 100px;
|
|
|
|
|
padding-right: 10px;
|
|
|
|
@ -365,6 +463,10 @@ class AccountBasic extends Component {
|
|
|
|
|
.resetCityStyle .ant-form-item-control{
|
|
|
|
|
width:220px;
|
|
|
|
|
}
|
|
|
|
|
.basicForm .ant-input-suffix {
|
|
|
|
|
line-height: 2.2;
|
|
|
|
|
background: transparent !important;
|
|
|
|
|
}
|
|
|
|
|
`}</style>
|
|
|
|
|
<div className="title">基本信息</div>
|
|
|
|
|
|
|
|
|
@ -473,6 +575,7 @@ class AccountBasic extends Component {
|
|
|
|
|
<Form.Item
|
|
|
|
|
label=""
|
|
|
|
|
className="formItemInline fl"
|
|
|
|
|
style={{ 'margin-top': '3px'}}
|
|
|
|
|
// style={{display:identity && identity=="student" ? "block":"none"}}
|
|
|
|
|
>
|
|
|
|
|
{getFieldDecorator('student_No', {
|
|
|
|
@ -544,28 +647,40 @@ class AccountBasic extends Component {
|
|
|
|
|
// type: 'array',
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请先选择学校/单位',
|
|
|
|
|
|
|
|
|
|
// 做不了,输入时和submit时都会执行这里
|
|
|
|
|
// validator: (rule, value, callback) => {
|
|
|
|
|
// if (this.this_school_id) {
|
|
|
|
|
// callback();
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// callback('请先选择学校/单位');
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
}],
|
|
|
|
|
})(
|
|
|
|
|
<Select width={400} showSearch onSearch={this.filterList} onChange={this.changeList}>
|
|
|
|
|
<AutoComplete width={400} showSearch onSearch={this.filterList} onChange={this.changeList}>
|
|
|
|
|
{
|
|
|
|
|
filterSchoolList && filterSchoolList.map((item,key)=>{
|
|
|
|
|
return(<Option value={item.name} key={item.id}>{item.name}</Option>)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
</Select>
|
|
|
|
|
</AutoComplete>
|
|
|
|
|
)}
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<div style={{marginLeft: '100px',height:"20px",lineHeight:"20px"}}>
|
|
|
|
|
{!filterSchoolList || (filterSchoolList && filterSchoolList.length==0 )&&
|
|
|
|
|
<span>
|
|
|
|
|
<span style={{color: '#CDCDCD'}}>未找到包含“{school}”的高校,</span>
|
|
|
|
|
<span style={{color: '#4CACFF', cursor: 'pointer'}} onClick={this.showApplyForAddOrgModal}>申请新增</span>
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
{!filterSchoolList || (filterSchoolList && filterSchoolList.length==0 )&& school &&
|
|
|
|
|
<div style={{marginLeft: '100px',height:"20px",lineHeight:"20px"}}>
|
|
|
|
|
<span>
|
|
|
|
|
<span style={{color: '#CDCDCD'}}>未找到包含“{school}”的高校,</span>
|
|
|
|
|
<span style={{color: '#4CACFF', cursor: 'pointer'}} onClick={this.showApplyForAddOrgModal}>申请新增</span>
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
<Form.Item
|
|
|
|
|
label="院系/部门"
|
|
|
|
|
className="formItemInline mb0"
|
|
|
|
|
style={{ 'margin-top': '10px'}}
|
|
|
|
|
>
|
|
|
|
|
{getFieldDecorator('org2', {
|
|
|
|
|
rules: [{
|
|
|
|
@ -573,9 +688,16 @@ class AccountBasic extends Component {
|
|
|
|
|
// type: 'array',
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请先选择院系/部门',
|
|
|
|
|
// validator: (rule, value, callback) => {
|
|
|
|
|
// if (this.this_department_id) {
|
|
|
|
|
// callback();
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// callback('请先选择院系/部门');
|
|
|
|
|
// }
|
|
|
|
|
}],
|
|
|
|
|
})(
|
|
|
|
|
<Select width={400} showSearch onSearch={this.searchDepartment} onChange={this.changeDepartment}>
|
|
|
|
|
<AutoComplete width={400} showSearch onSearch={this.searchDepartment} onChange={this.changeDepartment}>
|
|
|
|
|
{
|
|
|
|
|
filterDepartments && filterDepartments.map((item,key)=>{
|
|
|
|
|
return(
|
|
|
|
@ -583,18 +705,20 @@ class AccountBasic extends Component {
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
</Select>
|
|
|
|
|
</AutoComplete>
|
|
|
|
|
)}
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<div style={{marginLeft: '100px',height:"20px",lineHeight:"20px"}}>
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
!filterDepartments || (filterDepartments && filterDepartments.length==0 )&&
|
|
|
|
|
<span>
|
|
|
|
|
<span style={{color: '#CDCDCD'}}>未找到包含“{departmentsName}”的院系/部门,</span>
|
|
|
|
|
<span style={{color: '#4CACFF', cursor: 'pointer'}} onClick={this.showApplyForAddChildOrgModal}>申请新增</span>
|
|
|
|
|
</span>
|
|
|
|
|
!filterDepartments || (filterDepartments && filterDepartments.length==0 )&& departmentsName &&
|
|
|
|
|
<div style={{marginLeft: '100px',height:"20px",lineHeight:"20px"}}>
|
|
|
|
|
<span>
|
|
|
|
|
<span style={{color: '#CDCDCD'}}>未找到包含“{departmentsName}”的院系/部门,</span>
|
|
|
|
|
<span style={{color: '#4CACFF', cursor: 'pointer'}} onClick={this.showApplyForAddChildOrgModal}>申请新增</span>
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{/* htmlType="submit" */}
|
|
|
|
|
{/* <Form.Item>
|
|
|
|
@ -607,7 +731,7 @@ class AccountBasic extends Component {
|
|
|
|
|
</Form.Item> */}
|
|
|
|
|
</Form>
|
|
|
|
|
</div>
|
|
|
|
|
<div style={{color: '#989898', marginLeft: '20px'}}>* 我们确保你所提供的信息均处于严格保密状态,不会泄露</div>
|
|
|
|
|
<div style={{color: '#989898', marginLeft: '20px', marginBottom: '10px'}}>* 我们确保你所提供的信息均处于严格保密状态,不会泄露</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|