import React from 'react'; import { Input, InputNumber, Button, Form, Icon, Spin, message, Table, Modal, Upload, Select } from 'antd'; import { beforeUploadFile, newDownloadFile } from '../../tools.js'; import './hrSituation.less' import ajax from 'jquery/src/ajax/xhr.js' import $ from 'jquery/src/ajax'; const HrSituationDescFrom = Form.create()(React.createClass({ getInitialState() { return { loading: false, yearOption: [] }; }, 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 (!this.state.year && !this.props.data.year) { message.warning("请选择一个年份!") return; }; if (!err) { this.props.spinState(true); $.ajax({ method: "POST", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/user/SaveHumanResource", data: { id: this.props.data.id, year: this.state.year || this.props.data.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, newEmployment: values.newEmployment, graduateNumber: values.graduateNumber } }).done(function (data) { if (!data.error.length) { message.success('保存成功!'); this.props.clickOk(); this.props.form.resetFields(); } else { message.warning(data.error[0].message); }; this.props.spinState(false); }.bind(this)); } }); }, componentWillMount() { let d = new Date(); let _me = this; d = d.getFullYear(); for (let i = d; i > d - 20; i--) { _me.state.yearOption.push( {i} ) }; }, componentWillReceiveProps(nextProps) { if (!this.props.visible && nextProps.visible) { this.props.form.resetFields(); this.state.fileList_roster = []; this.state.fileList_social_security = []; this.state.rosterUrl = undefined; this.state.socialSecurityUrl = undefined; }; }, render() { const { getFieldDecorator } = this.props.form; const formItemLayout = { labelCol: { span: 8 }, wrapperCol: { span: 16 }, }; const FormItem = Form.Item; const theData = this.props.data; return (
年份: { this.props.data.year ? {this.props.data.year} : }

总体情况

总数(人) {getFieldDecorator('firmTotal', { initialValue: this.props.data.firmTotal || 0 })( )} {getFieldDecorator('techTotal', { initialValue: this.props.data.techTotal || 0 })( )} 其中科技人员占比 {(() => { 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.props.data.firmInService || 0 })( )} {getFieldDecorator('techInService', { initialValue: this.props.data.techInService || 0 })( )} 兼职人员(人) {getFieldDecorator('firmPartTime', { initialValue: this.props.data.firmPartTime || 0 })( )} {getFieldDecorator('techPartTime', { initialValue: this.props.data.techPartTime || 0 })( )} 临时聘用人员(人) {getFieldDecorator('firmTemporary', { initialValue: this.props.data.firmTemporary || 0 })( )} {getFieldDecorator('techTemporary', { initialValue: this.props.data.techTemporary || 0 })( )} 外籍人员(人) {getFieldDecorator('firmForeign', { initialValue: this.props.data.firmForeign || 0 })( )} {getFieldDecorator('techForeign', { initialValue: this.props.data.techForeign || 0 })( )} 留学归国人员(人) {getFieldDecorator('firmAbroad', { initialValue: this.props.data.firmAbroad || 0 })( )} {getFieldDecorator('techAbroad', { initialValue: this.props.data.techAbroad || 0 })( )} 干人计划人员(人) {getFieldDecorator('firmCore', { initialValue: this.props.data.firmCore || 0 })( )} {getFieldDecorator('techCore', { initialValue: this.props.data.techCore || 0 })( )}

全体人员结构

学历人数 {getFieldDecorator('doctor', { initialValue: this.props.data.doctor || 0 })( )} {getFieldDecorator('master', { initialValue: this.props.data.master || 0 })( )} {getFieldDecorator('undergraduate', { initialValue: this.props.data.undergraduate || 0 })( )} {getFieldDecorator('college', { initialValue: this.props.data.college || 0 })( )}
职称人数 {getFieldDecorator('seniorTitle', { initialValue: this.props.data.seniorTitle || 0 })( )} {getFieldDecorator('intermediateTitle', { initialValue: this.props.data.intermediateTitle || 0 })( )} {getFieldDecorator('juniorTitle', { initialValue: this.props.data.juniorTitle || 0 })( )} {getFieldDecorator('seniorMechanic', { initialValue: this.props.data.seniorMechanic || 0 })( )}
年龄人数 {getFieldDecorator('belowThirty', { initialValue: this.props.data.belowThirty || 0 })( )} {getFieldDecorator('thirtyoneToThirtyfour', { initialValue: this.props.data.thirtyoneToThirtyfour || 0 })( )} {getFieldDecorator('fortyoneToFifty', { initialValue: this.props.data.fortyoneToFifty || 0 })( )} {getFieldDecorator('aboveFifty', { initialValue: this.props.data.aboveFifty || 0 })( )}

每年新增员工数

{getFieldDecorator('newEmployment', { initialValue: this.props.data.newEmployment || 0 })( )} {getFieldDecorator('graduateNumber', { initialValue: this.props.data.graduateNumber || 0 })( )}
{ if (info.file.status !== 'uploading') { // console.log(info.file, info.fileList); } if (info.file.status === 'done') { if (!info.file.response.error.length) { message.success(`${info.file.name} 文件上传成功!`); } else { message.warning(info.file.response.error[0].message); return; }; this.state.rosterUrl = info.file.response.data; } else if (info.file.status === 'error') { message.error(`${info.file.name} 文件上传失败。`); }; this.setState({ fileList_roster: info.fileList.slice(-1) }); }} >

{theData.rosterUrl ? {theData.rosterDownloadFileName} : 未上传!}

{ if (info.file.status !== 'uploading') { // console.log(info.file, info.fileList); } if (info.file.status === 'done') { if (!info.file.response.error.length) { message.success(`${info.file.name} 文件上传成功!`); } else { message.warning(info.file.response.error[0].message); return; }; this.state.socialSecurityUrl = info.file.response.data; } else if (info.file.status === 'error') { message.error(`${info.file.name} 文件上传失败。`); }; this.setState({ fileList_social_security: info.fileList.slice(-1) }); }} >

{theData.socialSecurityUrl ? {theData.socialSecurityDownloadFileName} : 未上传!}

提示

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

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

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

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

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

); }, })); const HrSituationDesc = React.createClass({ getInitialState() { return { visible: false, loading: false }; }, componentWillReceiveProps(nextProps) { this.state.visible = nextProps.showDesc }, showModal() { this.setState({ visible: true, }); }, handleOk() { this.setState({ visible: false, }); this.props.closeDesc(false, true); }, handleCancel(e) { this.setState({ visible: false, }); this.props.closeDesc(false); }, spinChange(e) { this.setState({ loading: e }); }, render() { return (
); }, }); const HrSituation = React.createClass({ loadData(pageNo) { this.state.data = []; this.setState({ loading: true }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/user/humanResource", data: { pageNo: pageNo || 1, pageSize: this.state.pagination.pageSize } }).done((data) => { if (!data.data) { if (data.error && data.error.length) { message.warning(data.error[0].message); this.state.ButtonDisabled = true; } return; }; for (let i = 0; i < data.data.list.length; i++) { let thisdata = data.data.list[i]; this.state.data.push({ key: i, id: thisdata.id, uid: thisdata.uid, year: thisdata.year, aboveFifty: thisdata.aboveFifty, belowThirty: thisdata.belowThirty, college: thisdata.college, doctor: thisdata.doctor, firmAbroad: thisdata.firmAbroad, firmCore: thisdata.firmCore, firmForeign: thisdata.firmForeign, firmInService: thisdata.firmInService, firmPartTime: thisdata.firmPartTime, firmTemporary: thisdata.firmTemporary, firmTotal: thisdata.firmTotal, fortyoneToFifty: thisdata.fortyoneToFifty, intermediateTitle: thisdata.intermediateTitle, juniorTitle: thisdata.juniorTitle, master: thisdata.master, seniorMechanic: thisdata.seniorMechanic, seniorTitle: thisdata.seniorTitle, techAbroad: thisdata.techAbroad, techCore: thisdata.techCore, techForeign: thisdata.techForeign, techInService: thisdata.techInService, techPartTime: thisdata.techPartTime, techTemporary: thisdata.techTemporary, techTotal: thisdata.techTotal, thirtyoneToThirtyfour: thisdata.thirtyoneToThirtyfour, undergraduate: thisdata.undergraduate, rosterUrl: thisdata.rosterUrl, rosterDownloadFileName: thisdata.rosterDownloadFileName, socialSecurityUrl: thisdata.socialSecurityUrl, socialSecurityDownloadFileName: thisdata.socialSecurityDownloadFileName, attachment: [thisdata.id, thisdata.rosterDownloadFileName, thisdata.socialSecurityDownloadFileName], newEmployment: thisdata.newEmployment, graduateNumber: thisdata.graduateNumber }); }; this.state.pagination.current = data.data.pageNo; this.state.pagination.total = data.data.totalCount; this.setState({ dataSource: this.state.data, pagination: this.state.pagination }); }).always(function () { this.setState({ loading: false }); }.bind(this)); }, getInitialState() { return { selectedRowKeys: [], selectedRows: [], loading: false, pagination: { defaultCurrent: 1, defaultPageSize: 10, showQuickJumper: true, pageSize: 10, onChange: function (page) { this.loadData(page); }.bind(this), showTotal: function (total) { return '共' + total + '条数据'; } }, columns: [ { title: '年份', dataIndex: 'year', key: 'year' }, { title: '总人数', dataIndex: 'firmTotal', key: 'firmTotal' }, { title: '科技人员', dataIndex: 'techTotal', key: 'techTotal' }, { title: '博士人数', dataIndex: 'doctor', key: 'doctor', }, { title: '高级职称人数', dataIndex: 'seniorTitle', key: 'seniorTitle', }, { title: '30岁以下人数', dataIndex: 'belowThirty', key: 'belowThirty', }, { title: '相关附件', dataIndex: 'attachment', key: 'attachment', render: (text) => { return
{text[1]} {text[2]}
} } ], dataSource: [] }; }, componentWillMount() { this.loadData(); }, tableRowClick(record, index) { this.state.RowData = record; this.setState({ showDesc: true }); }, delectRow() { let deletedIds = []; for (let idx = 0; idx < this.state.selectedRows.length; idx++) { let rowItem = this.state.selectedRows[idx]; if (rowItem.id) { deletedIds.push(rowItem.id) } } this.setState({ selectedRowKeys: [], loading: deletedIds.length > 0 }); $.ajax({ method: "POST", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/user/deleteHumanResource", data: { ids: deletedIds } }).done(function (data) { if (!data.error.length) { message.success('删除成功!'); this.setState({ loading: false, }); } else { message.warning(data.error[0].message); }; this.loadData(); }.bind(this)); }, closeDesc(e, s) { this.state.showDesc = e; if (s) { this.loadData(); }; }, render() { const rowSelection = { selectedRowKeys: this.state.selectedRowKeys, onChange: (selectedRowKeys, selectedRows) => { this.setState({ selectedRows: selectedRows, selectedRowKeys: selectedRowKeys }); } }; const hasSelected = this.state.selectedRowKeys.length > 0; return (
人力资源状况

); } }); export default HrSituation;