import React from 'react'; import { Spin, Form, Button, Select } from 'antd'; import ajax from 'jquery/src/ajax/xhr.js' import $ from 'jquery/src/ajax'; import { political, technical, market, capital, management } from './dict.js'; const FormItem = Form.Item; const Option = Select.Option; const formItemLayout = { labelCol: { span: 4 }, wrapperCol: { span: 10 }, }; const EvaluateStep7 = Form.create({})(React.createClass({ getInitialState() { return { loading: false, initialData: {} }; }, componentWillMount() { this.state.initialData = this.props.data || {}; }, next() { if (this.state.loading) { return; } this.props.form.validateFields((err, values) => { if (!err) { this.setState({ loading: true }) values.id = this.props.id; $.ajax({ url: globalConfig.context + '/api/user/evaluate/step7', method: 'post', data: values }).done(function (res) { if (res.error && res.error.length) { message.error(res.error[0].message) } else { if (this.props.next) { this.props.next(values); } } }.bind(this)).fail(function () { this.setState({ loading: false }) }.bind(this)); } }); }, prev() { if (this.props.prev) { this.props.prev(); } }, stringify(val) { return val && String(val) }, render() { let { loading, initialData } = this.state; const { getFieldDecorator } = this.props.form; return (
项目整体获利情况受政策、技术、市场、资金、管理等影响。
{getFieldDecorator('political', { rules: [{ required: true, message: '请选择政策风险!' }], initialValue: this.stringify(initialData.political) })( )} {getFieldDecorator('technical', { rules: [{ required: true, message: '请选择技术风险!' }], initialValue: this.stringify(initialData.technical) })( )} {getFieldDecorator('market', { rules: [{ required: true, message: '请选择市场风险!' }], initialValue: this.stringify(initialData.market) })( )} {getFieldDecorator('capital', { rules: [{ required: true, message: '请选择资金风险!' }], initialValue: this.stringify(initialData.capital) })( )} {getFieldDecorator('management', { rules: [{ required: true, message: '请选择管理风险!' }], initialValue: this.stringify(initialData.management) })( )}
) }, })); export default EvaluateStep7;