hrSituation.jsx 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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">
  77. <p className="hrSituation-title">总体情况</p>
  78. <div className="clearfix">
  79. <span className="hrSituation-span">总数(人)</span>
  80. <FormItem className="half-item"
  81. {...formItemLayout}
  82. label="企业职工"
  83. >
  84. {getFieldDecorator('firmTotal', {
  85. initialValue: this.state.nickname || null
  86. })(
  87. <InputNumber />
  88. )}
  89. </FormItem>
  90. <FormItem className="half-item"
  91. style={{ marginRight: "50%" }}
  92. {...formItemLayout}
  93. label="科技人员"
  94. >
  95. {getFieldDecorator('techTotal', {
  96. initialValue: this.state.nickname || null
  97. })(
  98. <InputNumber />
  99. )}
  100. </FormItem>
  101. <span className="hrSituation-span">在职人员(人)</span>
  102. <FormItem className="half-item"
  103. {...formItemLayout}
  104. label="企业职工"
  105. >
  106. {getFieldDecorator('firmInService', {
  107. initialValue: this.state.nickname || null
  108. })(
  109. <InputNumber />
  110. )}
  111. </FormItem>
  112. <FormItem className="half-item"
  113. {...formItemLayout}
  114. label="科技人员"
  115. >
  116. {getFieldDecorator('techInService', {
  117. initialValue: this.state.nickname || null
  118. })(
  119. <InputNumber />
  120. )}
  121. </FormItem>
  122. <span className="hrSituation-span">兼职人员(人)</span>
  123. <FormItem className="half-item"
  124. {...formItemLayout}
  125. label="企业职工"
  126. >
  127. {getFieldDecorator('firmPartTime', {
  128. initialValue: this.state.nickname || null
  129. })(
  130. <InputNumber />
  131. )}
  132. </FormItem>
  133. <FormItem className="half-item"
  134. {...formItemLayout}
  135. label="科技人员"
  136. >
  137. {getFieldDecorator('techPartTime', {
  138. initialValue: this.state.nickname || null
  139. })(
  140. <InputNumber />
  141. )}
  142. </FormItem>
  143. <span className="hrSituation-span">临时聘用人员(人)</span>
  144. <FormItem className="half-item"
  145. {...formItemLayout}
  146. label="企业职工"
  147. >
  148. {getFieldDecorator('firmPartTime', {
  149. initialValue: this.state.nickname || null
  150. })(
  151. <InputNumber />
  152. )}
  153. </FormItem>
  154. <FormItem className="half-item"
  155. {...formItemLayout}
  156. label="科技人员"
  157. >
  158. {getFieldDecorator('techPartTime', {
  159. initialValue: this.state.nickname || null
  160. })(
  161. <InputNumber />
  162. )}
  163. </FormItem>
  164. <span className="hrSituation-span">外籍人员(人)</span>
  165. <FormItem className="half-item"
  166. {...formItemLayout}
  167. label="企业职工"
  168. >
  169. {getFieldDecorator('firmForeign', {
  170. initialValue: this.state.nickname || null
  171. })(
  172. <InputNumber />
  173. )}
  174. </FormItem>
  175. <FormItem className="half-item"
  176. {...formItemLayout}
  177. label="科技人员"
  178. >
  179. {getFieldDecorator('techForeign', {
  180. initialValue: this.state.nickname || null
  181. })(
  182. <InputNumber />
  183. )}
  184. </FormItem>
  185. <span className="hrSituation-span">留学归国人员(人)</span>
  186. <FormItem className="half-item"
  187. {...formItemLayout}
  188. label="企业职工"
  189. >
  190. {getFieldDecorator('firmAbroad', {
  191. initialValue: this.state.nickname || null
  192. })(
  193. <InputNumber />
  194. )}
  195. </FormItem>
  196. <FormItem className="half-item"
  197. {...formItemLayout}
  198. label="科技人员"
  199. >
  200. {getFieldDecorator('techAbroad', {
  201. initialValue: this.state.nickname || null
  202. })(
  203. <InputNumber />
  204. )}
  205. </FormItem>
  206. <span className="hrSituation-span">干人计划人员(人)</span>
  207. <FormItem className="half-item"
  208. {...formItemLayout}
  209. label="企业职工"
  210. >
  211. {getFieldDecorator('firmCore', {
  212. initialValue: this.state.nickname || null
  213. })(
  214. <InputNumber />
  215. )}
  216. </FormItem>
  217. <FormItem className="half-item"
  218. {...formItemLayout}
  219. label="科技人员"
  220. >
  221. {getFieldDecorator('techCore', {
  222. initialValue: this.state.nickname || null
  223. })(
  224. <InputNumber />
  225. )}
  226. </FormItem>
  227. </div>
  228. <p className="hrSituation-title">全体人员结构</p>
  229. <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
  230. </Form >
  231. );
  232. },
  233. }));
  234. const Person = React.createClass({
  235. getInitialState() {
  236. return {
  237. loading: false
  238. };
  239. },
  240. spinChange(e) {
  241. this.setState({
  242. loading: e
  243. });
  244. },
  245. render() {
  246. return (
  247. <Spin spinning={this.state.loading} className='spin-box'>
  248. <div className="set-person">
  249. <div className="acc-detail">
  250. <PersonFrom spinState={this.spinChange} />
  251. </div>
  252. </div>
  253. </Spin>
  254. )
  255. }
  256. });
  257. export default Person;