hrSituation.jsx 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. import React from 'react';
  2. import { Input, InputNumber, Button, Form, Icon, Spin, message } from 'antd';
  3. import './person.less';
  4. import './hrSituation.less'
  5. import ajax from 'jquery/src/ajax/xhr.js'
  6. import $ from 'jquery/src/ajax';
  7. const PersonFrom = Form.create()(React.createClass({
  8. getData() {
  9. this.props.spinState(true);
  10. $.ajax({
  11. method: "get",
  12. dataType: "json",
  13. url: globalConfig.context + "/api/user/member",
  14. success: function (data) {
  15. if (data.data) {
  16. }
  17. }.bind(this),
  18. }).always(function () {
  19. this.props.spinState(false);
  20. }.bind(this));
  21. },
  22. getInitialState() {
  23. return {
  24. loading: false,
  25. };
  26. },
  27. handleSubmit(e) {
  28. e.preventDefault();
  29. this.props.form.validateFields((err, values) => {
  30. if (!err) {
  31. this.props.spinState(true);
  32. $.ajax({
  33. method: "POST",
  34. dataType: "json",
  35. crossDomain: false,
  36. url: globalConfig.context + "/api/user/userInfo",
  37. data: {
  38. "nickname": values.nickname,
  39. "residenceProvince": cmbP,
  40. "residenceCity": cmbC,
  41. "residenceArea": cmbA,
  42. "personPortraitUrl": this.state.avatarUrlData,
  43. "lifePhotoUrl": lifePhotoUrl,
  44. "personalProfile": values.intro,
  45. "email": values.email,
  46. "fixedTelArea": this.state.fixTelArea,
  47. "fixedTel": this.state.fixTel,
  48. "fixedTelExtension": this.state.fixTelExtension,
  49. "qq": values.qq,
  50. "postalAddress": values.address,
  51. "postcode": values.postcode
  52. }
  53. }).done(function (data) {
  54. if (!data.error.length) {
  55. message.success('保存成功!');
  56. } else {
  57. message.warning(data.error[0].message);
  58. }
  59. }.bind(this)).always(function () {
  60. this.props.spinState(false);
  61. }.bind(this));
  62. }
  63. });
  64. },
  65. componentWillMount() {
  66. this.getData();
  67. },
  68. render() {
  69. const { getFieldDecorator } = this.props.form;
  70. const formItemLayout = {
  71. labelCol: { span: 8 },
  72. wrapperCol: { span: 16 },
  73. };
  74. const FormItem = Form.Item;
  75. return (
  76. <Form onSubmit={this.handleSubmit} className="hrSituation-form clearfix">
  77. <p className="hrSituation-title">总体情况</p>
  78. <span className="hrSituation-span">总数(人)</span>
  79. <FormItem className="half-item"
  80. {...formItemLayout}
  81. label="企业职工"
  82. >
  83. {getFieldDecorator('firmTotal', {
  84. initialValue: this.state.nickname || null
  85. })(
  86. <InputNumber />
  87. )}
  88. </FormItem>
  89. <FormItem className="half-item"
  90. style={{marginRight:"50%"}}
  91. {...formItemLayout}
  92. label="科技人员"
  93. >
  94. {getFieldDecorator('techTotal', {
  95. initialValue: this.state.nickname || null
  96. })(
  97. <InputNumber />
  98. )}
  99. </FormItem>
  100. <span className="hrSituation-span">在职人员(人)</span>
  101. <FormItem className="half-item"
  102. {...formItemLayout}
  103. label="企业职工"
  104. >
  105. {getFieldDecorator('firmInService', {
  106. initialValue: this.state.nickname || null
  107. })(
  108. <InputNumber />
  109. )}
  110. </FormItem>
  111. <FormItem className="half-item"
  112. {...formItemLayout}
  113. label="科技人员"
  114. >
  115. {getFieldDecorator('techInService', {
  116. initialValue: this.state.nickname || null
  117. })(
  118. <InputNumber />
  119. )}
  120. </FormItem>
  121. <span className="hrSituation-span">兼职人员(人)</span>
  122. <FormItem className="half-item"
  123. {...formItemLayout}
  124. label="企业职工"
  125. >
  126. {getFieldDecorator('firmPartTime', {
  127. initialValue: this.state.nickname || null
  128. })(
  129. <InputNumber />
  130. )}
  131. </FormItem>
  132. <FormItem className="half-item"
  133. {...formItemLayout}
  134. label="科技人员"
  135. >
  136. {getFieldDecorator('techPartTime', {
  137. initialValue: this.state.nickname || null
  138. })(
  139. <InputNumber />
  140. )}
  141. </FormItem>
  142. <span className="hrSituation-span">临时聘用人员(人)</span>
  143. <FormItem className="half-item"
  144. {...formItemLayout}
  145. label="企业职工"
  146. >
  147. {getFieldDecorator('firmPartTime', {
  148. initialValue: this.state.nickname || null
  149. })(
  150. <InputNumber />
  151. )}
  152. </FormItem>
  153. <FormItem className="half-item"
  154. {...formItemLayout}
  155. label="科技人员"
  156. >
  157. {getFieldDecorator('techPartTime', {
  158. initialValue: this.state.nickname || null
  159. })(
  160. <InputNumber />
  161. )}
  162. </FormItem>
  163. <span className="hrSituation-span">外籍人员(人)</span>
  164. <FormItem className="half-item"
  165. {...formItemLayout}
  166. label="企业职工"
  167. >
  168. {getFieldDecorator('firmForeign', {
  169. initialValue: this.state.nickname || null
  170. })(
  171. <InputNumber />
  172. )}
  173. </FormItem>
  174. <FormItem className="half-item"
  175. {...formItemLayout}
  176. label="科技人员"
  177. >
  178. {getFieldDecorator('techForeign', {
  179. initialValue: this.state.nickname || null
  180. })(
  181. <InputNumber />
  182. )}
  183. </FormItem>
  184. <div className="clearfix" style={{ paddingLeft: '3.3%' }}>
  185. <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
  186. </div>
  187. </Form >
  188. );
  189. },
  190. }));
  191. const Person = React.createClass({
  192. getInitialState() {
  193. return {
  194. loading: false
  195. };
  196. },
  197. spinChange(e) {
  198. this.setState({
  199. loading: e
  200. });
  201. },
  202. render() {
  203. return (
  204. <Spin spinning={this.state.loading} className='spin-box'>
  205. <div className="set-person">
  206. <div className="acc-detail">
  207. <p className="acc-title">人力状况</p>
  208. <PersonFrom spinState={this.spinChange} />
  209. </div>
  210. </div>
  211. </Spin>
  212. )
  213. }
  214. });
  215. export default Person;