hrSituation.jsx 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832
  1. import React from 'react';
  2. import { Switch, Input, InputNumber, Button, Form, Icon, Spin, message, Table, Modal, Upload, Select } from 'antd';
  3. import { beforeUploadFile, newDownloadFile, getProportion, saveProportion, getPreview } from '../../../../tools.js';
  4. import './hrSituation.less'
  5. import ajax from 'jquery/src/ajax/xhr.js'
  6. import $ from 'jquery/src/ajax';
  7. const HrSituationDescFrom = Form.create()(React.createClass({
  8. getInitialState() {
  9. return {
  10. loading: false,
  11. yearOption: []
  12. };
  13. },
  14. componentWillMount() {
  15. let d = new Date();
  16. let _me = this;
  17. d = d.getFullYear();
  18. for (let i = d; i > d - 20; i--) {
  19. _me.state.yearOption.push(
  20. <Select.Option value={i.toString()} key={i}>{i}</Select.Option>
  21. )
  22. }
  23. },
  24. handleSubmit(e) {
  25. e.preventDefault();
  26. this.props.form.validateFields((err, values) => {
  27. if (values.firmTotal < values.firmInService + values.firmPartTime + values.firmTemporary) {
  28. message.warning("总体情况的在职人员数、兼职人员数、临时聘用人员数相加小于等于企业职工总数!");
  29. return;
  30. };
  31. if (values.firmTotal < values.techTotal) {
  32. message.warning("科技人员数小于等于企业职工总数!");
  33. return;
  34. };
  35. if (values.firmInService < values.techInService || values.firmPartTime < values.techPartTime || values.firmTemporary < values.techTemporary ||
  36. values.firmForeign < values.techForeign || values.firmAbroad < values.techAbroad || values.firmCore < values.techCore) {
  37. message.warning("科技人员各项人数小于等于企业职工各项人数!");
  38. return;
  39. };
  40. if (values.firmTotal < values.doctor + values.master + values.undergraduate + values.college) {
  41. message.warning("全体人员结构中学历一栏人数总和小于等于职工人数!");
  42. return;
  43. };
  44. if (values.firmTotal < values.belowThirty + values.thirtyoneToThirtyfour + values.fortyoneToFifty + values.aboveFifty) {
  45. message.warning("全体人员结构中年龄一栏人数总和小于等于职工人数!");
  46. return;
  47. };
  48. if (!this.state.year && !this.props.data.year) {
  49. message.warning("请输入年份!");
  50. return;
  51. };
  52. if (!err) {
  53. this.props.spinState(true);
  54. $.ajax({
  55. method: "POST",
  56. dataType: "json",
  57. crossDomain: false,
  58. url: globalConfig.context + "/api/admin/updateOrgHumanResource",
  59. data: {
  60. id: this.props.data.id,
  61. uid: this.props.uid,
  62. year: this.state.year || this.props.data.year,
  63. aboveFifty: values.aboveFifty,
  64. belowThirty: values.belowThirty,
  65. college: values.college,
  66. doctor: values.doctor,
  67. firmAbroad: values.firmAbroad,
  68. firmCore: values.firmCore,
  69. firmForeign: values.firmForeign,
  70. firmInService: values.firmInService,
  71. firmPartTime: values.firmPartTime,
  72. firmTemporary: values.firmTemporary,
  73. firmTotal: values.firmTotal,
  74. fortyoneToFifty: values.fortyoneToFifty,
  75. intermediateTitle: values.intermediateTitle,
  76. juniorTitle: values.juniorTitle,
  77. master: values.master,
  78. seniorMechanic: values.seniorMechanic,
  79. seniorTitle: values.seniorTitle,
  80. techAbroad: values.techAbroad,
  81. techCore: values.techCore,
  82. techForeign: values.techForeign,
  83. techInService: values.techInService,
  84. techPartTime: values.techPartTime,
  85. techTemporary: values.techTemporary,
  86. techTotal: values.techTotal,
  87. thirtyoneToThirtyfour: values.thirtyoneToThirtyfour,
  88. undergraduate: values.undergraduate,
  89. rosterUrl: this.state.rosterUrl,
  90. socialSecurityUrl: this.state.socialSecurityUrl,
  91. newEmployment: values.newEmployment,
  92. graduateNumber: values.graduateNumber
  93. }
  94. }).done(function (data) {
  95. if (!data.error.length) {
  96. message.success('保存成功!');
  97. this.props.clickOk();
  98. this.props.spinState(false);
  99. this.props.form.resetFields();
  100. } else {
  101. message.warning(data.error[0].message);
  102. this.props.spinState(false);
  103. }
  104. }.bind(this));
  105. }
  106. });
  107. },
  108. componentWillReceiveProps(nextProps) {
  109. if (!this.props.visible && nextProps.visible) {
  110. this.props.form.resetFields();
  111. this.state.fileList_roster = [];
  112. this.state.fileList_social_security = [];
  113. };
  114. },
  115. render() {
  116. const { getFieldDecorator } = this.props.form;
  117. const formItemLayout = {
  118. labelCol: { span: 8 },
  119. wrapperCol: { span: 16 },
  120. };
  121. const FormItem = Form.Item;
  122. const theData = this.props.data;
  123. return (
  124. <Form onSubmit={this.handleSubmit} className="hrSituation-form">
  125. <div className="clearfix">
  126. <div className="activityCost-title"><span>年份: </span>
  127. {
  128. theData.year ? <span>{theData.year}</span> :
  129. <Select placeholder="请选择年份" style={{ width: 200 }}
  130. onSelect={(e, n) => { this.state.year = e }}>
  131. {this.state.yearOption}
  132. </Select>
  133. }
  134. </div>
  135. </div>
  136. <p className="hrSituation-title">总体情况</p>
  137. <div className="clearfix">
  138. <span className="hrSituation-span">总数(人)</span>
  139. <FormItem className="half-item"
  140. {...formItemLayout}
  141. label="企业职工"
  142. >
  143. {getFieldDecorator('firmTotal', {
  144. initialValue: this.props.data.firmTotal || 0
  145. })(
  146. <InputNumber />
  147. )}
  148. </FormItem>
  149. <FormItem className="half-item"
  150. {...formItemLayout}
  151. label="科技人员"
  152. >
  153. {getFieldDecorator('techTotal', {
  154. initialValue: this.props.data.techTotal || 0
  155. })(
  156. <InputNumber />
  157. )}
  158. </FormItem>
  159. <FormItem className="half-item" style={{ width: '50%' }}>
  160. <span>其中科技人员占比
  161. {(() => {
  162. if (!this.props.form.getFieldValue('techTotal') || !this.props.form.getFieldValue('firmTotal')) {
  163. return 0
  164. }
  165. return (this.props.form.getFieldValue('techTotal') / this.props.form.getFieldValue('firmTotal') * 100).toFixed(2)
  166. })()}
  167. %</span>
  168. </FormItem>
  169. <span className="hrSituation-span">在职人员(人)</span>
  170. <FormItem className="half-item"
  171. {...formItemLayout}
  172. label="企业职工"
  173. >
  174. {getFieldDecorator('firmInService', {
  175. initialValue: this.props.data.firmInService || 0
  176. })(
  177. <InputNumber />
  178. )}
  179. </FormItem>
  180. <FormItem className="half-item"
  181. {...formItemLayout}
  182. label="科技人员"
  183. >
  184. {getFieldDecorator('techInService', {
  185. initialValue: this.props.data.techInService || 0
  186. })(
  187. <InputNumber />
  188. )}
  189. </FormItem>
  190. <span className="hrSituation-span">兼职人员(人)</span>
  191. <FormItem className="half-item"
  192. {...formItemLayout}
  193. label="企业职工"
  194. >
  195. {getFieldDecorator('firmPartTime', {
  196. initialValue: this.props.data.firmPartTime || 0
  197. })(
  198. <InputNumber />
  199. )}
  200. </FormItem>
  201. <FormItem className="half-item"
  202. {...formItemLayout}
  203. label="科技人员"
  204. >
  205. {getFieldDecorator('techPartTime', {
  206. initialValue: this.props.data.techPartTime || 0
  207. })(
  208. <InputNumber />
  209. )}
  210. </FormItem>
  211. <span className="hrSituation-span">临时聘用人员(人)</span>
  212. <FormItem className="half-item"
  213. {...formItemLayout}
  214. label="企业职工"
  215. >
  216. {getFieldDecorator('firmTemporary', {
  217. initialValue: this.props.data.firmTemporary || 0
  218. })(
  219. <InputNumber />
  220. )}
  221. </FormItem>
  222. <FormItem className="half-item"
  223. {...formItemLayout}
  224. label="科技人员"
  225. >
  226. {getFieldDecorator('techTemporary', {
  227. initialValue: this.props.data.techTemporary || 0
  228. })(
  229. <InputNumber />
  230. )}
  231. </FormItem>
  232. <span className="hrSituation-span">外籍人员(人)</span>
  233. <FormItem className="half-item"
  234. {...formItemLayout}
  235. label="企业职工"
  236. >
  237. {getFieldDecorator('firmForeign', {
  238. initialValue: this.props.data.firmForeign || 0
  239. })(
  240. <InputNumber />
  241. )}
  242. </FormItem>
  243. <FormItem className="half-item"
  244. {...formItemLayout}
  245. label="科技人员"
  246. >
  247. {getFieldDecorator('techForeign', {
  248. initialValue: this.props.data.techForeign || 0
  249. })(
  250. <InputNumber />
  251. )}
  252. </FormItem>
  253. <span className="hrSituation-span">留学归国人员(人)</span>
  254. <FormItem className="half-item"
  255. {...formItemLayout}
  256. label="企业职工"
  257. >
  258. {getFieldDecorator('firmAbroad', {
  259. initialValue: this.props.data.firmAbroad || 0
  260. })(
  261. <InputNumber />
  262. )}
  263. </FormItem>
  264. <FormItem className="half-item"
  265. {...formItemLayout}
  266. label="科技人员"
  267. >
  268. {getFieldDecorator('techAbroad', {
  269. initialValue: this.props.data.techAbroad || 0
  270. })(
  271. <InputNumber />
  272. )}
  273. </FormItem>
  274. <span className="hrSituation-span">干人计划人员(人)</span>
  275. <FormItem className="half-item"
  276. {...formItemLayout}
  277. label="企业职工"
  278. >
  279. {getFieldDecorator('firmCore', {
  280. initialValue: this.props.data.firmCore || 0
  281. })(
  282. <InputNumber />
  283. )}
  284. </FormItem>
  285. <FormItem className="half-item"
  286. {...formItemLayout}
  287. label="科技人员"
  288. >
  289. {getFieldDecorator('techCore', {
  290. initialValue: this.props.data.techCore || 0
  291. })(
  292. <InputNumber />
  293. )}
  294. </FormItem>
  295. </div>
  296. <p className="hrSituation-title">全体人员结构</p>
  297. <div className="clearfix">
  298. <span className="hrSituation-span">学历人数</span>
  299. <FormItem className="half-item"
  300. {...formItemLayout}
  301. label="博士"
  302. >
  303. {getFieldDecorator('doctor', {
  304. initialValue: this.props.data.doctor || 0
  305. })(
  306. <InputNumber />
  307. )}
  308. </FormItem>
  309. <FormItem className="half-item"
  310. {...formItemLayout}
  311. label="硕士"
  312. >
  313. {getFieldDecorator('master', {
  314. initialValue: this.props.data.master || 0
  315. })(
  316. <InputNumber />
  317. )}
  318. </FormItem>
  319. <FormItem className="half-item"
  320. {...formItemLayout}
  321. label="本科"
  322. >
  323. {getFieldDecorator('undergraduate', {
  324. initialValue: this.props.data.undergraduate || 0
  325. })(
  326. <InputNumber />
  327. )}
  328. </FormItem>
  329. <FormItem className="half-item"
  330. {...formItemLayout}
  331. label="大专及以下"
  332. >
  333. {getFieldDecorator('college', {
  334. initialValue: this.props.data.college || 0
  335. })(
  336. <InputNumber />
  337. )}
  338. </FormItem>
  339. </div>
  340. <div className="clearfix">
  341. <span className="hrSituation-span">职称人数</span>
  342. <FormItem className="half-item"
  343. {...formItemLayout}
  344. label="高级职称"
  345. >
  346. {getFieldDecorator('seniorTitle', {
  347. initialValue: this.props.data.seniorTitle || 0
  348. })(
  349. <InputNumber />
  350. )}
  351. </FormItem>
  352. <FormItem className="half-item"
  353. {...formItemLayout}
  354. label="中级职称"
  355. >
  356. {getFieldDecorator('intermediateTitle', {
  357. initialValue: this.props.data.intermediateTitle || 0
  358. })(
  359. <InputNumber />
  360. )}
  361. </FormItem>
  362. <FormItem className="half-item"
  363. {...formItemLayout}
  364. label="初级职称"
  365. >
  366. {getFieldDecorator('juniorTitle', {
  367. initialValue: this.props.data.juniorTitle || 0
  368. })(
  369. <InputNumber />
  370. )}
  371. </FormItem>
  372. <FormItem className="half-item"
  373. {...formItemLayout}
  374. label="高级技工"
  375. >
  376. {getFieldDecorator('seniorMechanic', {
  377. initialValue: this.props.data.seniorMechanic || 0
  378. })(
  379. <InputNumber />
  380. )}
  381. </FormItem>
  382. </div>
  383. <div className="clearfix">
  384. <span className="hrSituation-span">年龄人数</span>
  385. <FormItem className="half-item"
  386. {...formItemLayout}
  387. label="30及以下"
  388. >
  389. {getFieldDecorator('belowThirty', {
  390. initialValue: this.props.data.belowThirty || 0
  391. })(
  392. <InputNumber />
  393. )}
  394. </FormItem>
  395. <FormItem className="half-item"
  396. {...formItemLayout}
  397. label="31-34"
  398. >
  399. {getFieldDecorator('thirtyoneToThirtyfour', {
  400. initialValue: this.props.data.thirtyoneToThirtyfour || 0
  401. })(
  402. <InputNumber />
  403. )}
  404. </FormItem>
  405. <FormItem className="half-item"
  406. {...formItemLayout}
  407. label="41-50"
  408. >
  409. {getFieldDecorator('fortyoneToFifty', {
  410. initialValue: this.props.data.fortyoneToFifty || 0
  411. })(
  412. <InputNumber />
  413. )}
  414. </FormItem>
  415. <FormItem className="half-item"
  416. {...formItemLayout}
  417. label="50以上"
  418. >
  419. {getFieldDecorator('aboveFifty', {
  420. initialValue: this.props.data.aboveFifty || 0
  421. })(
  422. <InputNumber />
  423. )}
  424. </FormItem>
  425. </div>
  426. <p className="hrSituation-title">每年新增员工数</p>
  427. <div className="clearfix">
  428. <FormItem
  429. labelCol={{ span: 16 }}
  430. wrapperCol={{ span: 8 }}
  431. label="新增就业人数"
  432. >
  433. {getFieldDecorator('newEmployment', {
  434. initialValue: this.props.data.newEmployment || 0
  435. })(
  436. <InputNumber />
  437. )}
  438. </FormItem>
  439. <FormItem
  440. labelCol={{ span: 16 }}
  441. wrapperCol={{ span: 8 }}
  442. label="高校应届毕业生人数"
  443. >
  444. {getFieldDecorator('graduateNumber', {
  445. initialValue: this.props.data.graduateNumber || 0
  446. })(
  447. <InputNumber />
  448. )}
  449. </FormItem>
  450. </div>
  451. <div className="hrSituation-roster">
  452. <Upload
  453. name="ratepay"
  454. action={globalConfig.context + "/api/admin/uploadRoster"}
  455. data={{ 'sign': 'roster', 'year': (this.state.year || theData.year), 'uid': this.props.uid }}
  456. beforeUpload={beforeUploadFile}
  457. fileList={this.state.fileList_roster}
  458. onChange={(info) => {
  459. if (info.file.status !== 'uploading') {
  460. console.log(info.file, info.fileList);
  461. }
  462. if (info.file.status === 'done') {
  463. if (!info.file.response.error.length) {
  464. message.success(`${info.file.name} 文件上传成功!`);
  465. } else {
  466. message.warning(info.file.response.error[0].message);
  467. return;
  468. };
  469. this.state.rosterUrl = info.file.response.data;
  470. } else if (info.file.status === 'error') {
  471. message.error(`${info.file.name} 文件上传失败。`);
  472. };
  473. this.setState({ fileList_roster: info.fileList.slice(-1) });
  474. }}
  475. >
  476. <Button><Icon type="upload" /> 上传花名册 </Button>
  477. </Upload>
  478. <p style={{ marginTop: '10px' }}>{theData.rosterUrl ?
  479. <span className="download-file">
  480. <a onClick={newDownloadFile.bind(null, this.props.data.id, 'roster', '/api/admin/downloadHumanResource')}>{theData.rosterDownloadFileName}</a>
  481. <a onClick={() => {
  482. var newTab = window.open('about:blank'); getPreview(theData.id, 'humanResource', 'roster', function (data) { newTab.location.href = data; });
  483. }}><Icon style={{ fontSize: '16px' }} type="eye-o" /></a>
  484. </span>
  485. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
  486. </div>
  487. <div className="hrSituation-roster">
  488. <Upload
  489. name="ratepay"
  490. action={globalConfig.context + "/api/admin/uploadSocialSecurity"}
  491. data={{ 'sign': 'social_security', 'year': (this.state.year || theData.year), 'uid': this.props.uid }}
  492. beforeUpload={beforeUploadFile}
  493. fileList={this.state.fileList_social_security}
  494. onChange={(info) => {
  495. if (info.file.status !== 'uploading') {
  496. console.log(info.file, info.fileList);
  497. }
  498. if (info.file.status === 'done') {
  499. if (!info.file.response.error.length) {
  500. message.success(`${info.file.name} 文件上传成功!`);
  501. } else {
  502. message.warning(info.file.response.error[0].message);
  503. return;
  504. };
  505. this.state.socialSecurityUrl = info.file.response.data;
  506. } else if (info.file.status === 'error') {
  507. message.error(`${info.file.name} 文件上传失败。`);
  508. };
  509. this.setState({ fileList_social_security: info.fileList.slice(-1) });
  510. }}
  511. >
  512. <Button><Icon type="upload" /> 上传社保情况 </Button>
  513. </Upload>
  514. <p style={{ marginTop: '10px' }}>{theData.socialSecurityUrl ?
  515. <span className="download-file">
  516. <a onClick={newDownloadFile.bind(null, this.props.data.id, 'social_security', '/api/admin/downloadHumanResource')}>{theData.socialSecurityDownloadFileName}</a>
  517. <a onClick={() => {
  518. var newTab = window.open('about:blank'); getPreview(theData.id, 'humanResource', 'social_security', function (data) { newTab.location.href = data; });
  519. }}><Icon style={{ fontSize: '16px' }} type="eye-o" /></a>
  520. </span>
  521. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
  522. </div>
  523. <div>
  524. <span style={{ color: "red" }}>提示</span>
  525. <p>1、总体情况的在职人员数、兼职人员数、临时聘用人员数相加小于等于企业职工总数。</p>
  526. <p>2、科技人员数小于等于企业职工总数。</p>
  527. <p>3、科技人员各项人数小于等于企业职工各项人数。</p>
  528. <p>4、全体人员结构中学历一栏人数总和小于等于职工人数。</p>
  529. <p>5、全体人员结构中年龄一栏人数总和小于等于职工人数。</p>
  530. <Button style={{ marginTop: "20px" }} className="set-submit" type="primary" htmlType="submit">保存</Button>
  531. </div>
  532. </Form >
  533. );
  534. },
  535. }));
  536. const HrSituationDesc = React.createClass({
  537. getInitialState() {
  538. return {
  539. visible: false,
  540. loading: false
  541. };
  542. },
  543. componentWillReceiveProps(nextProps) {
  544. this.state.visible = nextProps.showDesc
  545. },
  546. showModal() {
  547. this.setState({
  548. visible: true,
  549. });
  550. },
  551. handleOk() {
  552. this.setState({
  553. visible: false,
  554. });
  555. this.props.closeDesc(false, true);
  556. },
  557. handleCancel(e) {
  558. this.setState({
  559. visible: false,
  560. });
  561. this.props.closeDesc(false);
  562. },
  563. spinChange(e) {
  564. this.setState({
  565. loading: e
  566. });
  567. },
  568. render() {
  569. return (
  570. <div className="patent-addNew">
  571. <Spin spinning={this.state.loading} className='spin-box'>
  572. <Modal title="人力资源状况" visible={this.state.visible}
  573. onOk={this.handleOk} onCancel={this.handleCancel}
  574. width='1200px'
  575. footer=''
  576. >
  577. <HrSituationDescFrom
  578. uid={this.props.uid}
  579. data={this.props.data}
  580. spinState={this.spinChange}
  581. visible={this.state.visible}
  582. closeModal={this.handleCancel}
  583. clickOk={this.handleOk} />
  584. </Modal>
  585. </Spin>
  586. </div>
  587. );
  588. },
  589. });
  590. const HrSituation = React.createClass({
  591. loadData(pageNo) {
  592. this.state.data = [];
  593. this.setState({
  594. loading: true
  595. });
  596. $.ajax({
  597. method: "post",
  598. dataType: "json",
  599. crossDomain: false,
  600. url: globalConfig.context + "/api/admin/orgHumanResource",
  601. data: {
  602. pageNo: pageNo || 1,
  603. pageSize: this.state.pagination.pageSize,
  604. uid: this.props.data.uid
  605. }
  606. }).done((data) => {
  607. if (data.error.length || !data.data || !data.data.list) {
  608. message.warning(data.error[0].message);
  609. return;
  610. };
  611. for (let i = 0; i < data.data.list.length; i++) {
  612. let thisdata = data.data.list[i];
  613. this.state.data.push({
  614. key: i,
  615. id: thisdata.id,
  616. uid: thisdata.uid,
  617. year: thisdata.year,
  618. aboveFifty: thisdata.aboveFifty,
  619. belowThirty: thisdata.belowThirty,
  620. college: thisdata.college,
  621. doctor: thisdata.doctor,
  622. firmAbroad: thisdata.firmAbroad,
  623. firmCore: thisdata.firmCore,
  624. firmForeign: thisdata.firmForeign,
  625. firmInService: thisdata.firmInService,
  626. firmPartTime: thisdata.firmPartTime,
  627. firmTemporary: thisdata.firmTemporary,
  628. firmTotal: thisdata.firmTotal,
  629. fortyoneToFifty: thisdata.fortyoneToFifty,
  630. intermediateTitle: thisdata.intermediateTitle,
  631. juniorTitle: thisdata.juniorTitle,
  632. master: thisdata.master,
  633. seniorMechanic: thisdata.seniorMechanic,
  634. seniorTitle: thisdata.seniorTitle,
  635. techAbroad: thisdata.techAbroad,
  636. techCore: thisdata.techCore,
  637. techForeign: thisdata.techForeign,
  638. techInService: thisdata.techInService,
  639. techPartTime: thisdata.techPartTime,
  640. techTemporary: thisdata.techTemporary,
  641. techTotal: thisdata.techTotal,
  642. thirtyoneToThirtyfour: thisdata.thirtyoneToThirtyfour,
  643. undergraduate: thisdata.undergraduate,
  644. rosterUrl: thisdata.rosterUrl,
  645. rosterDownloadFileName: thisdata.rosterDownloadFileName,
  646. socialSecurityUrl: thisdata.socialSecurityUrl,
  647. socialSecurityDownloadFileName: thisdata.socialSecurityDownloadFileName,
  648. attachment: [thisdata.id, thisdata.rosterDownloadFileName, thisdata.socialSecurityDownloadFileName],
  649. newEmployment: thisdata.newEmployment,
  650. graduateNumber: thisdata.graduateNumber
  651. });
  652. };
  653. this.state.pagination.current = data.data.pageNo;
  654. this.state.pagination.total = data.data.totalCount;
  655. this.setState({
  656. dataSource: this.state.data,
  657. pagination: this.state.pagination
  658. });
  659. }).always(function () {
  660. this.setState({
  661. loading: false
  662. });
  663. }.bind(this));
  664. let _me = this;
  665. getProportion(this.props.data.uid, function (data) { _me.setState({ proportion: data }); });
  666. },
  667. getInitialState() {
  668. return {
  669. selectedRowKeys: [],
  670. selectedRows: [],
  671. loading: false,
  672. pagination: {
  673. defaultCurrent: 1,
  674. defaultPageSize: 10,
  675. showQuickJumper: true,
  676. pageSize: 10,
  677. onChange: function (page) {
  678. this.loadData(page);
  679. }.bind(this),
  680. showTotal: function (total) {
  681. return '共' + total + '条数据';
  682. }
  683. },
  684. columns: [
  685. {
  686. title: '年份',
  687. dataIndex: 'year',
  688. key: 'year'
  689. }, {
  690. title: '总人数',
  691. dataIndex: 'firmTotal',
  692. key: 'firmTotal'
  693. }, {
  694. title: '科技人员',
  695. dataIndex: 'techTotal',
  696. key: 'techTotal'
  697. }, {
  698. title: '博士人数',
  699. dataIndex: 'doctor',
  700. key: 'doctor',
  701. }, {
  702. title: '高级职称人数',
  703. dataIndex: 'seniorTitle',
  704. key: 'seniorTitle',
  705. }, {
  706. title: '30岁以下人数',
  707. dataIndex: 'belowThirty',
  708. key: 'belowThirty',
  709. }, {
  710. title: '相关附件',
  711. dataIndex: 'attachment',
  712. key: 'attachment',
  713. render: (text) => {
  714. return <div>
  715. <a style={{ marginRight: '10px' }} onClick={newDownloadFile.bind(null, text[0], 'roster', '/api/admin/downloadHumanResource')}>{text[1]}</a>
  716. <a onClick={newDownloadFile.bind(null, text[0], 'social_security', '/api/admin/downloadHumanResource')}>{text[2]}</a>
  717. </div>
  718. }
  719. }
  720. ],
  721. dataSource: []
  722. };
  723. },
  724. componentWillMount() {
  725. this.loadData();
  726. },
  727. tableRowClick(record, index) {
  728. this.state.RowData = record;
  729. this.setState({
  730. showDesc: true
  731. });
  732. },
  733. delectRow() {
  734. let deletedIds = [];
  735. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  736. let rowItem = this.state.selectedRows[idx];
  737. if (rowItem.id) {
  738. deletedIds.push(rowItem.id)
  739. }
  740. }
  741. this.setState({
  742. selectedRowKeys: [],
  743. loading: deletedIds.length > 0
  744. });
  745. $.ajax({
  746. method: "POST",
  747. dataType: "json",
  748. crossDomain: false,
  749. url: globalConfig.context + "/api/user/cognizance/deleteFinance",
  750. data: {
  751. ids: deletedIds
  752. }
  753. }).done(function (data) {
  754. if (!data.error.length) {
  755. message.success('删除成功!');
  756. this.setState({
  757. loading: false,
  758. });
  759. } else {
  760. message.warning(data.error[0].message);
  761. };
  762. this.loadData();
  763. }.bind(this));
  764. },
  765. closeDesc(e, s) {
  766. this.state.showDesc = e;
  767. if (s) {
  768. this.loadData();
  769. };
  770. },
  771. render() {
  772. const rowSelection = {
  773. selectedRowKeys: this.state.selectedRowKeys,
  774. onChange: (selectedRowKeys, selectedRows) => {
  775. this.setState({
  776. selectedRows: selectedRows,
  777. selectedRowKeys: selectedRowKeys
  778. });
  779. }
  780. };
  781. const hasSelected = this.state.selectedRowKeys.length > 0;
  782. return (
  783. <div className="user-content" >
  784. <div className="content-title">
  785. <span>人力资源状况</span>
  786. <span className="proportion"> 是否已完成:</span>
  787. <Switch
  788. checked={this.state.proportion && this.state.proportion.humanResource == 1 ? true : false}
  789. checkedChildren={'已完成'}
  790. unCheckedChildren={'未完成'}
  791. onChange={(e) => {
  792. e ? this.state.proportion.humanResource = 1 : this.state.proportion.humanResource = 0;
  793. saveProportion(this.state.proportion.id, this.props.data.uid, 'humanResource', this.state.proportion.humanResource);
  794. this.setState({ proportion: this.state.proportion });
  795. }} />
  796. </div>
  797. <div className="user-search">
  798. <p>
  799. <Button style={{ background: "#ea0862", border: "none", color: "#fff" }}
  800. onClick={this.tableRowClick}>添加<Icon type="plus" /></Button>
  801. <Button style={{ background: "#3fcf9e", border: "none", color: "#fff" }}
  802. disabled={!hasSelected}
  803. onClick={this.delectRow}>删除<Icon type="minus" /></Button>
  804. </p>
  805. </div>
  806. <div className="patent-table">
  807. <Spin spinning={this.state.loading}>
  808. <Table columns={this.state.columns}
  809. dataSource={this.state.dataSource}
  810. pagination={this.state.pagination}
  811. rowSelection={rowSelection}
  812. onRowClick={this.tableRowClick} />
  813. </Spin>
  814. </div>
  815. <HrSituationDesc
  816. uid={this.props.data.uid}
  817. data={this.state.RowData}
  818. showDesc={this.state.showDesc} closeDesc={this.closeDesc} />
  819. </div >
  820. );
  821. }
  822. });
  823. export default HrSituation;