import React from 'react'; import { Input, InputNumber, Button, Form, Icon, Spin, message, Tabs, Upload } from 'antd'; import { beforeUpload } from '../../tools.js'; import './person.less'; import './hrSituation.less' import ajax from 'jquery/src/ajax/xhr.js' import $ from 'jquery/src/ajax'; const PersonFrom = Form.create()(React.createClass({ getData() { this.props.spinState(true); $.ajax({ method: "get", dataType: "json", url: globalConfig.context + "/api/user/humanResource", data: { year: this.props.year }, success: function (data) { if (data.data) { this.setState({ aboveFifty: data.data.aboveFifty, belowThirty: data.data.belowThirty, college: data.data.college, doctor: data.data.doctor, firmAbroad: data.data.firmAbroad, firmCore: data.data.firmCore, firmForeign: data.data.firmForeign, firmInService: data.data.firmInService, firmPartTime: data.data.firmPartTime, firmTemporary: data.data.firmTemporary, firmTotal: data.data.firmTotal, fortyoneToFifty: data.data.fortyoneToFifty, intermediateTitle: data.data.intermediateTitle, juniorTitle: data.data.juniorTitle, master: data.data.master, seniorMechanic: data.data.seniorMechanic, seniorTitle: data.data.seniorTitle, techAbroad: data.data.techAbroad, techCore: data.data.techCore, techForeign: data.data.techForeign, techInService: data.data.techInService, techPartTime: data.data.techPartTime, techTemporary: data.data.techTemporary, techTotal: data.data.techTotal, thirtyoneToThirtyfour: data.data.thirtyoneToThirtyfour, undergraduate: data.data.undergraduate }); } }.bind(this), }).always(function () { this.props.spinState(false); }.bind(this)); }, getInitialState() { return { loading: false }; }, handleSubmit(e) { e.preventDefault(); this.props.form.validateFields((err, values) => { if (values.firmTotal < values.firmInService + values.firmPartTime + values.firmTemporary) { message.warning("总体情况的在职人员数、兼职人员数、临时聘用人员数相加小于等于企业职工总数!"); return; }; if (values.firmTotal < values.techTotal) { message.warning("科技人员数小于等于企业职工总数!"); return; }; if (values.firmInService < values.techInService || values.firmPartTime < values.techPartTime || values.firmTemporary < values.techTemporary || values.firmForeign < values.techForeign || values.firmAbroad < values.techAbroad || values.firmCore < values.techCore) { message.warning("科技人员各项人数小于等于企业职工各项人数!"); return; }; if (values.firmTotal < values.doctor + values.master + values.undergraduate + values.college) { message.warning("全体人员结构中学历一栏人数总和小于等于职工人数!"); return; }; if (values.firmTotal < values.belowThirty + values.thirtyoneToThirtyfour + values.fortyoneToFifty + values.aboveFifty) { message.warning("全体人员结构中年龄一栏人数总和小于等于职工人数!"); return; }; if (!err) { this.props.spinState(true); $.ajax({ method: "POST", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/user/SaveHumanResource", data: { year: this.props.year, aboveFifty: values.aboveFifty, belowThirty: values.belowThirty, college: values.college, doctor: values.doctor, firmAbroad: values.firmAbroad, firmCore: values.firmCore, firmForeign: values.firmForeign, firmInService: values.firmInService, firmPartTime: values.firmPartTime, firmTemporary: values.firmTemporary, firmTotal: values.firmTotal, fortyoneToFifty: values.fortyoneToFifty, intermediateTitle: values.intermediateTitle, juniorTitle: values.juniorTitle, master: values.master, seniorMechanic: values.seniorMechanic, seniorTitle: values.seniorTitle, techAbroad: values.techAbroad, techCore: values.techCore, techForeign: values.techForeign, techInService: values.techInService, techPartTime: values.techPartTime, techTemporary: values.techTemporary, techTotal: values.techTotal, thirtyoneToThirtyfour: values.thirtyoneToThirtyfour, undergraduate: values.undergraduate, rosterUrl: this.state.rosterUrl, socialSecurityUrl: this.state.socialSecurityUrl } }).done(function (data) { if (!data.error.length) { message.success('保存成功!'); } else { message.warning(data.error[0].message); } }.bind(this)).always(function () { this.props.spinState(false); }.bind(this)); } }); }, componentWillMount() { this.getData(); }, render() { const { getFieldDecorator } = this.props.form; const formItemLayout = { labelCol: { span: 8 }, wrapperCol: { span: 16 }, }; const FormItem = Form.Item; return (

总体情况

总数(人) {getFieldDecorator('firmTotal', { initialValue: this.state.firmTotal || null })( )} {getFieldDecorator('techTotal', { initialValue: this.state.techTotal || null })( )} 其中科技人员占比 {(() => { if (!this.props.form.getFieldValue('techTotal') || !this.props.form.getFieldValue('firmTotal')) { return 0 } return (this.props.form.getFieldValue('techTotal') / this.props.form.getFieldValue('firmTotal') * 100).toFixed(2) })()} % 在职人员(人) {getFieldDecorator('firmInService', { initialValue: this.state.firmInService || null })( )} {getFieldDecorator('techInService', { initialValue: this.state.techInService || null })( )} 兼职人员(人) {getFieldDecorator('firmPartTime', { initialValue: this.state.firmPartTime || null })( )} {getFieldDecorator('techPartTime', { initialValue: this.state.techPartTime || null })( )} 临时聘用人员(人) {getFieldDecorator('firmTemporary', { initialValue: this.state.firmTemporary || null })( )} {getFieldDecorator('techTemporary', { initialValue: this.state.techTemporary || null })( )} 外籍人员(人) {getFieldDecorator('firmForeign', { initialValue: this.state.firmForeign || null })( )} {getFieldDecorator('techForeign', { initialValue: this.state.techForeign || null })( )} 留学归国人员(人) {getFieldDecorator('firmAbroad', { initialValue: this.state.firmAbroad || null })( )} {getFieldDecorator('techAbroad', { initialValue: this.state.techAbroad || null })( )} 干人计划人员(人) {getFieldDecorator('firmCore', { initialValue: this.state.firmCore || null })( )} {getFieldDecorator('techCore', { initialValue: this.state.techCore || null })( )}

全体人员结构

学历人数 {getFieldDecorator('doctor', { initialValue: this.state.doctor || null })( )} {getFieldDecorator('master', { initialValue: this.state.master || null })( )} {getFieldDecorator('undergraduate', { initialValue: this.state.undergraduate || null })( )} {getFieldDecorator('college', { initialValue: this.state.college || null })( )}
职称人数 {getFieldDecorator('seniorTitle', { initialValue: this.state.seniorTitle || null })( )} {getFieldDecorator('intermediateTitle', { initialValue: this.state.intermediateTitle || null })( )} {getFieldDecorator('juniorTitle', { initialValue: this.state.juniorTitle || null })( )} {getFieldDecorator('seniorMechanic', { initialValue: this.state.seniorMechanic || null })( )}
年龄人数 {getFieldDecorator('belowThirty', { initialValue: this.state.belowThirty || null })( )} {getFieldDecorator('thirtyoneToThirtyfour', { initialValue: this.state.thirtyoneToThirtyfour || null })( )} {getFieldDecorator('fortyoneToFifty', { initialValue: this.state.fortyoneToFifty || null })( )} {getFieldDecorator('aboveFifty', { initialValue: this.state.aboveFifty || null })( )}
{ if (info.file.status !== 'uploading') { console.log(info.file, info.fileList); } if (info.file.status === 'done') { message.success(`${info.file.name} 文件上传成功!`); this.state.socialSecurityUrl = info.file.response.data; } else if (info.file.status === 'error') { message.error(`${info.file.name} 文件上传失败。`); } }} >
{ if (info.file.status !== 'uploading') { console.log(info.file, info.fileList); } if (info.file.status === 'done') { message.success(`${info.file.name} 文件上传成功!`); this.state.rosterUrl = info.file.response.data; } else if (info.file.status === 'error') { message.error(`${info.file.name} 文件上传失败。`); } }} >
提示

1、总体情况的在职人员数、兼职人员数、临时聘用人员数相加小于等于企业职工总数。

2、科技人员数小于等于企业职工总数。

3、科技人员各项人数小于等于企业职工各项人数。

4、全体人员结构中学历一栏人数总和小于等于职工人数。

5、全体人员结构中年龄一栏人数总和小于等于职工人数。

); }, })); const Person = React.createClass({ getInitialState() { return { loading: false }; }, spinChange(e) { this.setState({ loading: e }); }, render() { const theYear = (new Date()).getFullYear() - 1; return (
) } }); export default Person;