dev_forum
hjm 5 years ago
parent 7d9d2581d7
commit 3e64817168

@ -1719,6 +1719,10 @@ const options = [{
label: '其他'
}],
}];
function filter(inputValue, path) {
return path.some(option => option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1);
}
class City extends Component{
constructor(props){
super(props);
@ -1739,11 +1743,16 @@ class City extends Component{
}
}
render(){
const { defaultValue } = this.props
const { defaultValue, matchInputWidth, className, popupClassName } = this.props
const { value } = this.state
// 这里用请选择所在省市的话会触发chrome的地址选择
return(
<Cascader allowClear size="large" options={options} placeholder="请选择所在省市" onChange={this.onChange}
<Cascader allowClear size="large" options={options} placeholder="请选择所在地" onChange={this.onChange}
matchInputWidth={matchInputWidth}
value={value}
showSearch={{ filter }}
className={className}
popupClassName={popupClassName}
></Cascader>
)
}

@ -110,11 +110,7 @@ class AccountBasic extends Component {
this.props.form.validateFieldsAndScroll((err, values) => {
console.log(values);
let {basicInfo}=this.props;
// TODO 为什么modal里的form影响到这里的了
if (err) {
delete err.depart
}
if(!err || Object.keys(err).length == 0){
if(!err ){
let url=`/users/accounts/${basicInfo.id}.json`
axios.put((url),{
nickname:values.nickname,
@ -202,16 +198,18 @@ class AccountBasic extends Component {
}
//搜索部门
searchDepartment=(e)=>{
this.props.form.setFieldsValue({
org2:e
})
let arr = this.state.departments.filter(function(item){
return item.name.indexOf(e) > -1
})
this.setState({
filterDepartments:arr,
departmentsName:e
})
if (e) {
this.props.form.setFieldsValue({
org2:e
})
let arr = this.state.departments.filter(function(item){
return item.name.indexOf(e) > -1
})
this.setState({
filterDepartments:arr,
departmentsName:e
})
}
}
// 选择部门、学院
@ -306,12 +304,15 @@ class AccountBasic extends Component {
const { getFieldDecorator } = this.props.form;
let{basicInfo}=this.props
// form合并了
const propsWithoutForm = Object.assign({}, this.props)
delete propsWithoutForm.form
return (
<div>
<ApplyForAddOrgModal ref="applyForAddOrgModal" wrappedComponentRef={(form) => this.applyForAddOrgForm = form} schoolName={school}
{...this.props}></ApplyForAddOrgModal>
{...propsWithoutForm}></ApplyForAddOrgModal>
<ApplyForAddChildOrgModal ref="applyForAddChildOrgModal" schoolName={school} schoolId={school_id} departmentName={departmentsName}
{...this.props} wrappedComponentRef={(form) => this.applyForAddChildOrgForm = form} ></ApplyForAddChildOrgModal>
{...propsWithoutForm} wrappedComponentRef={(form) => this.applyForAddChildOrgForm = form} ></ApplyForAddChildOrgModal>
<div className="basicForm">
<style>{`

@ -40,9 +40,9 @@ class ApplyForAddOrgModal extends Component{
if(!err){
let url=`/add_school_applies.json`;
axios.post(url,{
schoolName:values.name,
province:values.city[0],
city:values.city[1],
schoolName:values.schoolName,
province:values.city && values.city[0],
city:values.city && values.city[1],
address:values.address,
remarks:values.remarks
}).then((result)=>{
@ -95,6 +95,10 @@ class ApplyForAddOrgModal extends Component{
.explain .ant-form-explain{
top:36px;
}
.addOrg ul.ant-cascader-menu {
width: 196px;
}
`}</style>
<Form onSubmit={this.onOk}>
<Form.Item
@ -132,7 +136,7 @@ class ApplyForAddOrgModal extends Component{
{getFieldDecorator('city', {
rules: [],
})(
<City ></City>
<City matchInputWidth={true} popupClassName={"addOrg"}></City>
)}
</Form.Item>

Loading…
Cancel
Save