import React from 'react'; import { Input, Button, Form, Select, Icon, Spin, InputNumber, Tag, message, Cascader } from 'antd'; import './tech.less'; import ajax from 'jquery/src/ajax/xhr.js'; import $ from 'jquery/src/ajax'; import { techFieldList } from '../../DicTechFieldList'; const TechFrom = Form.create()(React.createClass({ getInitialState() { return { loading: false, techzoneArr: [], havetechzone: [], skillArr: [], haveskill: [] }; }, getData() { this.props.spinState(true); $.ajax({ method: "get", dataType: "json", url: globalConfig.context + "/api/user/job", success: function (data) { if (data.data) { this.setState({ id: data.data.id, techpeople: data.data.technicalPeopleNum, techField: data.data.searchAreaCategory ? data.data.searchAreaCategory.split(",") : [], haveskill: data.data.specialty ? data.data.specialty.split(",") : [] }); }; }.bind(this), }).always(function () { this.props.spinState(false); }.bind(this)); }, componentWillMount() { this.getData(); }, handleSubmit(e) { e.preventDefault(); let specialty = this.state.haveskill.join(","); this.props.form.validateFields((err, values) => { if (!err) { this.props.spinState(true); $.ajax({ method: "POST", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/user/orgTech", data: { "id": this.state.id, "technicalPeopleNum": values.techpeople, "searchAreaCategory": values.techField ? values.techField.join(',') : '', "specialty": specialty } }).done(function (data) { if (!data.error.length) { message.success('保存成功!'); this.getData(); } else { message.warning(data.error[0].message); } }.bind(this)).always(function () { this.props.spinState(false); }.bind(this)); } }); }, addskill(e) { let _me = this; let theSkillArr = _me.state.haveskill; let theskill = _me.props.form.getFieldValue('skill'); if (theskill !== undefined) { if (_me.state.haveskill.length > 0) { let thebool = true; _me.state.haveskill.map(function (item, i) { if (item === theskill) { thebool = false }; }); if (thebool) { theSkillArr = _me.state.haveskill.concat(theskill); } } else if (_me.state.haveskill.length === 0) { theSkillArr = _me.state.haveskill.concat(theskill); }; this.setState({ haveskill: theSkillArr }); }; }, deleteskill(e) { let _me = this.state; _me.haveskill.map(function (item, i) { if (item === e) { _me.haveskill.splice(i, 1); } }); }, render() { const FormItem = Form.Item; const Option = Select.Option; const { getFieldDecorator } = this.props.form; const formItemLayout = { labelCol: { span: 4 }, wrapperCol: { span: 12 }, }; const _me = this; return (
{getFieldDecorator('techpeople', { initialValue: this.state.techpeople })( )} {getFieldDecorator('techField', { initialValue: this.state.techField })( )} {getFieldDecorator('skill')(
擅长 的研究
)}
{ this.state.haveskill.map(function (item, i) { return {item} }.bind(this)) }
); }, })); const Person = React.createClass({ getInitialState() { return { loading: false }; }, spinChange(e) { this.setState({ loading: e }); }, render() { return (

完善研究领域与擅长能力可加入平台专家,承接技术难题!

) } }); export default Person;